|
1 | 1 | # Oracle Database Sample Schemas
|
2 | 2 |
|
3 |
| -Copyright (c) 2019 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 | 3 | ## 1. Introduction
|
25 | 4 |
|
26 |
| -This repository contains a copy of the Oracle Database sample schemas |
27 |
| -that are installed with Oracle Database Enterprise Edition. These |
28 |
| -schemas are used in Oracle documentation to show SQL language |
29 |
| -concepts and other database features. The schemas themselves are |
30 |
| -documented in [Oracle Database Sample Schemas](https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=COMSC). |
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* |
| 5 | +The [Oracle Database Documentation](https://docs.oracle.com/en/database/oracle/oracle-database/index.html) and other resources use these sample schemas to demonstrate the capabilities of [Oracle Database](https://www.oracle.com/database/) and the SQL and PL/SQL languages. You can download and install these schemas in your database environments to learn about Oracle Database functionality or try the examples in the documentation. **These schemas are provided for free.** |
40 | 6 |
|
41 |
| -*Due to widespread dependence on these scripts in their current form, |
42 |
| -no pull requests for changes can be accepted.* |
| 7 | +The following schemas are included: |
43 | 8 |
|
44 |
| -In addition, a new schema CO: [Customer Orders](https://github.com/oracle/db-sample-schemas/tree/master/customer_orders), is now also |
45 |
| -included in this repository. It is not automatically installed along with |
46 |
| -the rest of the schemas at this time. Follow instructions in that schema's |
47 |
| -[README](https://github.com/oracle/db-sample-schemas/blob/master/README.md) to install the CO schema. |
48 |
| - |
49 |
| -## 2. Installation |
50 |
| - |
51 |
| -*CAUTION*: The first step in installing sample schemas is to drop |
52 |
| -user accounts with the following names: HR, OE, PM, IX, SH and BI. |
53 |
| -Do not proceed with the installation if you have schemas with any |
54 |
| -of these names that you wish to keep. |
55 |
| - |
56 |
| -The installation scripts are designed to run on an Oracle Database. |
57 |
| -Privileged database access is required during installation. |
58 |
| - |
59 |
| -The instructions below work on Linux and similar operating systems. |
60 |
| -Adjust them for other platforms. |
61 |
| - |
62 |
| -### 2.1. Clone this repository |
63 |
| - |
64 |
| -Login as the Oracle Database software owner and clone the repository, for example |
65 |
| - |
66 |
| -```shell |
67 |
| -cd $HOME |
68 |
| -git clone https://github.com/oracle/db-sample-schemas.git |
69 |
| -``` |
70 |
| - |
71 |
| -or download and extract the ZIP file: |
72 |
| - |
73 |
| -```shell |
74 |
| -unzip db-sample-schemas.zip |
75 |
| -``` |
76 |
| - |
77 |
| -The schema directory should be owned by the Oracle Database software owner. |
78 |
| - |
79 |
| -### 2.2. Change directory |
80 |
| - |
81 |
| -```shell |
82 |
| -cd $HOME/db-sample-schemas |
83 |
| -``` |
84 |
| - |
85 |
| -### 2.3. Change all embedded paths to match your working directory |
86 |
| - |
87 |
| -The installation scripts need your current directory embedded in |
88 |
| -various locations. Use a text editor or the following Perl script to |
89 |
| -make the changes, replacing occurrences of the token `__SUB__CWD__` |
90 |
| -with your current working directory, for example |
91 |
| -`/home/oracle/db-sample-schemas` |
92 |
| - |
93 |
| -```shell |
94 |
| -perl -p -i.bak -e 's#__SUB__CWD__#'$(pwd)'#g' *.sql */*.sql */*.dat |
95 |
| -``` |
| 9 | +- `HR`: Human Resources |
| 10 | +- `CO`: Customer Orders |
| 11 | +- `SH`: Sales History |
| 12 | +- `OE`: Order Entry (**archived**) |
| 13 | +- `PM`: Product Media (**archived**) |
96 | 14 |
|
97 |
| -### 2.4. Set the Oracle environment |
| 15 | +### Archived schemas |
98 | 16 |
|
99 |
| -Skip this step when running on a client machine (one without an Oracle |
100 |
| -Database installed). |
| 17 | +Archived schemas are provided for reference for examples in the documentation but are no longer actively maintained. |
101 | 18 |
|
102 |
| -```shell |
103 |
| -source /usr/local/bin/oraenv |
104 |
| -``` |
| 19 | +## 2. Installing the Sample Schemas |
105 | 20 |
|
106 |
| -*Note*: Oracle's `sqlldr` utility needs to be in `$PATH` for correct |
107 |
| -loading of the Product Media (PM) and Sales History (SH) schemas. |
| 21 | +1. Go to the [latest (or appropriate) release of the sample schemas](https://github.com/oracle-samples/db-sample-schemas/releases) and download the `Source code (zip)` file. |
| 22 | +2. Extract the downloaded .zip file. |
| 23 | +3. Inside the sample schemas main directory, navigate to the sample schema directory that you want to install and run the `<schema_name>_install.sql` script. (**For more information about installing a schema, see the `README.md` file in the schema directory.**) |
| 24 | +4. Review the installation verification at the end of the installation or in the generated installation log file. |
108 | 25 |
|
109 |
| -### 2.5. Run the installation script |
| 26 | +#### Example |
110 | 27 |
|
111 |
| -Review the [README.txt](#README.txt) for information on passwords and |
112 |
| -pre-requirements. In particular, verify your default and temporary |
113 |
| -tablespace names, and choose a password for each schema. |
| 28 | +To install the `HR` schema, complete the following steps: |
114 | 29 |
|
115 |
| -Start SQL*Plus and run the top level installation script as |
116 |
| -discussed in [README.txt](#README.txt): |
| 30 | +1. `cd` into the `human_resources` folder. |
| 31 | +2. Connect to the target database with a privileged user. |
| 32 | +3. Run the `hr_install.sql` script and provide inputs for the prompts. |
117 | 33 |
|
118 | 34 | ```shell
|
119 |
| -sqlplus system/systempw@connect_string |
120 |
| -@mksample systempw syspw hrpw oepw pmpw ixpw shpw bipw users temp /your/path/to/log/ connect_string |
| 35 | +cd human_resources |
| 36 | +sql <system>@<connect_string> |
| 37 | +@hr_install.sql |
121 | 38 | ```
|
122 | 39 |
|
123 |
| -*Note*: Use an absolute path and also append a trailing slash to the log directory name. |
124 |
| - |
125 |
| -Use your current SYSTEM and SYS passwords, and also your actual |
126 |
| -default and temporary tablespace names. The passwords for the new |
127 |
| -HR, OE, PM, IX, SH and BI users will be set to the values you |
128 |
| -specify. |
129 |
| - |
130 |
| -*Reminder*: currently the CO schema will not be installed as part of this |
131 |
| -process. |
132 |
| - |
133 |
| -Using a connect string permits connections to non-container databases and |
134 |
| -pluggable database using the same syntax. |
135 |
| - |
136 |
| -An example of connect strings for databases with services noncdb and pdb: |
137 |
| -``` |
138 |
| - localhost:1521/noncdb |
139 |
| - localhost:1521/pdb |
140 |
| -``` |
141 |
| - |
142 |
| -### 2.6. Review the installation logs |
143 |
| - |
144 |
| -Review output in your log directory for errors. |
| 40 | +## 3. Uninstalling the Sample Schemas |
145 | 41 |
|
146 |
| -## 3. Removing the Samples |
| 42 | +1. Navigate to the sample schema folder that you want to uninstall and run the `<schema_name>_uninstall.sql` script. (**For more information about uninstalling a schema, see the `README.md` file in the schema directory.**) |
| 43 | +2. Check the output for any errors during the uninstallation process. |
147 | 44 |
|
148 |
| -*CAUTION*: This will drop user accounts named HR, OE, PM, IX, SH and BI. |
149 |
| - |
150 |
| -### 3.1. Set the Oracle environment |
151 |
| - |
152 |
| -Skip this step when running on a client machine (one without an Oracle |
153 |
| -Database installed). |
154 |
| - |
155 |
| -```shell |
156 |
| -source /usr/local/bin/oraenv |
157 |
| -``` |
158 |
| - |
159 |
| -### 3.2. Run the schema removal script |
| 45 | +## Contributing |
160 | 46 |
|
161 |
| -```shell |
162 |
| -sqlplus system/systempw@connect_string |
163 |
| -@drop_sch.sql |
164 |
| -``` |
| 47 | +Due to widespread dependence on these sample schemas, pull requests are carefully reviewed and not easily accepted. For bugs and enhancement requests, please file a GitHub issue. When filing an issue, please remember that the more detailed the report is, the faster it can be addressed. If you think that you have found a security vulnerability, do not raise a GitHub issue and follow the instructions in our [security guide](./SECURITY.md). |
165 | 48 |
|
166 |
| -When prompted, enter the SYSTEM password, a log file name, and connect string. |
| 49 | +## Security |
167 | 50 |
|
168 |
| -### 3.3 Run the CO schema removal script |
| 51 | +Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process. |
169 | 52 |
|
170 |
| -If you have installed the CO schema, run the following script to remove it. |
| 53 | +## License |
171 | 54 |
|
172 |
| -```shell |
173 |
| -sqlplus system/systempw@connect_string |
174 |
| -@co_drop_user.sql |
175 | 55 | ```
|
176 |
| -## Contributing |
177 |
| - |
178 |
| -This project is not accepting external contributions at this time. For bugs or enhancement requests, please file a GitHub issue unless it’s security related. When filing a bug remember that the better written the bug is, the more likely it is to be fixed. If you think you’ve found a security vulnerability, do not raise a GitHub issue and follow the instructions in our [security policy](./SECURITY.md). |
| 56 | +Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved. |
179 | 57 |
|
180 |
| -## Security |
181 |
| - |
182 |
| -Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process |
| 58 | +Permission is hereby granted, free of charge, to any person obtaining |
| 59 | +a copy of this software and associated documentation files (the |
| 60 | +"Software"), to deal in the Software without restriction, including |
| 61 | +without limitation the rights to use, copy, modify, merge, publish, |
| 62 | +distribute, sublicense, and/or sell copies of the Software, and to |
| 63 | +permit persons to whom the Software is furnished to do so, subject to |
| 64 | +the following conditions: |
183 | 65 |
|
184 |
| -## License |
| 66 | +The above copyright notice and this permission notice shall be |
| 67 | +included in all copies or substantial portions of the Software. |
185 | 68 |
|
186 |
| -Copyright (c) 2019, 2023 Oracle and/or its affiliates. |
| 69 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 70 | +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 71 | +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 72 | +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 73 | +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 74 | +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 75 | +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 76 | +``` |
0 commit comments