Troubleshooting Db2 application hangs
About this task
If an application is not responding or is not finishing as quickly as you expect, the application might be hanging. For example, you might try to run a query against the database, but the query does not respond. You might suspect that a hang occurred. However, the query might be taking a long time to run, as is the case with queries that involve Cartesian products on large tables.
Root user authority required.
Procedure
$HOME/sqllib/samples/pd/db2_hang_analyze -db dbname -logUnless you terminate the script by pressing Ctrl-C or Ctrl-Z, the script runs until it detects a possible hang. If you specify the -log parameter, notifications, warnings, and errors are printed to a log file. If a hang is detected, a list of hanging applications is written to a report file. An example of the report file follows:
cat /home/hotel32/shenli/sqllib/db2dump/db2_hang_analyze.20130125.14.41.38.10297.report
APPLICATION HANG DETECTION: Started on Fri Jan 25 14:41:38 EST 2013
Sleeptime : 60 seconds
Timer Limit : 300 seconds
Node Member : default
Retry Limit : 3
Log : yes
SQL : no
Event Metrics Available : yes
Logfile : db2_hang_analyze.20130125.14.41.38.10297.log
Script PID : 10297
CPU Threshold : 0.1%
Post Detection Script : none
Path : /home/hotel32/shenli/sqllib/db2dump/
POTENTIAL APPLICATIONS HANGING: 3 application(s).
Apphdl : 7
Status : CommitActive
AgentEDUID : 16
Apphdl : 9
Status : CommitActive
AgentEDUID : 28
Apphdl : 19
Status : CommitActive
AgentEDUID : 37
APPLICATION HANG DETECTION: Ended on Fri Jan 25 14:46:47 EST 2013The report file shows that three applications are hanging.
What to do next
db2pd -stack eduid -repeat 60 3where eduid is the AgentEDUID number
from the report file produced when you run the db2_hang_analyze script.