Manually creating and Installing the HR Schema in 19c
Below steps to manually install HR schema in the database: However it can be done during DB creation through DBCA.
1. Log on to sqlplus as SYS AS SYSDBA:
[oracle@shsdnbty01 admin]$ sqlplus "/as sysdba"
SQL*Plus: Release 19.0.0.0.0 - Production on Fri May 5 22:54:00 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 DB1 READ WRITE NO
SQL> alter session set container="DB1";
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.
User created.
User altered.
User altered.
Grant succeeded.
Grant succeeded.
Session altered.
Session ltered.
Session altered.
****** Creating REGIONS table ....
Table created.
Index created.
Table altered.
****** Creating COUNTRIES table ....
Table created.
Table altered.
****** Creating LOCATIONS table ....
Table created.
Index created.
Table altered.
Sequence created.
****** Creating DEPARTMENTS table ....
Table created.
Index created.
Table altered.
Sequence created.
****** Creating JOBS table ....
Table created.
Index created.
Table altered.
****** Creating EMPLOYEES table ....
Table created.
Index created.
Table altered.
Table altered.
Sequence created.
****** Creating JOB_HISTORY table ....
Table created.
Index created.
Table altered.
****** Creating EMP_DETAILS_VIEW view ...
View created.
Commit complete.
Session altered.
****** Populating REGIONS table ....
1 row created.
1 row created.
1 row created.
1 row created.
****** 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
--------------------------------------------------------------------------------
DEPARTMENTS
JOBS
EMPLOYEES
JOB_HISTORY
REGIONS
LOCATIONS
COUNTRIES
7 rows selected.
SQL>
Comments
Post a Comment