Reputation: 52606
I use Oracle 11g express. I try to install sample database HR. From cmd
sqlplus
system
123456
Comment created.
Commit complete.
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 3701
ORA-06512: at "SYS.DBMS_STATS", line 24470
ORA-06512: at "SYS.DBMS_STATS", line 24435
ORA-06512: at line 1
How I install sample database HR correctly?
Upvotes: 3
Views: 12890
Reputation: 91
Apparently the statement to create the user hr was not executed correctly, and despite that the execution of the hr_main.sql script is not stopped.
This worked for me:
Once as sysdba:
SQL> alter session set "_ORACLE_SCRIPT"=true; Session altered. SQL> create user hr identified by hr; User created. SQL> drop user hr cascade; User droped. SQL> @?/demo/schema/human_resources/hr_main.sql ... User created. ...
Upvotes: 9
Reputation: 53
Navigate to the PDB container as SYS user before executing the script
[oracle@af18354c958e /]$ sqlplus sys as sysdba
Enter password: password
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> alter session set container = ORCLPDB1
SQL> @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/
Upvotes: 4
Reputation: 8103
The problem is the line
create user hr identified by 123456a@
Because user is not created, you are getting other errors.
To resolve it do either of below
Remove special character from password. Or use underscores _
in password.
create user hr identified by 123456a
OR
Try enclosing password in double quotes. (I am not able to test it now. But if it doesn't work, try first option. I referred this link)
create user hr identified by "123456a@"
Upvotes: 3