I am trying to install HR schema. I am getting error "ORA-20000: Schema "HR" does not exist or insufficient privileges". I have downloaded the other scripts form Git hub. HR schema files comes in installation. Not sure do i have to create the HR user first ?
Steps I followed are as below:
I have created CDB =orcl and PDB database = pdborcl.
SQL> select cdb from v$database;
CDB
---
YES
1 row selected.
SQL> select con_id,name,open_mode from v$database
2 union
3 select con_id,name,open_mode from v$containers;
CON_ID
----------
NAME
--------------------------------------------------------------------------------
OPEN_MODE
--------------------
0
ORCL
READ WRITE
1
CDB$ROOT
READ WRITE
2
PDB$SEED
READ ONLY
3
PDBORCL
READ WRITE
4 rows selected.
HR Schema Installation: When I follow the Oracle link as below to install HR schema I am unable to find “sample.schema”
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/comsc/installing-sample-schemas.html#GUID-4D4984DD-A5F7-4080-A6F8-6306DA88E9FC
Next step So I tried the manual method:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
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: C:\app\hiten\virtual\product\12.2.0\dbhome_1\log
PL/SQL procedure successfully completed.
CREATE USER hr IDENTIFIED BY hr
*
ERROR at line 1:
ORA-65096: invalid common user or role name
ALTER USER hr DEFAULT TABLESPACE users
*
ERROR at line 1:
ORA-01918: user 'HR' does not exist
ALTER USER hr TEMPORARY TABLESPACE temp
*
ERROR at line 1:
ORA-01918: user 'HR' does not exist
GRANT CREATE SESSION, CREATE VIEW, ALTER SESSION, CREATE SEQUENCE TO hr
*
ERROR at line 1:
ORA-01917: user or role 'HR' does not exist
GRANT CREATE SYNONYM, CREATE DATABASE LINK, RESOURCE , UNLIMITED TABLESPACE TO hr
*
ERROR at line 1:
ORA-01917: user or role 'HR' does not exist
ERROR:
ORA-01435: user does not exist
Session altered.
Session altered.
****** Creating REGIONS table ....
CREATE TABLE regions
*
ERROR at line 1:
ORA-00955: name is already used by an existing object
CREATE UNIQUE INDEX reg_id_pk
*
ERROR at line 1:
ORA-00955: name is already used by an existing object
PRIMARY KEY (region_id)
*
ERROR at line 3:
ORA-02260: table can have only one primary key
BEGIN dbms_stats.gather_schema_stats( 'HR' , granularity => 'ALL' , cascade => TRUE , block_sample => TRUE ); END;
ERROR at line 1:
ORA-20000: Schema "HR" does not exist or insufficient privileges
ORA-06512: at "SYS.DBMS_STATS", line 38298
ORA-06512: at "SYS.DBMS_STATS", line 38257
ORA-06512: at "SYS.DBMS_STATS", line 8593
ORA-06512: at "SYS.DBMS_STATS", line 38140
ORA-06512: at "SYS.DBMS_STATS", line 38285
ORA-06512: at line 1