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.logis the Sample Schema creation log file.hr_main.logis theHRschema creation log file.oe_oc_main.logis theOEschema creation log file.pm_main.logis thePMschema creation log file.pm_p_lob.logis the SQL*Loader log file forPM.PRINT_MEDIA.ix_main.logis theIXschema creation log file.sh_main.logis theSHschema creation log file.cust.logis the SQL*Loader log file forSH.CUSTOMERS.prod.logis the SQL*Loader log file forSH.PRODUCTS.promo.logis the SQL*Loader log file forSH.PROMOTIONS.sales.logis the SQL*Loader log file forSH.SALES.sales_ext.logis 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.





