Identifying and resolving retained locks for Db2 failures

When a lock is used to allow an object to be changed it is called a modify lock. Modify locks are kept in a list in the coupling facility lock structure to allow for recovery in case a data sharing member fails. If a member fails, the modify locks become retained locks, which are held until the failed member is restarted.

Procedure

To identify and resolve retained locks for a Db2 member, take to following actions:

  1. To identify retained locks, issue a DISPLAY DATABASE command with the LOCKS option.
    -DB1A DISPLAY DATABASE(TESTDB) LOCKS ONLY
    The letter R in the LOCKINFO field indicates a retained lock.
    NAME     TYPE PART STATUS             CONNID   CORRID        LOCKINFO
    -------- ---- ---- ------------------ -------- ----------    --------
    ⋮
    TBS43     TS  01   RW                                        R-IX,PP
                       MEMBER NAME DB2A                     
    End general-use programming interface information.
  2. To resolve the retained locks, restart the failed member normally.
    Db2 resolves and removes retained locks that are held by that member with the full data integrity control. For more information, see Restarting Db2 after termination in a data sharing environment.
  3. If you cannot restart the failed member, and it has retained locks that are severely affecting transactions on other members, consider taking the following actions:
    • Defer the restart processing of the objects that have retained locks. When you defer restart processing, the pages that locks are protecting are placed in the logical page list. Those pages are still inaccessible. However, this approach has the advantage of removing any retained page set P-locks, which have the potential of locking out access to an entire page set.
    • Cold start the failed member. This approach causes Db2 to purge the retained locks, but data integrity is not protected. When the locks are released after the cold start, Db2 looks at data whose status is unclear.
    • Use the command, MODIFY irlmproc,PURGE,db2name. Like a cold start, this command causes Db2 to purge the retained locks and with this method, data integrity is not protected.
    • Restart the failed member in light mode (restart light). Restart light is not recommended for a restart in place. It is intended for a cross-system restart in the event of a failed z/OS® to quickly recover retained locks. Restart light enables Db2 to restart with a minimal storage footprint and then terminate normally after the locks are released.