Situation
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 “linuxamd64_12102_examples.zip” 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 theHR
schema creation log file.oe_oc_main.log
is theOE
schema creation log file.pm_main.log
is thePM
schema creation log file.pm_p_lob.log
is the SQL*Loader log file forPM.PRINT_MEDIA
.ix_main.log
is theIX
schema creation log file.sh_main.log
is theSH
schema creation log file.cust.log
is the SQL*Loader log file forSH.CUSTOMERS
.prod.log
is the SQL*Loader log file forSH.PRODUCTS
.promo.log
is the SQL*Loader log file forSH.PROMOTIONS
.sales.log
is the SQL*Loader log file forSH.SALES
.sales_ext.log
is the external table log file forSH.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.