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