Skip to content

Commit c503824

Browse files
committed
Oracle Database's Sample Schema creation scripts
0 parents  commit c503824

File tree

397 files changed

+2328043
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

397 files changed

+2328043
-0
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*Due to widespread dependence on these scripts in their current form,
2+
no pull requests for changes can be accepted.*

LICENSE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2015 Oracle
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Oracle Database Sample Schemas
2+
3+
Copyright (c) 2015 Oracle
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23+
24+
## 1. Introduction
25+
26+
This repository contains a copy of the Oracle Database sample schemas
27+
that are installed with Oracle Database Enterprise Edition 12c. These
28+
schemas are used in Oracle documentation to show SQL language
29+
concepts. The schemas themselves are documented in
30+
[Oracle Database Sample Schemas, 12c Release 1 (12.1)](http://docs.oracle.com/database/121/COMSC/toc.htm).
31+
32+
The schemas are:
33+
34+
- HR: Human Resources
35+
- OE: Order Entry
36+
- PM: Product Media
37+
- IX: Information Exchange
38+
- SH: Sales History
39+
- BI: Business Intelligence
40+
41+
*Due to widespread dependence on these scripts in their current form,
42+
no pull requests for changes can be accepted.*
43+
44+
## 2. Installing the Samples
45+
46+
*CAUTION*: Do not use install the samples if you already have user
47+
accounts named HR, OE, PM, IX, SH or BI.
48+
49+
The installation scripts are designed to run on a database host with
50+
Oracle Database 12.1, non CDB. Privileged database access is required
51+
during installation.
52+
53+
The instructions below work on Linux and similar operating systems.
54+
Adjust them for other platforms.
55+
56+
An alternative to using this repository is to download and install the
57+
[Oracle Database 12c Release 1 Examples](http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index-092322.html)
58+
package for your platform.
59+
60+
### 2.1. Clone this repository
61+
62+
Login as the Oracle Database software owner and clone the repository, for example
63+
64+
```shell
65+
cd $HOME
66+
git clone https://github.com/oracle/db-sample-schemas.git
67+
```
68+
69+
or download and extract the ZIP file:
70+
71+
```shell
72+
unzip db-sample-schemas.zip
73+
```
74+
75+
The schema directory should be owned by the Oracle Database software owner.
76+
77+
### 2.2. Change directory
78+
79+
```shell
80+
cd $HOME/db-sample-schemas
81+
```
82+
83+
### 2.3. Make a log directory
84+
85+
```shell
86+
mkdir log
87+
```
88+
89+
### 2.4. Change all embedded paths to match your working directory
90+
91+
The installation scripts need your current directory embedded in
92+
various locations. Use a text editor or the following Perl script to
93+
make the changes, replacing occurrences of the token `__SUB__CWD__`
94+
with your current working directory, for example
95+
`/home/oracle/db-sample-schemas`
96+
97+
```shell
98+
perl -p -i.bak -e 's#__SUB__CWD__#'$(pwd)'#g' *.sql */*.sql */*.dat
99+
```
100+
101+
### 2.5. Set the Oracle environment
102+
103+
```shell
104+
source /usr/local/bin/oraenv
105+
```
106+
107+
*Note*: Oracle's `sqlldr` utility needs to be in `$PATH` for correct
108+
loading of the Product Media (PM) and Sales History (SH) schemas.
109+
110+
### 2.6. Run the installation script
111+
112+
Review the [README.txt](#README.txt) for information on passwords and
113+
pre-requirements. In particular, verify your default and temporary
114+
tablespace names, and choose a password for each schema.
115+
116+
Start SQL*Plus and run the top level installation script as
117+
discussed in [README.txt](#README.txt):
118+
119+
```shell
120+
sqlplus system/systempw
121+
@mksample systempw syspw hrpw oepw pmpw ixpw shpw bipw users temp /your/path/to/log/
122+
```
123+
124+
*Note: Use an absolute path and also append a trailing slash to the log directory name.*
125+
126+
Use your current SYSTEM and SYS passwords, and also your actual
127+
default and temporary tablespace names. The passwords for the new
128+
HR, OE, PM, IX, SH and BI users will be set to the values you
129+
specify.
130+
131+
### 2.7. Review the installation logs
132+
133+
Review output in your log directory for errors.
134+
135+
## 3. Removing the Samples
136+
137+
*CAUTION*: This will drop user accounts named HR, OE, PM, IX, SH and BI.
138+
139+
### 3.1. Set the Oracle environment
140+
141+
```
142+
source /usr/local/bin/oraenv
143+
```
144+
145+
### 3.>2. Run the schema removal script
146+
147+
```
148+
sqlplus system/systempw
149+
@drop_sch.sql
150+
```
151+
152+
When prompted, enter the SYSTEM password and a log file name.

README.txt

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
README.txt
2+
3+
Created 25-NOV-2003
4+
5+
Updated 25-FEB-2013
6+
7+
Copyright (c) 2015 Oracle
8+
9+
Permission is hereby granted, free of charge, to any person obtaining
10+
a copy of this software and associated documentation files (the
11+
"Software"), to deal in the Software without restriction, including
12+
without limitation the rights to use, copy, modify, merge, publish,
13+
distribute, sublicense, and/or sell copies of the Software, and to
14+
permit persons to whom the Software is furnished to do so, subject to
15+
the following conditions:
16+
17+
The above copyright notice and this permission notice shall be
18+
included in all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27+
28+
------------------------------------------------------------------------
29+
30+
31+
This document describes the structure of the Schema directory, and
32+
33+
provides instructions for creating the Sample Schemas.
34+
35+
========================================================================
36+
37+
1. Structure of the Schemas directory
38+
39+
1.1 The Schema directory contains the following files:
40+
41+
1.1.1 mksample.sql
42+
This script erases and recreates all Sample Schemas.
43+
CAUTION: This script contains directory paths that may
44+
work only for one specific installation.
45+
46+
1.1.2 README.txt
47+
This file explains the process of creating Sample Schemas.
48+
49+
1.2 The following folders contain scripts to DROP and CREATE database
50+
objects, and for loading data. These scripts are called by
51+
the mksample.sql script.
52+
53+
1.2.1 human_resources
54+
55+
1.2.1.1 The hr_main.sql script creates or recreates the HR schema.
56+
57+
1.2.1.2 The hr_drop.sql script drops all objects of the schema, but
58+
does not remove the HR user.
59+
60+
1.2.2 order_entry
61+
62+
1.2.2.1 The oe_main.sql script creates or recreates the OE schema.
63+
64+
1.2.2.2 The oe_drop.sql script drops all relational objects, but
65+
does not remove the OE user.
66+
67+
1.2.3 product_media
68+
69+
1.2.3.1 The pm_main.sql script creates or recreates the PM schema.
70+
71+
1.2.3.2 The pm_drop.sql script drops all objects, but does not
72+
remove the PM user.
73+
74+
1.2.4 info_exchange
75+
76+
1.2.4.1 The ix_main.sql script creates or recreates the IX schema.
77+
78+
1.2.4.2 The dix_v3.sql script drops all objects, but does not remove
79+
the IX user.
80+
81+
1.2.5 sales_history
82+
83+
1.2.5.1 The sh_main.sql script creates or recreates the SH schema.
84+
85+
1.2.5.2 The sh_drop.sql script drops all objects, but does not remove
86+
the SH user
87+
88+
1.2.6 bus_intelligence
89+
90+
1.2.6.1 The bi_main.sql creates user BI and grants SELECT
91+
privileges on specific OE and SH objects.
92+
93+
========================================================================
94+
95+
96+
2. Instructions to create the schemas:
97+
98+
99+
2.1 Decide on passwords for the Sample Schemas. Here, we are using
100+
placeholder names inside "<" and ">" brackets:
101+
102+
SYSTEM: <SYSTEM_password>
103+
SYS: <SYS_password>
104+
HR: <HR_password>
105+
OE: <OE_password>
106+
PM: <PM_password>
107+
IX: <IX_password>
108+
SH: <SH_password>
109+
BI: <BI_password>
110+
111+
2.2 Verify the value for the default tablespace, the temporary
112+
tablespace, and the log file directory. For illustration purposes,
113+
the values are:
114+
115+
default tablespace: EXAMPLE
116+
temporary tablespace: TEMP
117+
log file directory: $ORACLE_HOME/demo/schema/log
118+
119+
NOTE: Use your own passwords.
120+
121+
122+
2.3 Invoke the Sample Schema creation script. Using the values listed
123+
in Sections 2.1 and 2.2, the command would look like this:
124+
125+
SQL> @?/demo/schema/mksample <SYSTEM_password> <SYS_password>
126+
<HR_password> <OE_password> <PM_password> <IX_password>
127+
<SH_password> <BI_password> EXAMPLE TEMP
128+
$ORACLE_HOME/demo/schema/log/
129+
130+
The mksample script lists all the objects created in the data dictionary.
131+
132+
========================================================================
133+
134+
3. Schema dependencies and requirements:
135+
136+
3.1 The OE schema requires that the database be enabled for spatial data
137+
and that the HR schema exists.
138+
139+
3.2 The PM schema requires that the database be enabled for Intermedia,
140+
which itself requires a Java-enabled database, and that the OE
141+
schema exists.
142+
143+
3.3 The SH schema uses Partitioning and requires that the OE schema
144+
exists.
145+
146+
3.4 The BI schema requires that the OE schema exists.
147+
148+
3.5 Refer to Oracle Database documentation for more detailed
149+
information about the Sample Schemas.
150+
151+
========================================================================
152+
153+
4. Known bugs
154+
155+
4.1 The Sample Schema scripts do not work with pluggable databases.
156+
157+
========================================================================
158+
159+

0 commit comments

Comments
 (0)