| 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 privilegesHRsh_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 privilegesOEoe_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.sqloe_p_ar.sqloe_p_cs.sqloe_p_d.sqloe_p_dk.sqloe_p_e.sqloe_p_el.sqloe_p_esa.sqloe_p_f.sqloe_p_frc.sqloe_p_hu.sqloe_p_i.sqloe_p_iw.sqloe_p_ja.sqloe_p_ko.sqloe_p_n.sqloe_p_nl.sqloe_p_pl.sqloe_p_pt.sqloe_p_ptb.sqloe_p_ro.sqloe_p_ru.sqloe_p_s.sqloe_p_sf.sqloe_p_sk.sqloe_p_th.sqloe_p_tr.sqloe_p_zhs.sqloe_p_zht.sqloe_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 privilegesPMThe 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 privilegesQSqs_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 privilegesSHsh_cre.sql to create tablessh_pop1.sql to populate the dimension tables COUNTRIES and CHANNELSsh_pop2.sql to populate the dimension table TIMESsh_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/mksamplesystempwdsyspwdhrpwdoepwdpmpwdqspwdshpwd
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_MEDIAqs_main.log - QS schema creation log filesh_main.log - SH schema creation log filesh_cust.log - SQL*Loader log file from loading SH.CUSTOMERSsh_prod.log - SQL*Loader log file from loading SH.PRODUCTSsh_promo.log - SQL*Loader log file from loading SH.PROMOTIONSsh_sales.log - SQL*Loader log file from loading SH.SALESsh_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. |
|