Project

General

Profile

Actions

View the currently executing SQL statement

The db2pd utility can be used to troubleshoot the db2 active instance.

Steps:
  1. login as the owner of the db2 instance, e.g. db2inst1
  2. First, identify the list of applications:
    db2pd -db <<database alias name>> -applications
    
  3. Based on the application command's output, filter out those applications with the Status, UOW-WAITING and UOW-EXECUTING
  4. Based on the filter-ed data, you can then identify the statement using the combination L-AchID and L-StmtUID columns.
  5. After obtained the value from L-AchID and L-StmtUID, execute the following command:
    • Usage:
      db2pd -db store -applications -dyn | egrep '(<<L-AchID|>>|<<L-StmtUID>>)'
      
    • Example:
      db2pd -db store -applications -dyn | egrep '(123|4563)'
      
    • Example (SQL may span multiple lines. Include the -A parameter to specify the number of lines to grep after):
      db2pd -db store -applications -dyn | egrep -A 15 '(123|4563)'
      
For more information about db2pd utility, see:

Updated by chin-yeh about 13 years ago · 4 revisions