db2 db2top command

db2top utility is very useful to monitor DB2 performance and troubleshoot problems.
In this tutorial, sample is the database name.

Start db2top utility in interactive mode

db2top -d sample

Lock (U)

A locking issue is one of the most commonly seen issue during application diagnosis.
We can see which application is stuck in Lock Waiting status.
By pressing left arrow on the keyboard, more columns are displayed.
Lock Status: the lock with “-“ status is the lock being blocked.
In the Lock Mode column, both the requested lock mode(S) and the lock that is being held(IX) are disaplayed.

Another very useful feature that db2 top can provide in this screen is lock chain analysis. It is much easier for users to understand the locking relationship between applications.
By entering a capital L, the lock chain is displayed.

force application

db2 “force application ( agentID1, agentID2 )”

Reference

https://www.ibm.com/developerworks/data/library/techarticle/dm-0812wang/index.html
https://datageek.blog/2013/01/23/example-of-troubleshooting-a-locking-problem/