DB2只针对单一的应用/EDU收集trace.

前端之家收集整理的这篇文章主要介绍了DB2只针对单一的应用/EDU收集trace.前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
------------以下为一个完整的示例如何收trace------------


收 trace 的话要先找到 application handle,然后针对那个 application handle 收.


1. 通过命令行处理器连接到DB2 server
$ db2 connect to sample


2. 得到当前的application id
$ db2 "values application_id()"
1
------------------------------
*LOCAL.e97q6c.160105062927

1 record(s) selected.

3. 通过 db2 "list applications"找到对应的Appl.Handl为 19363
$ db2 "list applications"
Auth Id Application Appl. Application Id DB # of
Name Handle Name Agents
-------- -------------- ---------- ---------------------------- -------- -----
E97Q6C db2bp 19363 *LOCAL.e97q6c.160105062927 QSMIAO 1

4. 通过db2pd -agent找到19363对应的AgentEDUID 10707
$ db2pd -agent
Database Partition 0 -- Active -- Up 28 days 21:43:22 -- Date 2016-01-05-14.33.34.521085

Agents:
Current agents: 16
Idle agents: 0
Active coord agents: 15
Active agents total: 15
Pooled coord agents: 1
Pooled agents total: 1

Address AppHandl [nod-index] AgentEDUID Type State ClientPid Userid ClientNm
0x0780000000DB61C0 19363 [000-19363] 10707 Coord Inst-Active 8847490 e97q6c db2bp
0x0780000000CB0080 19364 [000-19364] 10417 Coord Inst-Active 8847490 e97q6c db2stmm
0x0780000000D261C0 19365 [000-19365] 10163 Coord Inst-Active 8847490 e97q6c db2taskd
0x0780000000D20080 19366 [000-19366] 9906 Coord Inst-Active 8847490 e97q6c db2wlmd
0x0780000000C961C0 19367 [000-19367] 9649 Coord Inst-Active 8847490 e97q6c db2lused
..

5. 通过db2pd -edu找到'db2sysc'进程的PID. 以及EDU 10707对应的TID 10707(这个EDU ID和TID在AIX平台上是一样的,但在linux平台上不一样)
$ db2pd -edu
Database Partition 0 -- Active -- Up 28 days 21:45:42 -- Date 2016-01-05-14.35.54.593387
List of all EDUs for database partition 0

db2sysc PID: 21954648
db2wdog PID: 20512996
db2acd PID: 15073364

EDU ID TID Kernel TID EDU Name
=======================================================================
10760 10760 110493949 db2agntdp (QSMIAO ) 0
9223 9223 92733521 db2agntdp (QSMIAO ) 0
8966 8966 87490631 db2agent (instance) 0
8708 8708 123338941 db2evmgi (DB2DETAILDEADLOCK) 0
8451 8451 84017377 db2fw7 (QSMIAO) 0
..
10707 10707 35913769 db2agent (QSMIAO) 0 10417 10417 112590913 db2stmm (QSMIAO) 0 6. 打开trace,只对线程21954648.10707收集(上面所有的5步只是为了找到这个线程号) $ db2trc on -t -f db2trc.dmp -p 21954648.10707 7. 重现您的问题,(您需要改成您自己的sql语句/命令): $ db2 "select * from employee" 8.关闭Trace,并格式化,我们需要的文件是db2trc.fmt和db2trc.fmt $ db2trc off $ db2trc flw -t db2trc.dmp db2trc.flw $ db2trc fmt db2trc.dmp db2trc.fmt 原文链接:https://www.f2er.com/javaschema/284218.html

猜你在找的设计模式相关文章