View the currently executing SQL statement » History » Version 2
chin-yeh, 07/15/2011 02:51 PM
1 | 1 | chin-yeh | {{toc}} |
---|---|---|---|
2 | |||
3 | h1. View the currently executing SQL statement |
||
4 | 2 | chin-yeh | |
5 | The *db2pd* utility can be used to troubleshoot the db2 active instance. |
||
6 | |||
7 | *Steps:* |
||
8 | # login as the owner of the db2 instance, e.g. *db2inst1* |
||
9 | # First, identify the list of *applications*: |
||
10 | <pre> |
||
11 | db2pd -db <<database alias name>> -applications |
||
12 | </pre> |
||
13 | # Based on the application command's output, filter out those applications with the *Status*, *UOW-WAITING* and *UOW-EXECUTING* |
||
14 | # Based on the filter-ed data, you can then identify the statement using the combination *L-AchID* and *L-StmtUID* columns. |
||
15 | # After obtained the value from *L-AchID* and *L-StmtUID*, execute the following command: |
||
16 | ** Usage: |
||
17 | <pre> |
||
18 | db2pd -db store -applications -dyn | egrep '(<<L-AchID|>>|<<L-StmtUID>>)' |
||
19 | </pre> |
||
20 | ** Example: |
||
21 | <pre> |
||
22 | db2pd -db store -applications -dyn | egrep '(123|4563)' |
||
23 | </pre> |
||
24 | |||
25 | For more information about *db2pd* utility, see: |
||
26 | * http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=/com.ibm.db2.luw.admin.trb.doc/doc/t0020807.html |
||
27 | * http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=/com.ibm.db2.luw.admin.trb.doc/doc/c0054595.html |