Search notes:

ORA-65146: account cannot be unlocked in a PDB while it is locked in the root

$ sqlplus  sys/elCarosSecret4@pdbtq84 as sysdba
 …
SQL> alter user xdb account unlock;
--
-- ORA-65146: account cannot be unlocked in a PDB while it is locked in the root
Check to which container we're connected:
SQL> select
   ses.con_id,
   case when con.con_id = ses.con_id then 'X' end cur_con, -- current container
   con.name
from
   v$session    ses   cross join
   v$containers con
where
   ses.sid = sys_context('userenv', 'sid') -- Identify own session
; 
-- 
--     CON_ID C NAME
-- ---------- - ------------
--          3 X PDBTQ84
Not connected to the root! Change this:
SQL> connect / as sysdba
Check current container again:
SQL> select
   ses.con_id,
   case when con.con_id = ses.con_id then 'X' end cur_con, -- current container
   con.name
from
   v$session    ses   cross join
   v$containers con
where
   ses.sid = sys_context('userenv', 'sid') -- Identify own session
; 
--     CON_ID C NAME
-- ---------- - -----------------
--          1 X CDB$ROOT
--          1   PDB$SEED
--          1   PDBTQ84
Try again:
SQL> alter user xdb account unlock;
--
-- User altered
Go back to PDB:
SQL> connect sys/elCarosSecret4@PDBTQ84 as sysdba
SQL> select account_status from dba_users where username = 'XDB';
The account status trickled from the root to the PDB.

See also

Other Oracle error messages

Index