How to Solve ORA-20016: Unable to get the lock : get_pending_activity : 1

Hello Friends,

In this post we will discuss about the error we got durin applying patch fix on database using datapatch

error : ORA-20016: Unable to get the lock : get_pending_activity : 1

ORA-20016 error with "get_pending_activity : 1" usually occurs when attempting to apply a patch using Datapatch, which is a utility used to patch Oracle databases.

This error message indicates that Datapatch is unable to acquire a necessary lock on a resource, which could be a table or index. This can happen if another session is already holding a lock on that resource.

To resolve this error, you can try the following steps:

Check the Oracle alert log for any additional error messages or information about the error.

Identify the specific resource that is being locked. This information may be provided in the error message, or you can use Oracle's "v$locked_object" view to identify the locked object.

Identify the session that is holding the lock on the resource. You can use Oracle's "v$session" view to identify the session.

So lets gets strted

Error We got


[oracle@dm01db01:/tmp/34932268]#
#-> datapatch -verbose
SQL Patching tool version 19.18.0.0.0 Production on Tue Mar  7 20:19:38 2023
Copyright (c) 2012, 2023, Oracle.  All rights reserved.

Log file for this invocation: /u02/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_22820_2023_03_07_20_19_38/sqlpatch_invocation.log

Connecting to database...OK
Gathering database info...done

Note:  Datapatch will only apply or rollback SQL fixes for PDBs
       that are in an open state, no patches will be applied to closed PDBs.
       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
       (Doc ID 1585822.1)

Bootstrapping registry and package to current versions...done
Error: prereq checks failed!
verify_queryable_inventory returned ORA-20016: Unable to get the lock : get_pending_activity : 1
Prereq check failed, exiting without installing any patches.

Please refer to MOS Note 1609718.1 and/or the invocation log
/u02/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_22820_2023_03_07_20_19_38/sqlpatch_invocation.log
for information on how to resolve the above errors.

SQL Patching tool complete on Tue Mar  7 20:25:51 2023

Solution : Stop and start the database


[oracle@dm01db01:/tmp/34932268]#
#-> srvctl stop database -d CDBFIN
[oracle@dm01db01:/tmp/34932268]#
#-> srvctl start database -d CDBFIN

Now run the datapatch again the error will be gone.


[oracle@dm01db01:/tmp/34932268]#
#-> datapatch -verbose
SQL Patching tool version 19.18.0.0.0 Production on Tue Mar  7 20:33:22 2023
Copyright (c) 2012, 2023, Oracle.  All rights reserved.

Log file for this invocation: /u02/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_186745_2023_03_07_20_33_22/sqlpatch_invocation.log

Connecting to database...OK
Gathering database info...done

Note:  Datapatch will only apply or rollback SQL fixes for PDBs
       that are in an open state, no patches will be applied to closed PDBs.
       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
       (Doc ID 1585822.1)

Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of interim SQL patches:
Interim patch 33808367 (OJVM RELEASE UPDATE: 19.15.0.0.220419 (33808367)):
  Binary registry: Not installed
  PDB BIGBD: Rolled back successfully on 07-MAR-23 03.43.22.879928 PM
  PDB CDB$ROOT: Rolled back successfully on 07-MAR-23 03.43.06.936604 PM
  PDB PDB$SEED: Rolled back successfully on 07-MAR-23 03.43.11.939516 PM
  PDB TT4P: Rolled back successfully on 07-MAR-23 03.43.17.458191 PM
Interim patch 34786990 (OJVM RELEASE UPDATE: 19.18.0.0.230117 (34786990)):
  Binary registry: Installed
  PDB BIGBD: Applied successfully on 07-MAR-23 03.43.28.489298 PM
  PDB CDB$ROOT: Applied successfully on 07-MAR-23 03.43.11.671156 PM
  PDB PDB$SEED: Applied successfully on 07-MAR-23 03.43.17.237804 PM
  PDB TT4P: Applied successfully on 07-MAR-23 03.43.22.671892 PM
Interim patch 34792490 (FADBRWT STRESS FA ORA-00060  DEADLOCK DETECTED DURING DATAPATCH):
  Binary registry: Installed
  PDB BIGBD: Applied successfully on 07-MAR-23 03.43.28.571792 PM
  PDB CDB$ROOT: Applied successfully on 07-MAR-23 03.43.11.796298 PM
  PDB PDB$SEED: Applied successfully on 07-MAR-23 03.43.17.327995 PM
  PDB TT4P: Applied successfully on 07-MAR-23 03.43.22.751308 PM
Interim patch 34835593 (REFERENCE BUG 34792490 - SCHEDULER LAYER CHANGES TO AVOID CYCLIC DEPENDENCY ON DBMS_AQADM_SYS PACKAG):
  Binary registry: Installed
  PDB BIGBD: Applied successfully on 07-MAR-23 03.43.28.651007 PM
  PDB CDB$ROOT: Applied successfully on 07-MAR-23 03.43.11.885653 PM
  PDB PDB$SEED: Applied successfully on 07-MAR-23 03.43.17.401352 PM
  PDB TT4P: Applied successfully on 07-MAR-23 03.43.22.823066 PM

Current state of release update SQL patches:
  Binary registry:
    19.18.0.0.0 Release_Update 230127005551: Installed
  PDB BIGBD:
    Applied 19.18.0.0.0 Release_Update 230127005551 successfully on 07-MAR-23 03.43.28.482811 PM
  PDB CDB$ROOT:
    Applied 19.18.0.0.0 Release_Update 230127005551 successfully on 07-MAR-23 03.43.11.664485 PM
  PDB PDB$SEED:
    Applied 19.18.0.0.0 Release_Update 230127005551 successfully on 07-MAR-23 03.43.17.230043 PM
  PDB TT4P:
    Applied 19.18.0.0.0 Release_Update 230127005551 successfully on 07-MAR-23 03.43.22.665991 PM

Adding patches to installation queue and performing prereq checks...done
Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED TT4P BIGBD
    No interim patches need to be rolled back
    No release update patches need to be installed
    No interim patches need to be applied

SQL Patching tool complete on Tue Mar  7 20:34:23 2023

SQL> set serveroutput on;
SQL> execute dbms_optim_bundle.getBugsforBundle;

19.18.0.0.230117DBRU:
    Bug: 31209735,  fix_controls: 31209735
    Bug: 30609737,  fix_controls: 30609737
    Bug: 32498602,  fix_controls: 32498602
    Bug: 29499077,  fix_controls: 29499077
    Bug: 32378953,  fix_controls: 32527739
    Bug: 31821701,  fix_controls: 31266779, 31487332
    Bug: 25869323,  fix_controls: 25869323
    Bug: 31925765,  fix_controls: 31925765
    Bug: 33667505,  fix_controls: 33667505
    Bug: 32107664,  fix_controls: 33369863
    Bug: 32933936,  fix_controls: 32933936
    Bug: 34131435,  fix_controls: 34131435
    Bug: 34012165,  fix_controls: 33745469
    Bug: 34774426,  fix_controls: 29015273
    Bug: 34701323,  fix_controls: 34701323
    Bug: 34123350,  fix_controls: 34123350
    Bug: 34958012,  fix_controls: 32016340

PL/SQL procedure successfully completed.

Hope this helps .

Previous
Next Post »