Unlock HR user in Oracle 19c/18c/12c

oracle

While trying to unlock the HR user, I am getting an error saying, “user HR does not exist”.

Best Answer

Unlocking sample accounts like HR in Oracle 19c/18c/12c

Edit tnsnames.ora file located at %db_home%\network\admin

Add TNS ORCLPDB like below-highlighted block enter image description here

Open CMD as Administrator and execute below command

C:\>lsnrctl reload

Open CMD and execute SQLPlus with below command to login as SYSDBA

C:\WINDOWS\system32> sqplus / as sysdba

Run below SQL commands to Unlock your Schema

  ALTER SESSION SET container = ORCLPDB;

Check if the pluggable database is opened ?

SELECT name, open_mode FROM v$pdbs;

To open your pluggable database Skip If Already open

ALTER PLUGGABLE DATABASE open;

Unlock HR user

ALTER USER hr IDENTIFIED BY <your_password> ACCOUNT UNLOCK;
conn
username hr@orclpdb
password <your_password>
Connected.

Connected means you can access HR schema lets start

Now you will be able to access HR schema

select * from tab;