Oracle Sample Schemas in 12.2


Sometimes you need, or maybe you only want them, some of the typical schemas from Oracle like HR, SCOTT, etc… in your database, well, we are going to install all of them on Oracle 12.2.

We can see the documentation:

Installing Sample Schemas from GitHub

Starting with Oracle Database 12c Release 2, only the HR sample schema SQL scripts are available in the $ORACLE_HOME/demo/schema/human_resources directory. If you want to use sample schemas other than HR, such as OE, OC, PM, and SH schemas, you must download them from the GitHub repository.
The procedure to install sample schemas from GitHub is as follows:
    To find the latest version of the sample schemas installation scripts, go to the following GitHub web site :
    For example, If you want a version of the scripts, then go to
    Clone the GitHub repository, or download the ZIP bundle from GitHub and extract the files.
    Unzip the file.
    Follow the instructions to create the schemas in the README contained in the zip file.


We unzipped on a path with access from our virtual machine:

[oracle@dg1 ~]$ cd /media/sf_12.2/db-sample-schemas-

[oracle@dg1 db-sample-schemas-]$ ls
bus_intelligence human_resources mk_dir.sql mkunplug.sql product_media sales_history info_exchange mkplug.sql mkverify.sql shipping
drop_sch.sql mksample.sql order_entry README.txt


Very important to read the for modifying __SUB_CWD__ inside of the scripts:

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


We install it on a pdb:

SQL> col name format a25
SQL> select name, open_mode FROM v$pdbs;
------------------------- ----------


Test the connection:

SQL> connect system/oracle@localhost:1521/madridpdb


Example in the creation:

SQL> @?/mksample <SYSTEM_password> <SYS_password> <HR_password> <OE_password> <PM_password> <IX_password> <SH_password> <BI_password> TABLESPACE_DEFAULT_USERS TABLESPACE_DEFAULT_TEMP LOG_PATH localhost:1521/pdb


We run the script:

SQL> @mksample oracle oracle hr oe pm ix sh bi USERS TEMP /media/sf_12.2/db-sample-schemas- localhost:1521/madridpdb


Adding value with Arumel!!

%d bloggers like this: