Skip to content

Instantly share code, notes, and snippets.

@moiz-frost
Created October 5, 2017 18:51
Show Gist options
  • Save moiz-frost/afccda97d728147ed2e23e8fbcadad55 to your computer and use it in GitHub Desktop.
Save moiz-frost/afccda97d728147ed2e23e8fbcadad55 to your computer and use it in GitHub Desktop.
Try this as well
unlock HR, Scott etc. users in Oracle Database 12c.
Step 1:
C:\> sqlplus / as sysdba
SQL> SHOW con_name
SQL> SELECT name, con_id FROM v$pdbs;
SQL> SELECT name FROM v$active_services WHERE con_id = 3;
Step 2: Update tnsname.ora file
PDBORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdborcl)
)
)
Step3: Switch the container from CBD$ROOT to PDBORCL
C:\> sqlplus / as sysdba
SQL> ALTER SESSION SET CONTAINER = pdborcl;
SQL> SHOW con_name;
Step 4: Open the pluggable database PDBORCL
SQL> SELECT name, open_mode FROM v$pdbs;
SQL> ALTER PLUGGABLE DATABASE open;
Step 5: Unlock the HR user
SQL> ALTER USER hr IDENTIFIED BY hr ACCOUNT unlock;
Step 6: Log in to your database using HR user
SQL> conn hr/hr @pdborcl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment