Installing HR sample schema script in Oracle Linux platform

Script to setup HR sample schema on Oracle Linux platform

On Linux machine, go to the following directory where oracle home has Human Resources script while installing

[oracle@Linux1 /]$ cd $ORACLE_HOME/demo/schema/human_resources
[oracle@Linux1 human_resources]$ 

Connect with the database with sqlplus command

sqlplus / as sysdba

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 PDB1 			  MOUNTED

SQL> alter pluggable database pdb1 open;
Pluggable database altered.

SQL> alter session set container=pdb1;
Session altered.

Connected with the PDB database in which we have to run the hr_main.sql script to create HR Sample Schema

SQL> @hr_main.sql

specify password for HR as parameter 1:
Enter value for 1: password

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: /u01/app/oracle/hr.log

PL/SQL procedure successfully completed.
User created.
User altered.
User altered.
Grant succeeded.
----
----
----
Comment created.
Comment created.
Commit complete.
PL/SQL procedure successfully completed.

Verify the HR user connectivity with the PDB1 database:

[oracle@Linux1 human_resources]$ sqlplus hr@pdb1

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Oct 23 12:56:47 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle.  All rights reserved.
Enter password: 
Last Successful login time: Mon Oct 23 2023 12:56:42 +05:30

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0


SQL> desc employees;
 Name					   Null?    Type
 ----------------------------------------- -------- ---------------------------
 EMPLOYEE_ID				   NOT NULL NUMBER(6)
 FIRST_NAME					    VARCHAR2(20)
 LAST_NAME				   NOT NULL VARCHAR2(25)
 EMAIL					   NOT NULL VARCHAR2(25)
 PHONE_NUMBER					    VARCHAR2(20)
 HIRE_DATE				   NOT NULL DATE
 JOB_ID 				   NOT NULL VARCHAR2(10)
 SALARY 					    NUMBER(8,2)
 COMMISSION_PCT 				    NUMBER(2,2)
 MANAGER_ID					    NUMBER(6)
 DEPARTMENT_ID					    NUMBER(4

Leave a Reply