In the Oracle database experiment will use some examples of schema such as: HR, OE, SH, etc., in the oracle11g version of DBCA when the direct tick sample schemas can install the sample schema, such as:
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/9E/B0/wKioL1mUaMaBJvtbAAEnBYK5ZxI858.png "title=" 1.PNG "alt=" Wkiol1muamabjvtbaaenbyk5zxi858.png "/> But to the Oracle12.2 version, there is also an example Schemas tab as shown:
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/9E/B0/wKioL1mUaQ6Ttns9AAC5h-qydjM478.png "title=" 2.PNG "alt=" Wkiol1muaq6ttns9aac5h-qydjm478.png "/> But after the database installation is complete There is no such example schema, what is going on? Let's check the official documentation:
starting with Oracle Database 12c Release 2, the latest version of the sample schema scripts is available on GitHub AT&N Bsp;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 CR Eating a database using the dbca
option. All of the other sample schemas must is installed manually via the scripts available on GitHub.
From the official documentation above we can see that from the Oracle12.2 version, the script for example schemas is placed on GitHub and only the HR sample schema is installed at DBCA installation. Download the sample schema installation script from the specified address given in the document:
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/9E/B0/wKioL1mUalCh5__3AABZYHHGMr4457.png "title=" 3.PNG "alt=" Wkiol1mualch5__3aabzyhhgmr4457.png "/>
Locate the installation method from the README.txt document and start the installation:
[email protected]> @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:o ra-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 to see the output error, no installation success. The error is "__sub__cwd__" did not find, open the Mksample.sql file, do have this variable, but do not know where to declare.
Re-viewing the README.MD document sees the need to replace the "__sub__cwd__" variable with the current path and gives the command:
[[email protected] db-sample-schemas-12.2.0.1]$ perl-p-i.bak-e ' s#__sub__cwd__# ' $ (PWD) ' #g ' *.sql */*.sql */*.dat
After executing the above script, reinstall the sample schema:
[Email protected]> @mksample 123456 123456 hr oe PM IX sh bi users temp/home/oracle/dbca/192.168.56.22:1521/ora12c
Final installation success:
[email protected]>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: Http://docs.oracle.com/database/122/COMSC/installing-sample-schemas.htm#COMSC-GUID-B0BEE222-D8B0-4B68-B359-DEA153956EF6
This article is from the "DBA fighting!" blog, so be sure to keep this source http://hbxztc.blog.51cto.com/1587495/1956932
Oracle 12.2 Installation Sample Schema