查看锁等待情况 db2pd 使用说明

 
1、查看锁等待情况 db2pd -db [ dbname ] -locks 主要关注Sts列,其中W代表Waiting

d:/>db2pd -d test -locks

Database Partition 0 -- Database TEST -- Active -- Up 0 days 00:02:21 -- Date 2008-06-24 16:11:26

Locks:
Address    TranHdl Lockname                   Type       Mode Sts Owner      Dur HldCnt Att    ReleaseFlg
0x029CCA88  2       02000400060000000000000052 Row        ..X  G   2          1   0      0x0000 0x40000000
0x029CCCB8 3       02000400060000000000000052 Row        ..X  W    2          1   0      0x0000 0x40000000
0x029CC268 2       53514C4332453037FE5E49DE41 Internal P ..S  G   2          1   0      0x0000 0x40000000
0x029CCC68 3       53514C4332453037FE5E49DE41 Internal P ..S  G   3          1   0      0x0000 0x40000000
0x029CCC40 3       53514C4445464C5428DD630641 Internal P ..S  G   3          1   0      0x0000 0x40000000
0x029CC330 3       010000000100000001000D0056 Internal V ..S  G   3          1   0      0x0000 0x40000000
0x029CC470 2       02000400000000000000000054 Table      .IX  G   2          1   0      0x0000 0x40000000
0x029CCC90 3       02000400000000000000000054 Table      .IX  G   3          1   0      0x0000 0x40000000



2、确定 transaction 关系 db2pd -db [ dbname ] -trans

d:/>db2pd -db test -trans

Database Partition 0 -- Database TEST -- Active -- Up 0 days 00:03:27 -- Date 2008-06-24 16:12:32

Transactions:
Address    AppHandl [nod-index] TranHdl    Locks      State   Tflag      Tflag2     Firstlsn       Lastlsn        LogSpace
     SpaceReserved   TID            AxRegCnt   GXID
0x02961580  634      [000-00634]  2          3          WRITE   0x00000000 0x00000000 0x00000232800C 0x00000232800C 132
     190             0x000000004BE5 1          0
0x02962000 639      [000-00639] 3          5          READ    0x00000000 0x00000000 0x000000000000 0x000000000000 0
     0               0x000000004BF4 1          0

d:/>


3、确定 applications 关系,进一步确定应用程序IP等信息 db2pd -db [ dbname ] -appl

d:/>db2pd -db test -appl

Database Partition 0 -- Database TEST -- Active -- Up 0 days 00:03:43 -- Date 2008-06-24 16:12:48

Applications:
Address    AppHandl [nod-index] NumAgents CoorTid Status       C-AnchID C-StmtUID  L-AnchID L-StmtUID  Appid

0x01DDFAB0 639      [000-00639] 1         3020    Lock-wait    13       1          0        0       *LOCAL.DB2.080624081058
0x01DDEB70  634      [000-00634] 1         3960    UOW-Waiting  0        0          120      1        *LOCAL.DB2.080624080859



4、查看 application 的详细情况 get snapshot for locks for application agentid xxx

d:/>db2 get snapshot for locks for application agentid 634

            应用程序锁定快照

快照时间戳记                    = 2008-06-24 16:44:07.895544

应用程序句柄                    = 634
应用程序标识                    = *LOCAL.DB2.080624080859
序号                            = 0003
应用程序名                      = db2bp.exe
CONNECT 授权标识                = ADMINISTRATOR
应用程序状态                    = UOW 正在等待
状态更改时间                    = 未收集
应用程序代码页                  = 1386
挂起的锁定                      = 3
总计等待时间(毫秒)            = 未收集

锁定列表
 锁定名称                       = 0x02000400060000000000000052
 锁定属性                       = 0x00000000
 发行版标志                     = 0x40000000
 锁定计数                       = 1
 挂起计数                       = 0
 锁定对象名                     = 6
 对象类型                       = 行
 表空间名                       = USERSPACE1
 表模式                         = ADMINISTRATOR
 表名                           = LOCK
 方式                           = X

 锁定名称                       = 0x53514C4332453037FE5E49DE41
 锁定属性                       = 0x00000000
 发行版标志                     = 0x40000000
 锁定计数                       = 1
 挂起计数                       = 0
 锁定对象名                     = 0
 对象类型                       = 内部方案锁定
 方式                           = S

 锁定名称                       = 0x02000400000000000000000054
 锁定属性                       = 0x00000000
 发行版标志                     = 0x40000000
 锁定计数                       = 1
 挂起计数                       = 0
 锁定对象名                     = 4
 对象类型                       = 表
 表空间名                       = USERSPACE1
 表模式                         = ADMINISTRATOR
 表名                           = LOCK
 方式                           = IX



d:/>db2 get snapshot for locks for application agentid 639

            应用程序锁定快照

快照时间戳记                    = 2008-06-24 16:44:26.233647

应用程序句柄                    = 639
应用程序标识                    = *LOCAL.DB2.080624081058
序号                            = 0001
应用程序名                      = db2bp.exe
CONNECT 授权标识                = ADMINISTRATOR
应用程序状态                    = 锁定等待
状态更改时间                    = 未收集
应用程序代码页                  = 1386
挂起的锁定                      = 4
总计等待时间(毫秒)            = 未收集

锁定列表
 锁定名称                       = 0x010000000100000001000D0056
 锁定属性                       = 0x00000000
 发行版标志                     = 0x40000000
 锁定计数                       = 1
 挂起计数                       = 0
 锁定对象名                     = 0
 对象类型                       = 内部变化锁定
 方式                           = S

 锁定名称                       = 0x53514C4332453037FE5E49DE41
 锁定属性                       = 0x00000000
 发行版标志                     = 0x40000000
 锁定计数                       = 1
 挂起计数                       = 0
 锁定对象名                     = 0
 对象类型                       = 内部方案锁定
 方式                           = S

 锁定名称                       = 0x53514C4445464C5428DD630641
 锁定属性                       = 0x00000000
 发行版标志                     = 0x40000000
 锁定计数                       = 1
 挂起计数                       = 0
 锁定对象名                     = 0
 对象类型                       = 内部方案锁定
 方式                           = S

 锁定名称                       = 0x02000400000000000000000054
 锁定属性                       = 0x00000000
 发行版标志                     = 0x40000000
 锁定计数                       = 1
 挂起计数                       = 0
 锁定对象名                     = 4
 对象类型                       = 表
 表空间名                       = USERSPACE1
 表模式                         = ADMINISTRATOR
 表名                           = LOCK
 方式                           = IX

你可能感兴趣的:(db2)