DB2 for Linux, UNIX, and Windows 的锁事件,第 3 部分: 使用 DB2 9.7 中的锁事件监控器来解决并发性问题
2010-08-03 00:00:00 来源:WEB开发网清单 10. 编译 db2evmonfmt 工具
set PATH=C:\Program Files\IBM\SQLLIB\java\jdk\bin;%PATH%
javac db2evmonfmt.java
为了读取和格式化锁超时事件的信息,根据选项调用 db2evmonfmt 工具,如清单 11 所示。默认情况下,工具输出写到标准输出,所以将其输出重新指向文本文件。
清单 11. 调用 db2evmonfmt 工具来格式化为锁超时事件收集的数据
java db2evmonfmt -d sample -ue emdata.tab_locking -ftext -u username -p password
>locktimeout.txt
其中的代码选项如下:
-d数据库名-ue非格式化事件表的完全许可路径(包括模式)-ftext纯文本格式(或者,通过指定 -fxml 选项设置 XML 格式)的锁事件信息输出-u数据库访问的用户 ID-p数据库访问的密码
对于锁超时事件,db2evmonfmt 生成如清单 12 所示的输出。
清单 12. 锁超时事件的 db2evmonfmt 输出
-------------------------------------------------------
Event ID : 1
Event Type : LOCKTIMEOUT
Event Timestamp : 2010-02-16-18.27.38.102302
Partition of detection : 0
-------------------------------------------------------
Participant No 1 requesting lock
----------------------------------
Lock Name : 0x02000600040000000000000052
Lock wait start time : 2010-02-16-18.27.28.086228
Lock wait end time : 2010-02-16-18.27.38.102302
Lock Type : ROW
Lock Specifics : ROWID=4,DATA_PARTITION_ID=0,PAGEID=0
Lock Attributes : 00000000
Lock mode requested : Update
Lock mode held : Exclusive
Lock Count : 1
Lock Hold Count : 0
Lock rrIID : 0
Lock Status : Waiting
Lock release flags : 40000000
Tablespace TID : 2
Tablespace Name : USERSPACE1
Table FID : 6
Table Schema : FECHNER
Table Name : EMPLOYEE
Attributes Requester Owner
--------------------- ------------------------------ ------------------------------
Participant No 1 2
Application Handle 0342 0333
Application ID *LOCAL.DB2.100216172719 *LOCAL.DB2.100216172702
Application Name db2bp.exe db2bp.exe
Authentication ID FECHNER FECHNER
Requesting AgentID 2172 6320
Coordinating AgentID 2172 6320
Agent Status UOW Executing UOW Waiting
Application Action No action No action
Lock timeout value 10 0
Lock wait value 0 0
Workload ID 1 1
Workload Name SYSDEFAULTUSERWORKLOAD SYSDEFAULTUSERWORKLOAD
Service subclass ID 13 13
Service subclass SYSDEFAULTSUBCLASS SYSDEFAULTSUBCLASS
Current Request Execute Immediate Close Cursor
TEntry state 1 2
TEntry flags1 00000000 00000000
TEntry flags2 00000200 00000200
Lock escalation no no
Client userid
Client wrkstnname
Client applname
Client acctng
Current Activities of Participant No 1
----------------------------------------
Activity ID : 1
Uow ID : 1
Package Name : SQLC2H20
Package Schema : NULLID
Package Version :
Package Token : AAAAAZBZ
Package Sectno : 203
Reopt value : none
Incremental Bind : no
Eff isolation : CS
Eff degree : 0
Eff locktimeout : 10
Stmt unicode : no
Stmt query ID : 0
Stmt nesting level : 0
Stmt invocation ID : 0
Stmt source ID : 0
Stmt pkgcache ID : 3783866187777
Stmt type : Dynamic
Stmt operation : DML, Insert/Update/Delete
Stmt text : UPDATE EMPLOYEE SET BONUS = SALARY * 0.1 WHERE JOB = 'MANAGER'
Past Activities of Participant No 1
-------------------------------------
Activities not available
Current Activities of Participant No 2
----------------------------------------
Activities not available
Past Activities of Participant No 2
-------------------------------------
Past Activities wrapped: no
Activity ID : 2
Uow ID : 2
Package Name : SQLC2H20
Package Schema : NULLID
Package Version :
Package Token : AAAAAZBZ
Package Sectno : 201
Reopt value : none
Incremental Bind : no
Eff isolation : CS
Eff degree : 0
Eff locktimeout : 10
Stmt unicode : no
Stmt query ID : 0
Stmt nesting level : 0
Stmt invocation ID : 0
Stmt source ID : 0
Stmt pkgcache ID : 721554505729
Stmt type : Dynamic
Stmt operation : DML, Select (blockable)
Stmt text : SELECT LASTNAME, FIRSTNME, SALARY FROM EMPLOYEE ORDER BY LASTNAME ASC
Activity ID : 1
Uow ID : 2
Package Name : SQLC2H20
Package Schema : NULLID
Package Version :
Package Token : AAAAAZBZ
Package Sectno : 203
Reopt value : none
Incremental Bind : no
Eff isolation : CS
Eff degree : 0
Eff locktimeout : 10
Stmt unicode : no
Stmt query ID : 0
Stmt nesting level : 0
Stmt invocation ID : 0
Stmt source ID : 0
Stmt pkgcache ID : 3835405795329
Stmt type : Dynamic
Stmt operation : DML, Insert/Update/Delete
Stmt text : UPDATE EMPLOYEE SET SALARY = SALARY * 1.02
更多精彩
赞助商链接