Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle 12.2 install sample schema

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Some sample SCHEMA such as HR, OE, SH, etc. will be used when doing Oracle database experiments. In Oracle 11g version, select Sample Schemas directly in DBCA to install these sample SCHEMA, as shown in the following figure:

But in Oracle 12.2, there is also an example Schemas tab as shown below:

But after the database installation is completed, there are still no SCHEMA samples. What is going on? Let's check the official documents:

Starting with Oracle Database 12c Release 2, the latest version of the sample schema scripts are available on GitHub at https://github.com/oracle/db-sample-schemas/releases/latest.

During a complete installation of Oracle Database, the HR schema can be installed either manually or automatically when creating a database using the dbca option. All the other sample schemas must be installed manually via the scripts available on GitHub.

From the official documentation above we can see that since Oracle version 12.2, the scripts for the sample Schemas have been placed on GitHub, and only the hr sample Schema is installed during DBCA installation. Download the sample Schema installation script from the specified address given in the documentation:

Find the installation method in the README.txt document and start the installation:

sys@ORA12C>@mksamplespecify password for SYSTEM as parameter 1:Enter value for 1: 123456specify password for SYS as parameter 2:Enter value for 2: 123456specify password for HR as parameter 3:Enter value for 3: hrspecify password for OE as parameter 4:Enter value for 4: oespecify password for PM as parameter 5:Enter value for 5: pmspecify password for IX as parameter 6:Enter value for 6: ixspecify password for SH as parameter 7:Enter value for 7: shspecify password for BI as parameter 8:Enter value for 8: bispecify default tablespace as parameter 9:Enter value for 9: usersspecify temporary tablespace as parameter 10:Enter value for 10: tempspecify log file directory (including trailing delimiter) as parameter 11:Enter value for 11: /home/oracle/dbcaspecify connect string as parameter 12:Enter value for 12: localhost:1521/ora12cSample Schemas are being created ... mkdir: cannot create directory '/home/oracle/dbca': File existsConnected.DROP USER hr CASCADE *ERROR at line 1:ORA-01918: user 'HR' does not existDROP USER oe CASCADE *ERROR at line 1:ORA-01918: user 'OE' does not existDROP USER pm CASCADE *ERROR at line 1:ORA-01918: user 'PM' does not existDROP USER ix CASCADE *ERROR at line 1:ORA-01918: user 'IX' does not existDROP USER sh CASCADE *ERROR at line 1:ORA-01918: user 'SH' does not existDROP USER bi CASCADE *ERROR at line 1:ORA-01918: user 'BI' does not existConnected.SP2-0310: unable to open file "__SUB__CWD__/human_resources/hr_main.sql"Connected.SP2-0310: unable to open file "__SUB__CWD__/order_entry/oe_main.sql"Connected.SP2-0310: unable to open file "__SUB__CWD__/product_media/pm_main.sql"Connected.SP2-0310: unable to open file "__SUB__CWD__/info_exchange/ix_main.sql"Connected.SP2-0310: unable to open file "__SUB__CWD__/sales_history/sh_main.sql"Connected.SP2-0310: unable to open file "__SUB__CWD__/bus_intelligence/bi_main.sql"Connected.not spooling currentlySP2-0310: unable to open file "__SUB__CWD__/mkverify.sql"

From the above see output error, not installed successfully. Error is "__SUB__CWD__" not found, open mksample.sql file, there is indeed this variable, but do not know where the declaration.

Revisiting the README.md documentation shows that the variable "__SUB__CWD__" needs to be replaced with the current path and gives the command:

[oracle@rhel7 db-sample-schemas-12.2.0.1]$ perl -p -i.bak -e 's#__SUB__CWD__#'$(pwd)'#g' *.sql */*.sql */*.dat

Reinstall the sample Schema after executing the script above:

sys@ORA12C>@mksample 123456 123456 hr oe pm ix sh bi users temp /home/oracle/dbca/ 192.168.56.22:1521/ora12c

Final installation success:

system@ORA12C>select username,created from dba_users where created>sysdate-1;USERNAME CREATED------------------------------ -----------------OE 20170816 23:32:22SH 20170816 23:34:25PM 20170816 23:33:13IX 20170816 23:34:12BI 20170816 23:36:20HR 20170816 23:32:07

Reference: docs.oracle.com/database/122/COMSC/installing-sample-schemas.htm#COMSC-GUID-B0BEE222-D8B0-4B68-B359-DEA153956EF6

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report