top of page

DB2 Snapshot information | Monitor level : Lock

  • Writer: Jha Chandan
    Jha Chandan
  • Feb 19, 2021
  • 2 min read

Updated: Feb 20, 2021

In this article we will see and learn how to get snapshot information about databases and instances for monitor level Lock.


1) get snapshot for locks for application applid appl-id : List of locks held by the application. Lock wait information requires the lock switch.


Example:

db2 connect to db <db_name>
db2 list applications show detail
db2 get snapshot for locks for application applid appl-id

Output:

[db2inst1@l00lnx1186 ~]$ db2 connect to BFENT

   Database Connection Information

 Database server        = DB2/LINUXX8664 11.5.0.0
 SQL authorization ID   = DB2INST1
 Local database alias   = BFENT

[db2inst1@l00lnx1186 ~]$ db2 list applications show detail |more

CONNECT Auth Id
                                                 Application Name     Appl.
 Application Id                                                 Seq#  Number of
 Coordinating     Coordinator     Status                         Status Change T
ime         DB Name  DB Path

                                                                      Handle
                                                                      Agents
 member number    pid/thread
--------------------------------------------------------------------------------
------------------------------------------------ -------------------- ----------
 -------------------------------------------------------------- ----- ----------
 ---------------- --------------- ------------------------------ ---------------
----------- -------- --------------------
DB2INST1
                                                 db2evmg_DB2DETAILDEA 59
 *LOCAL.DB2.210219122006                                        00001 1
 0                56              Connect Completed              Not Collected
            BFENT    /home/db2inst1/db2inst1/NODE0000/SQL00001/MEMBER0000/
DB2INST1
                                                 db2dbctrld           52
 *LOCAL.DB2.210219121959                                        00001 1
 0                49              Connect Completed              Not Collected
            BFENT    /home/db2inst1/db2inst1/NODE0000/SQL00001/MEMBER0000/
DB2INST1
                                                 db2cmpd              58
 *LOCAL.DB2.210219122005                                        00001 1
 0                55              Connect Completed              Not Collected
            BFENT    /home/db2inst1/db2inst1/NODE0000/SQL00001/MEMBER0000/
DB2INST1
[db2inst1@l00lnx1186 ~]$ db2 get snapshot for locks for application applid 52
SQL1611W  No data was returned by Database System Monitor.
[db2inst1@l00lnx1186 ~]$

2) get snapshot for locks for application agentid appl-handle : List of locks held by the application. Lock wait information requires the lock switch.


Example:

db2 connect to db <db_name>
db2 list applications show detail
db2 get snapshot for locks for application agentid appl-handle

Output:

[db2inst1@l00lnx1186 ~]$ db2 connect to BFENT

   Database Connection Information

 Database server        = DB2/LINUXX8664 11.5.0.0
 SQL authorization ID   = DB2INST1
 Local database alias   = BFENT

[db2inst1@l00lnx1186 ~]$ db2 list applications show detail |more

CONNECT Auth Id
                                                 Application Name     Appl.
 Application Id                                                 Seq#  Number of
 Coordinating     Coordinator     Status                         Status Change T
ime         DB Name  DB Path

                                                                      Handle
                                                                      Agents
 member number    pid/thread
--------------------------------------------------------------------------------
------------------------------------------------ -------------------- ----------
 -------------------------------------------------------------- ----- ----------
 ---------------- --------------- ------------------------------ ---------------
----------- -------- --------------------
DB2INST1
                                                 db2evmg_DB2DETAILDEA 59
 *LOCAL.DB2.210219122006                                        00001 1
 0                56              Connect Completed              Not Collected
            BFENT    /home/db2inst1/db2inst1/NODE0000/SQL00001/MEMBER0000/
DB2INST1
                                                 db2dbctrld           52
 *LOCAL.DB2.210219121959                                        00001 1
 0                49              Connect Completed              Not Collected
            BFENT    /home/db2inst1/db2inst1/NODE0000/SQL00001/MEMBER0000/
DB2INST1
                                                 db2cmpd              58
 *LOCAL.DB2.210219122005                                        00001 1
[db2inst1@l00lnx1186 ~]$
[db2inst1@l00lnx1186 ~]$
[db2inst1@l00lnx1186 ~]$
[db2inst1@l00lnx1186 ~]$ db2 get snapshot for locks for application 59
SQL0104N  An unexpected token "59" was found following "APPLICATION".
Expected tokens may include:  "AGENTID".  SQLSTATE=42601
[db2inst1@l00lnx1186 ~]$
[db2inst1@l00lnx1186 ~]$
[db2inst1@l00lnx1186 ~]$ db2 get snapshot for locks for application agentid 59

            Application Lock Snapshot

Snapshot timestamp                         = 02/19/2021 14:25:16.249368

Application handle                         = 59
Application ID                             = *LOCAL.DB2.210219122006
Sequence number                            = 00001
Application name                           = db2evmg_DB2DETAILDEA
CONNECT Authorization ID                   = DB2INST1
Application status                         = Connect Completed
Status change time                         = Not Collected
Application code page                      = 1208
Locks held                                 = 0
Total wait time (ms)                       = Not Collected

[db2inst1@l00lnx1186 ~]$

3) get snapshot for locks on dbname : Lock information at the database level, and application level for each application connected to the database. Requires the lock switch.


Example:

db2 connect to db <db_name>
db2 get snapshot for locks on dbname

Output:

ree

In next post we will see DB2 Snapshot information | Monitor level : Table Space. Please Like, Follow, Share & Subscribe.

Comments


jc_logo.png

Hi, thanks for stopping by!

Welcome to my “Muse & Learn” blog!
Muse a little, learn a lot.✌️

 

Here you’ll find practical SQL queries, troubleshooting tips with fixes, and step-by-step guidance for common database activities. And of course, don’t forget to pause and muse with us along the way. 🙂
 

I share insights on:​​

  • Db2

  • MySQL

  • SQL Server

  • Linux/UNIX/AIX

  • HTML …and more to come!
     

Whether you’re just starting out or looking to sharpen your DBA skills, there’s something here for you.

Let the posts
come to you.

Thanks for submitting!

  • Instagram
  • Facebook
  • X
2020-2025 © TechWithJC

Subscribe to Our Newsletter

Thanks for submitting!

  • Facebook
  • Instagram
  • X

2020-2025 © TechWithJC

bottom of page