ORA-40365 SYS account lock 12C PDB

 Background

Was trying to lock sys user on 12.2 RAC cluster which runs 5 CDB databases. On the first db, lock operation was successful but on the second database sys lock operation was failed with ORA-40365 as below,

 SQL> alter user sys account lock;  
 alter user sys account lock  
 *  
 ERROR at line 1:  
 ORA-40365: The SYS user cannot be locked while the password file is in its  
 current format.  
 SQL>  

Next step was to check the differences in password file configured between the databases. From the results, it was observed that in the database where lock operation was successful, password file format was 12.2 where as in the failing database password file was format 12.

 ora12c@racaprdb1:~$ srvctl config database -d OBDB | grep -i password  
 Password file: +OBDATADG/OBDB/PASSWORD/orapwobdb  
 ora12c@racaprdb1:~$  
 ora12c@racaprdb1:~$ orapwd describe file='+OBDATADG/OBDB/PASSWORD/orapwobdb';  
 Password file Description : format=12.2  
 ora12c@racaprdb1:~$  
 ora12c@racaprdb1:~$  
 ora12c@racaprdb1:~$ srvctl config database -d MOBCDB | grep -i password  
 Password file: +MOBDATADG/MOBCDB/PASSWORD/pwdmobcdb.256.989493863  
 ora12c@racaprdb1:~$  
 ora12c@racaprdb1:~$ orapwd describe file='+MOBDATADG/MOBCDB/PASSWORD/pwdmobcdb.256.989493863'  
 Password file Description : format=12  
 ora12c@racaprdb1:~$  

Below steps were taken to change the password file format to 12.2. This was RAC primary database with single instances standby.

RAC primary new password file creation

Use the input_file option to get the config copied from the existing password file.

 ora12c@racaprdb1:~$ orapwd file='+MOBDATADG/MOBCDB/NEWPASSWORD/orapwmobcdb' format=12.2 input_file='+MOBDATADG/MOBCDB/PASSWORD/pwdmobcdb.256.989493863' dbuniquename=MOBCDB  
 OPW-00010: Could not create the password file. This resource has a Password File.  
 ora12c@racaprdb1:~$  
 ora12c@racaprdb1:~$--Remove the password file reference from the database,  
 ora12c@racaprdb1:~$ srvctl modify database -d MOBCDB -pwfile ''   
 ora12c@racaprdb1:~$ srvctl config database -d OBDB | grep -i password  
 Password file:  
 ora12c@racaprdb1:~$  
 ora12c@racaprdb1:~$ orapwd file='+MOBDATADG/MOBCDB/NEWPASSWORD/orapwmobcdb' format=12.2 input_file='+MOBDATADG/MOBCDB/PASSWORD/pwdmobcdb.256.989493863' dbuniquename=MOBCDB  
 ora12c@racaprdb1:~$ srvctl config database -d MOBCDB | grep -i password  
 Password file: +MOBDATADG/MOBCDB/NEWPASSWORD/orapwmobcdb  
 ora12c@racaprdb1:~$  
 ora12c@racaprdb1:~$ orapwd describe file='+MOBDATADG/MOBCDB/NEWPASSWORD/orapwmobcdb'  
 Password file Description : format=12.2  
 ora12c@racaprdb1:~$  

Since we have used the input_file option and all attributes remained the same, it was not required to copy the new password file to standby side. Dataguard sync was not impacted. Coming back to the initial issue, with password file format set to version 12.2, sys lock operation was successful.

 ora12c@racaprdb1:~$ sqlplus sys as sysdba  
 SQL*Plus: Release 12.2.0.1.0 Production on Thu Sep 17 14:01:23 2020  
 Copyright (c) 1982, 2016, Oracle. All rights reserved.  
 Enter password:  
 Connected to:  
 Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production  
 SQL>  
 SQL>  
 SQL> show pdbs;  
   CON_ID CON_NAME            OPEN MODE RESTRICTED  
 ---------- ------------------------------ ---------- ----------  
      2 PDB$SEED            READ ONLY NO  
      3 MOBPDB             READ WRITE NO  
 SQL> alter session set container=MOBPDB;  
 Session altered.  
 SQL> alter user sys account lock;  
 User altered.  
 SQL>  
 SQL> select username, account_status, lock_date from dba_users where username='SYS';  
 USERNAME                                                             ACCOUNT_STATUS          LOCK_DATE  
 -------------------------------------------------------------------------------------------------------------------------------- -------------------------------- ---------  
 SYS                                                               LOCKED              17-SEP-20  
 SQL>  

Comments

Popular posts from this blog

ORA-16433: The database or pluggable database must be opened in read/write

Oracle Multitenant - Create new service for PDB using DBMS_SERVICE

Wait for unread message on broadcast channel - Blocking Sessions