db2pd -apinfo


db2pd -db TXDB -apinfo 30985 10 file=apinfo.txt

30985是Application hanndle
10是返回的最大SQL数目,也就是MaxStmt参数的值
If the MON_DEADLOCK database parameter is set to HISTORY and there is an active lock event monitor, then the db2pd -apinfo command displays the list of past activities of current UOW.
The following example is a sample of the output displayed:
$ db2pd -apinfo AppHdl -db sample

Database Member 0 -- Database SAMPLE -- Active -- Up 0 days 00:01:07 -- Date 2012-11-21-21.16.35.182584

snapapp Time:   11/21/2012 21:16:35

Application :
  Address :                0x0000000206490080
  AppHandl [nod-index] :   7        [000-00007]
  TranHdl :                3
  Application PID :        23044
  Application Node Name :  hotel49
  IP Address:              n/a
  Connection Start Time :  (1353550528)Wed Nov 21 21:15:28 2012
  Client User ID :         juntang
  System Auth ID :         JUNTANG
  Coordinator EDU ID :     18
  Coordinator Member :     0
  Number of Agents :       1
  Locks timeout value :    NotSet
  Locks Escalation :       No
  Workload ID :            1
  Workload Occurrence ID : 1
  Trusted Context :        n/a
  Connection Trust Type :  non trusted
  Role Inherited :         n/a
  Application Status :     UOW-Waiting  
  Application Name :       db2bp
  Application ID :         *LOCAL.juntang.121122021528
  ClientUserID :           n/a
  ClientWrkstnName :       n/a
  ClientApplName :         n/a
  ClientAccntng :          n/a
  CollectActData:          N
  CollectActPartition:     C
  SectionActuals:          N
  UOW start time :         11/21/2012 21:15:57.181341
  UOW stop time :          11/21/2012 21:15:30.354421

  Last executed statements :
    Package cache ID :                            0x0000027500000001
    Anchor ID :                                   629
    Statement UID :                               1
    SQL Type :                                    Dynamic
    Statement Type :                              DML, Select(blockable)
    Statement :                                   select * from org

  List of current activities :
    Activity ID :                                 2
    UOW-ID :                                      2
    Package schema :                              NULLID
    Package name :                                SQLC2K24
    Package Version :
    Consistency Token :                           AAAAAJHc
    Section number :                              1
    Statement number :                            1
    Isolation :                                   CS
    Effective degree :                            0
    Number of subagent(s) :                       1
    Sourece ID :                                  0
    Cursor ID :                                   0
    Nesting level :                               0
    Invocation ID :                               0
    Package cache ID :                            0x0000034300000001
    Anchor ID :                                   835
    Statement UID :                               1
    SQL Type :                                    Dynamic
    Statement Type :                              DML, Select (blockable)
    Statement :                                   select * from employee
    Entry time :                                  11/21/2012 21:16:07.179827
    Local start time :                            11/21/2012 21:16:07.179830
    Last reference time :                         11/21/2012 21:16:07.179827

  List of past activities of current UOW :
    Activity ID :                                 3
    UOW-ID :                                      2
    Package schema :                              NULLID
    Package name :                                SQLC2K24
    Package Version :
    Consistency Token :                           AAAAAJHc
    Section number :                              201
    Statement number :                            1
    Isolation :                                   CS
    Effective degree :                            0
    Number of subagent(s) :                       1
    Sourece ID :                                  0
    Cursor ID :                                   0
    Nesting level :                               0
    Invocation ID :                               0
    Package cache ID :                            0x0000027500000001
    Anchor ID :                                   629
    Statement UID :                               1
    SQL Type :                                    Dynamic
    Statement Type :                              DML, Select (blockable)
    Statement :                                   select * from org
    Entry time :                                  11/21/2012 21:16:19.068520
    Local start time :                            11/21/2012 21:16:19.068523
    Last reference time :                         11/21/2012 21:16:19.069663

    Activity ID :                                 1
    UOW-ID :                                      2
    Package schema :                              NULLID
    Package name :                                SQLC2K24
    Package Version :
    Consistency Token :                           AAAAAJHc
    Section number :                              201
    Statement number :                            1
    Isolation :                                   CS
    Effective degree :                            0
    Number of subagent(s) :                       1
    Sourece ID :                                  0
    Cursor ID :                                   0
    Nesting level :                               0
    Invocation ID :                               0
    Package cache ID :                            0x0000030100000001
    Anchor ID :                                   769
    Statement UID :                               1
    SQL Type :                                    Dynamic
    Statement Type :                              DML, Select (blockable)
    Statement :                                   select * from dept
    Entry time :                                  11/21/2012 21:15:57.270305
    Local start time :                            11/21/2012 21:15:57.270309
    Last reference time :                         11/21/2012 21:15:57.272555
请使用浏览器的分享功能分享到微信等