Manually installing the HR Schema in 19c
August 20, 2020 2 Comments
When creating a database using the dbca
there is an option to install Sample Schemas automatically, but if you’ve missed that step then here are the steps to manually install HR schema (only) in your database:
1. Log on to sqlplus as SYS AS SYSDBA:
$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Thu Aug 20 11:44:54 2020 Version 19.7.0.0.0 SQL>
2. Run hr_main.sql
script using the following command:
SQL> @?/demo/schema/human_resources/hr_main.sql specify password for HR as parameter 1: Enter value for 1: hr specify default tablespeace for HR as parameter 2: Enter value for 2: users specify temporary tablespace for HR as parameter 3: Enter value for 3: temp specify log path as parameter 4: Enter value for 4: $ORACLE_HOME/demo/schema/log/ PL/SQL procedure successfully completed. ... ****** Creating REGIONS table .... ... ****** Creating COUNTRIES table .... ... ****** Creating LOCATIONS table .... ... ****** Creating DEPARTMENTS table .... ... ****** Creating JOBS table .... ... ****** Creating EMPLOYEES table .... ... ****** Creating JOB_HISTORY table .... ... ****** Creating EMP_DETAILS_VIEW view ... ... ****** Populating REGIONS table .... ... ****** Populating COUNTIRES table .... ... PL/SQL procedure successfully completed.
3. Verify that the schema was created:
SQL> SELECT table_name FROM dba_tables where owner='HR'; TABLE_NAME ------------------------------------------------------------ REGIONS COUNTRIES LOCATIONS DEPARTMENTS JOBS EMPLOYEES JOB_HISTORY 7 rows selected.