Oracle9i Sample Schemas Release 2 (9.2) Part Number A96539-01 |
|
When you do a complete installation of Oracle9i, the Sample Schemas are installed automatically with the seed database. If for some reason the seed database is removed from your system, you will need to reinstall the Sample Schemas before you can duplicate the examples you find in Oracle documentation and training materials.
This chapter describes how to install the Oracle9i Sample Schemas. It contains the following sections:
Using DBCA is by far the most intuitive and simple way to install the Sample Schemas. Step 4 of the database creation process lets you configure the Sample Schemas you wish to use in your database. The following dependencies are enforced by the Database Configuration Assistant:
Two of the three predefined database templates shipped with the Database Configuration Assistant contain the Sample Schemas:
The Sample Schemas that are available to you depend on the edition of Oracle you install and its configuration. Please consult the following table to see which schemas you can install:
Various dependencies have been established among the schemas. Therefore, you must create the schemas in the following order: HR
, OE
, PM
, QS
, and SH
.
Note: To make it easier for you to remember, the Oracle9i Sample Schemas are ordered, both in complexity and dependencies, in alphabetical order. |
Use this sequence to create the schemas:
HR
schema.OE
schema: The HR
schema must already be present, and you must know the password for the HR
schema so that you can grant HR
object privileges to OE
. Some HR
tables are visible to the OE
user through the use of private synonyms. In addition, some OE
tables have foreign key relationships to HR
tables.
PM
schema: Foreign key relationships require that the OE
schema already exist when the PM
schema is created. You need to know the password for OE
to grant to PM
the right to establish and use these foreign keys.
QS
schema: The shipping schema QS
is based on order entry data in OE
. Again, foreign key relationships require that the OE
schema already be present when the QS
schema is created. You need to know the password for OE
to grant to QS
the right to establish and use these foreign keys.SH
schema. The SH
schema logically depends on the OE
schema, although there is nothing that prevents you from creating this schema on its own, without the four other schemas.All scripts necessary to create this schema reside in $ORACLE_HOME/demo/schema/human_resources
.
You need to call only one script, hr_main.sql, to create all objects and load the data. Running hr_main.sql
accomplishes the following tasks:
HR
schemaHR
and grants the necessary privilegesHR
sh_dn_c.sql
and sh_dn_d.sql
are provided as schema extension. To prepare the Human Resources schema for use with the Directory capabilities of Oracle Internet Directory, run the sh_dn_c.sql
create script. If you want to return to the initial setup of the HR
schema, use the script sh_dn_d.sql
to erase the effects of sh_dn_c.sql
and erase the column added by this extension.The file used to drop the HR
schema is hr_drop.sql
.
All scripts necessary to create this schema reside in $ORACLE_HOME/demo/schema/order_entry
.
You need to call only one script, oe_main.sql
, to create all objects and load the data. Running oe_main.sql
accomplishes the following tasks:
OE
schemaOE
and grants the necessary privilegesOE
oe_cre.sql
to create data, procedural, and user defined objectsoe_oe_p_pi.sql
to populate the PRODUCT_INFORMATION
tableoe_p_whs.sql
to populate the WAREHOUSES
tableoe_p_cus.sql
to populate the CUSTOMERS
tableoe_p_ord.sql
to populate the ORDERS
tableoe_p_itm.sql
to populate the ORDER_ITEMS
tableoe_p_inv.sql
to populate the INVENTORIES
tableoe_views.sql
to create table viewsoe_idx.sql
to create indexes on data objectsoe_comnt.sql
to create comments on tables and columnsoc_main.sql
to create the OC
(Online catalog) object-oriented subschema within OE
. The oc_main.sql
script calls the following scripts:oc_cre.sql
to create a sequence of interrelated user defined objects, object tables and viewsoc_popul.sql
to populate object tablesoc_comnt.sql
to create comments on tables and columnsoe_p_pd.sql
to populate the PRODUCT_DESCRIPTIONS
table. Language-specific INSERT
statements for product names and descriptions are stored in these files:
oe_p_us.sql
oe_p_ar.sql
oe_p_cs.sql
oe_p_d.sql
oe_p_dk.sql
oe_p_e.sql
oe_p_el.sql
oe_p_esa.sql
oe_p_f.sql
oe_p_frc.sql
oe_p_hu.sql
oe_p_i.sql
oe_p_iw.sql
oe_p_ja.sql
oe_p_ko.sql
oe_p_n.sql
oe_p_nl.sql
oe_p_pl.sql
oe_p_pt.sql
oe_p_ptb.sql
oe_p_ro.sql
oe_p_ru.sql
oe_p_s.sql
oe_p_sf.sql
oe_p_sk.sql
oe_p_th.sql
oe_p_tr.sql
oe_p_zhs.sql
oe_p_zht.sql
oe_analz.sql
to gather schema statisticsThe files used for dropping the OE
schema and OC
subschema are:
All files necessary to create this schema reside in $ORACLE_HOME/demo/schema/product_media
.
You need to call only one script, pm_main.sql
, to create all objects and load the data. Running pm_main.sql
accomplishes the following tasks:
PM
schemaPM
and grants the necessary privilegesPM
The list of files used for populating the PM schema includes:
The file used to drop the PM schema is pm_drop.sql
.
All files necessary to create this schema reside in $ORACLE_HOME/demo/schema/shipping
.
You need to call only one script, qs_main.sql
, to create all objects and load the data. Running qs_main.sql
accomplishes the following tasks:
QS
schemaQS
and grants the necessary privilegesQS
qs_adm.sql
creates the Administrator schemaqs_cbadm.sql
creates the Customer Billing Administration schemaqs_cre.sql
creates queues, queue tables for the Queued Shipping schemaqs_cs.sql
creates the Customer Service schemaqs_es.sql
creates the Eastern Shipping schemaqs_os.sql
creates the Overseas Shipping schemaqs_ws.sql
creates the Western Shipping schemaqs_run.sql
creates the demo application procedures and objectsThe file used for dropping all queues in an orderly fashion is qs_drop.sql
.
All files necessary to create this schema reside in $ORACLE_HOME/demo/schema/sales_history
.
You need to call only one script, sh_main.sql
, to create all objects and load the data. Running sh_main.sql
accomplishes the following tasks:
SH
schemaSH
and grants the necessary privilegesSH
sh_cre.sql
to create tablessh_pop1.sql
to populate the dimension tables COUNTRIES
and CHANNELS
sh_pop2.sql
to populate the dimension table TIMES
sh_pop3.sql
to populate the remaining tables. The dimension tables PROMOTIONS
, CUSTOMERS
, PRODUCTS
and the fact table SALES
are loaded by SQL*Loader. Then, two directory paths are created inside the database to point to the load and log file locations. This allows the loading of the table COSTS
by defining the file sh_sales.dat
as an external table.sh_idx.sql
to create indexes on tablessh_cons.sql
to add constraints to tablessh_hiera.sql
to create dimensions and hierarchiessh_cremv.sql
to create materialized viewssh_comnt.sql
to add comments for columns and tablessh_analz.sql
to gather statisticssh_olp_c.sql
and sh_olp_d.sql
are provided as schema extension. To prepare the Sales History schema for use with the advanced analytic capabilities of OLAP Services, run the sh_olp_c.sql
create script. If you want to return to the initial setup of the SH
schema, use the script sh_olp_d.sql
to erase the effects of sh_olp_c.sql
and reinstate dimensions as they were before.The file used to drop the SH
schema is sh_drop.sql
.
To reset the Sample Schemas to their initial state, from the SQL*Plus command-line interface, use the following syntax:
@?/demo/schema/mksamplesystempwd
syspwd
hrpwd
oepwd
pmpwd
qspwd
shpwd
In place of the parameters systempwd
, syspwd
, hrpwd
, oepwd
, pmpwd
, qspwd
, and shpwd
provide the passwords for SYSTEM
and SYS
, and the HR
, OE
, PM
, and QS
schemas.
The mksample
script produces several log files located in the directory $ORACLE_HOME/demo/schema/log/
. These log files include:
mkverify.log
- Sample Schema creation log filehr_main.log
- HR
schema creation log fileoe_oc_main.log
- OE
schema creation log filepm_main.log
- PM
schema creation log filepm_p_lob.log
- SQL*Loader log file from loading PM.PRINT_MEDIA
qs_main.log
- QS
schema creation log filesh_main.log
- SH
schema creation log filesh_cust.log
- SQL*Loader log file from loading SH.CUSTOMERS
sh_prod.log
- SQL*Loader log file from loading SH.PRODUCTS
sh_promo.log
- SQL*Loader log file from loading SH.PROMOTIONS
sh_sales.log
- SQL*Loader log file from loading SH.SALES
sh_sales_ext.log
- External table log file from loading SH.COSTS
See Also:
Chapter 4, "Oracle9i Sample Schema Scripts" for a copy of the |
In most situations, there is no difference between installing a particular Sample Schema for the first time or reinstalling it over a previously installed version. The *_main.sql
scripts drop the schema users and all their objects.
In some cases, complex inter-object relationships in the OE
or QS
schemas prevent the DROP
USER
... CASCADE
operations from completing normally. In these rare cases, go through one of the following sequences.
For the OC
catalog subschema of the OE
schema:
OE
.oc_drop.sql
.SYSTEM
.OE
:
SELECT username FROM v$session;
DROP USER oe CASCADE;
For the QS
schemas:
SYSTEM
.QS
user:
SELECT username FROM v$session WHERE username like 'QS%';
qs_drop.sql
. You will be prompted for the passwords for the individual users.
|
Copyright © 2002 Oracle Corporation. All Rights Reserved. |
|