Oracle® Database Sample Schemas 11g Release 2 (11.2) Part Number E10831-02 |
|
|
PDF · Mobi · ePub |
This chapter describes the scripts used to generate the Oracle Database Sample Schemas. It contains the following sections:
Sample Schemas script directories are located in $ORACLE_HOME
/demo
/schema
. You must install the Oracle Database Examples media to populate the directories with the Sample Schema scripts. Each schema has two primary scripts:
The xx
_main.sql
script, where xx
is the schema abbreviation, resets and creates all objects and data for a particular schema. This main script calls all other scripts necessary to build and load the schema.
The script xx
_drop.sql
, where xx
is the schema abbreviation, removes all objects from a particular schema.
Sample Schemas script directories are located in the $ORACLE_HOME/
demo/schema
directory after completing the Oracle Database Examples installation.
Note:
This chapter contains only the master script for the entire sample schemas environment. It does not include the scripts for the individual schemas because these scripts are very lengthy.The master script, mksample.sql
, sets up the overall Sample Schema environment and creates all the schemas.
Note:
In the master script (mksample.sql
), which follows, you will notice variables such as %s_pmPath%
, %s_logPath%
, and %s_shPath%
. These variables are instantiated on installation.The text of the mksample.sql
script follows:
Rem Rem $Header: mksample.sql.sbs 02-apr-2003.14:55:17 $ Rem Rem mksample.sql Rem Rem Copyright (c) 2001, 2003, Oracle Corporation. All rights reserved. Rem Rem NAME Rem mksample.sql - creates all 5 Sample Schemas Rem Rem DESCRIPTION Rem This script rees and creates all Schemas belonging Rem to the Oracle Database 10g Sample Schemas. Rem If you are unsure about the prerequisites for the Sample Schemas, Rem please use the Database Configuration Assistant DBCA to Rem configure the Sample Schemas. Rem Rem NOTES Rem - OUI instantiates this script during install and saves it Rem as mksample.sql. The instantiated scripts matches Rem the directory structure on your system Rem - Tablespace EXAMPLE created with: Rem CREATE TABLESPACE example Rem NOLOGGING Rem DATAFILE '<filename>' SIZE 150M REUSE Rem AUTOEXTEND ON NEXT 640k Rem MAXSIZE UNLIMITED Rem EXTENT MANAGEMENT LOCAL Rem SEGMENT SPACE MANAGEMENT AUTO; Rem Rem - CAUTION: This script will erase the following schemas: Rem - HR Rem - OE Rem - PM Rem - SH Rem - IX Rem - BI Rem - CAUTION: Never use the preceding Sample Schemas for Rem anything other than demos and examples Rem - USAGE: To return the Sample Schemas to their initial Rem state, you can call this script and pass the passwords Rem for SYS, SYSTEM and the schemas as parameters. Rem Example: @?/demo/schema/mksample mgr secure h1 o2 p3 q4 s5 Rem (please choose your own passwords for security purposes) Rem Rem MODIFIED (MM/DD/YY) Rem Rem SET FEEDBACK 1 SET NUMWIDTH 10 SET LINESIZE 80 SET TRIMSPOOL ON SET TAB OFF SET PAGESIZE 999 SET ECHO OFF SET CONCAT '.' SET SHOWMODE OFF PROMPT PROMPT specify password for SYSTEM as parameter 1: DEFINE password_system = &1 PROMPT PROMPT specify password for SYS as parameter 2: DEFINE password_sys = &2 PROMPT PROMPT specify password for HR as parameter 3: DEFINE password_hr = &3 PROMPT PROMPT specify password for OE as parameter 4: DEFINE password_oe = &4 PROMPT PROMPT specify password for PM as parameter 5: DEFINE password_pm = &5 PROMPT PROMPT specify password for IX as parameter 6: DEFINE password_ix = &6 PROMPT PROMPT specify password for SH as parameter 7: DEFINE password_sh = &7 PROMPT PROMPT specify password for BI as parameter 8: DEFINE password_bi = &8 PROMPT PROMPT specify default tablespace as parameter 9: DEFINE default_ts = &9 PROMPT PROMPT specify temporary tablespace as parameter 10: DEFINE temp_ts = &10 PROMPT PROMPT specify log file directory (including trailing delimiter) as parameter 11: DEFINE logfile_dir = &11 PROMPT PROMPT Sample Schemas are being created ... PROMPT DEFINE vrs = v3 CONNECT system/&&password_system DROP USER hr CASCADE; DROP USER oe CASCADE; DROP USER pm CASCADE; DROP USER ix CASCADE; DROP USER sh CASCADE; DROP USER bi CASCADE; CONNECT system/&&password_system SET SHOWMODE OFF @?/demo/schema/human_resources/hr_main.sql &&password_hr &&default_ts &&temp_ts &&password_sys &&logfile_dir CONNECT system/&&password_system SET SHOWMODE OFF @?/demo/schema/order_entry/oe_main.sql &&password_oe &&default_ts &&temp_ts &&password_hr &&password_sys %s_oePath% &&logfile_dir &vrs CONNECT system/&&password_system SET SHOWMODE OFF @?/demo/schema/product_media/pm_main.sql &&password_pm &&default_ts &&temp_ts &&password_oe &&password_sys %s_pmPath% &&logfile_dir %s_pmPath% CONNECT system/&&password_system SET SHOWMODE OFF @?/demo/schema/info_exchange/ix_main.sql &&password_ix &&default_ts &&temp_ts &&password_sys &&logfile_dir &vrs CONNECT system/&&password_system SET SHOWMODE OFF @?/demo/schema/sales_history/sh_main &&password_sh &&default_ts &&temp_ts &&password_sys %s_shPath% &&logfile_dir &vrs CONNECT system/&&password_system SET SHOWMODE OFF @?/demo/schema/bus_intelligence/bi_main &&password_bi &&default_ts &&temp_ts &&password_sys &&password_oe &&password_sh &&logfile_dir &vrs CONNECT system/&&password_system SPOOL OFF DEFINE veri_spool = &&logfile_dir.mkverify_&vrs..log @?/demo/schema/mkverify &&password_system &veri_spool EXIT
This section lists the names of the scripts that create the human resources (HR
) schema and describes the objects in the schema. Table 5-1 lists the HR
scripts in alphabetical order, while Table 5-2 lists its objects.
Script Name | Description |
---|---|
|
Collects statistics on the tables in the schema |
|
Creates procedural objects in the schema |
|
Creates comments for each object in the schema |
|
Creates the |
|
Adds the distinguished name column used by Oracle Internet Directory to the |
|
Drops the Oracle Internet Directory distinguished name column from |
|
Drops the |
|
Creates indexes on the |
|
Main script for the |
|
Populates the objects |
Object Type | Objects |
---|---|
Index |
|
Procedure |
|
Sequence |
|
Table |
|
Trigger |
|
View |
|
This section describes the columns of each table of the HR schema, as follows:
Table 5-3 HR.COUNTRIES Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
Table 5-4 HR.DEPARTMENTS Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-5 HR.EMPLOYEES Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-6 HR.JOBS Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-7 HR.JOB_HISTORY Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This section lists the names of the scripts that create the Order Entry (OE) schema and describes the objects in the schema. Table 5-10 lists the OE
scripts in alphabetical order, while Table 5-11 lists its objects. Note that language-specific statements for product names and descriptions are stored in these files (each representing a different language): INSERT
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
.
Script Name | Description |
---|---|
|
Adds comments to the online catalog ( |
|
Creates the |
|
Drops the |
|
Main script for the |
|
Populates the object tables |
|
Gathers statistics on the |
|
Creates comments for the objects in the schema |
|
Creates the |
|
Drops the |
|
Creates indexes on the |
|
Main script for the |
|
Creates the |
Object Type | Objects |
---|---|
Index |
|
Function |
|
Sequence |
|
Lob |
|
Synonym |
|
Table |
|
Trigger |
|
Type |
|
Type Body |
|
View |
|
This section describes the columns of each table of the OE schema, as follows:
Table 5-12 OE.CUSTOMERS Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-13 OE.INVENTORIES Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
Table 5-14 OE.ORDERS Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-15 OE.ORDER_ITEMS Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-16 OE.PRODUCT_DESCRIPTIONS Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-17 OE.PRODUCT_INFORMATION Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This section lists the names of the scripts that create the Product Media (PM) schema and describes the objects in the schema. Table 5-19 lists the OE scripts in alphabetical order, while Table 5-20 lists its objects. Note that the SQL*Loader data file pm_p_lob.dat
contains hard-coded absolute path names that have been set during installation. Before attempting to load the data in a different environment, you should first edit the path names in this file.
Script Name | Description |
---|---|
|
Gathers statistics on the |
|
Creates the |
|
Drops the |
|
Populates the objects in the schema |
|
Main script for the |
Object Type | Objects |
---|---|
Index |
|
Lob |
|
Table |
|
Type |
|
This section describes the columns of each table of the PM schema, as follows:
Table 5-21 PM.ONLINE_MEDIA Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
This type, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This section lists the names of the scripts that create the Information Exchange (IX
) schema group and describes the objects in the schemas. Table 5-23 lists the IX
scripts in alphabetical order, while Table 5-24 lists its objects.
Table 5-23 Information Exchange (IX) Schema Scripts
Script Name | Description |
---|---|
|
Creates the |
|
Drops the |
|
Main script for the |
|
Enables, disables, and verifies |
Object Type | Objects |
---|---|
Evaluation Context |
|
Index |
|
Lob |
|
Queue |
|
Rule Set |
|
Sequence |
|
Table |
|
Type |
|
View |
|
This section describes the columns of each table of the IX schema, as follows:
Table 5-25 IX.ORDERS_QUEUETABLE Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-26 IX.STREAMS_QUEUE_TABLE Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This section lists the names of the scripts that create the Sales History (SH) schema and describes the objects in the schema. Table 5-27 lists the SH
scripts in alphabetical order, while Table 5-28 lists its objects.
Script Name | Description |
---|---|
|
Gathers statistics on the schema objects |
|
Creates comments for the objects in the schema |
|
Modifies constraints on objects in the schema |
|
Creates the objects in the schema |
|
Creates materialized views and bitmapped indexes |
|
Drops the |
|
Creates indexes on tables in the schema |
|
Main script for the |
|
Creates dimensions and hierarchies used by the OLAP server |
|
Drops the objects used by the OLAP server |
Object Type | Objects |
---|---|
Dimension |
|
Index |
|
Index Partition |
|
Lob |
|
Materialized View |
|
Table |
|
Table Partition |
|
View |
|
This section describes the columns of each table of the IX schema, as follows:
Table 5-29 SH.CHANNELS Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-30 SH.COSTS Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-31 SH.COUNTRIES Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-32 SH.CUSTOMERS Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-33 SH.PRODUCTS Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-34 SH.PROMOTIONS Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-35 SH.SALES Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5-36 SH.TIMES Table Description
Column Name | Null? | Type |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|