How to Install Example Schemas in 12c Database


When trying to access sample schema tables, just realized the sample schemas are not installed.

SQL> desc hr.employees; ERROR: ORA-04043: object hr.employees does not exist

There are a couple of ways to install sample schemas in 12c database like using DBCA, here we choose to install sample schemas manually.

  • Download “” from Oracle website

Run  runInstaller to install example schemas into target ORACLE_HOME


Run SQL to create sample schemas

SQL> @?/demo/schema/mksample manager change_on_install hr oe pm ix sh bi EXAMPLE TEMP /u01/app/oracle/product/12.1.0/dbhome_1/demo/schema/log/

SQL>@?/demo/schema/mksample systempwd syspwd hrpwd oepwd pmpwd ixpwd shpwd bipwd default_tablespace temp_tablespace log_file_directory The mksample script expects 11 parameters. Provide the password for SYSTEM and SYS, and for schemas HR, OE, PM, IX, and SH. Specify a temporary and a default tablespace, and make sure to end the name of the log file directory with a trailing slash. The mksample script produces several log files:

  • mkverify.log is the Sample Schema creation log file.
  • hr_main.log is the HR schema creation log file.
  • oe_oc_main.log is the OE schema creation log file.
  • pm_main.log is the PM schema creation log file.
  • pm_p_lob.log is the SQL*Loader log file for PM.PRINT_MEDIA.
  • ix_main.log is the IX schema creation log file.
  • sh_main.log is the SH schema creation log file.
  • cust.log is the SQL*Loader log file for SH.CUSTOMERS.
  • prod.log is the SQL*Loader log file for SH.PRODUCTS.
  • promo.log is the SQL*Loader log file for SH.PROMOTIONS.
  • sales.log is the SQL*Loader log file for SH.SALES.
  • sales_ext.log is the external table log file for SH.COSTS.

Uninstall Sample Schemas

If you need to remove the sample schemas from the installation, run script drop_sch.sql .

@?/demo/schema/drop_sch.sql systempwd spool_file_name

Script drop_sch.sql uses two parameters: systempwd is the password for SYSTEM user, and spool_file_name is the name of the spool file that captures the log of the operation.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.