Unlocking sample HR scheme in versions older than Oracle 12c was very easy. Just execute from the SYS user:
alter user hr identified by hr account unlock;
And done! - HR scheme ready to go.
In 12c, when the containers came in, things got complicated:
alter user hr identified by hr account unlock;
Error report -ORA-01918: user 'HR' does not exist01918. 00000 - "user '%s' does not exist"
*Cause: User does not exist in the system.*Action: Verify the user name is correct.
But I know, that HR is out there somewhere...
When we log as SYS user, we log into the CDB database. And there is actually no HR schema. The HR schema has been hidden in the pluggable database. To be able to unblock the HR user, we need to connect to the PDB (pluggable) base.
How to do that?
1. Login as SYS user
sqlplus sys/sys as sysdba
2. Connect to container XEPDB1
As a SYS connect to XEPDB1
ALTER SESSION SET container=XEPDB1;
3. Unlock HR schema
And finally we can unlock our sample HR scheme!
alter user hr identified by hr account unlock;
User HR altered.
4. Connect to HR.
We need to create a connetion to the HR schema. Remember that the database is not on the standard Service Name, for me it is XE, only on the Service Name: XEPDB1.
And now we can enjoy our beautiful, new HR scheme :)
Excellent, thank you
OdpowiedzUsuń