收集数据
DBNAME=<database name>(注意: 使用数据库名代替<database name>)
nohup iostat -D -l -T 1 180 > iostat.txt &
nohup vmstat -tw 1 180 > vmstat.txt &
db2pd -d $DBNAME -inst > db2pd.inst.1
db2 connect to $DBNAME
db2pd -edu interval=30 > db2pd.edu.out
db2 "call MONREPORT.DBSUMMARY(30)" > monreport.dbsummary.out
~/sqllib/samples/perf/db2mon.sh $DBNAME > /tmp/db2mon.rpt.1
~/sqllib/samples/perf/db2mon.sh $DBNAME > /tmp/db2mon.rpt.2
db2pd -stack all -repeat 3 5
db2pd -d $DBNAME -inst > db2pd.inst.2
db2support . -d $DBNAME -c -s
1.vmstat收集了3分钟(从 18:10:10 ---18:13:10) , 从这个数据看, cpu 高的时候是user 和sys 都高, 各在20% 左右, 不过高的时间持续10s左右, 下边几个时间段cpu 算是高的
18:10:11--18:10:55
18:11:06-18:11:16
18:11:29--18:11:43
18:12:10-18:12:20
18:12:33-18:12:42
2.一般情况下cpu 高 是latch 或者application执行的sql 性能不佳 ,我们可以先去看下application的情况
db2pd.inst.1 收集时间 Date 2022-06-21-18.10.21.763348
db2pd.inst.2 收集时间 Date 2022-06-21-18.20.21.777066
我们先看下 db2pd.inst.1 , 因为收集时间内有cpu慢的情况 , 从application 状态看 ,UOW-Executing 是我们要特别关注的,
grep "Application Status :" db2pd.inst.1 | sort | uniq -c
45 Application Status : ConnectCompleted
1 Application Status : FederatedRequestPending
1 Application Status : UOW-Executing
394 Application Status : UOW-Waiting
处在UOW-Executing 的应用在执行 statement (AnchID StmtUID)(416 86103),对应的sql 如下,
Address AppHandl [nod-index] NumAgents CoorEDUID Status C-AnchID C-StmtUID L-AnchID L-StmtUID Appid
0x0A00020064C763E0 7279 [000-07279] 1 7157749 UOW-Executing 416 86103 416 86102 10.32.95.202.54180.220621100852
--------------------------------------------------------------------------------
Application :
Address : 0x0A00020064C763E0
AppHandl [nod-index] : 7279 [000-07279]
TranHdl : 2986
Application PID : 15652
Application Node Name : B1PMONTAP001
IP Address: 10.32.95.202
Connection Start Time : 2022-06-21-18.08.51.949581
Client User ID : MESADMIN
System Auth ID : SIVIEW
Coordinator EDU ID : 7157749
Coordinator Member : 0
Registered Agents : 1
Active Agents : 1
Locks timeout value : NotSet
Locks Escalation : No
Workload ID : 1
Workload Occurrence ID : 28103450
Trusted Context : n/a
Connection Trust Type : non trusted
Role Inherited : n/a
Application Status : UOW-Executing
Application Name : MESReportWD.exe
Application ID : 10.32.95.202.54180.220621100852
ClientUserID : n/a
ClientWrkstnName : b1pmontap001
ClientApplName : n/a
ClientAccntng : n/a
CollectActData: N
CollectActPartition: C
SectionActuals:
UOW start time : 2022-06-21-18.10.20.431282
UOW stop time :
Last executed statements :
Package cache ID : 0x0001505601A00000
Anchor ID : 416
Statement UID : 86102
SQL Type : Dynamic
Statement Type : DML, Select (blockable)
Statement : xxxxxxxxxxxxxxxxxxxxxxxx
List of current activities :
Activity ID : 1
UOW-ID : 8
Package schema : NULLID
Package name : SYSSH200
Package Version :
Consistency Token : SYSLVL01
Section number : 4
Statement number : 1
Isolation : UR
Effective degree : 1
Actual degree : 1
Sourece ID : 0
Cursor ID : 0
Nesting level : 0
Invocation ID : 0
Package cache ID : 0x0001505701A00000
Anchor ID : 416
Statement UID : 86103
SQL Type : Dynamic
Statement Type : DML, Select (blockable)
Statement : xxxxxxxxxxxxxxxx
Entry time : 2022-06-21-18.14.56.550864
Local start time : 2022-06-21-18.14.56.550869
Last reference time : 2022-06-21-18.14.56.550864
另外我看了下db2pd.inst.2的应用状态, 两个处在UOW-Executing 状态的应用,其中一个应用4731也在运行上述sql
grep "Application Status :" db2pd.inst.2 | sort | uniq -c
45 Application Status : ConnectCompleted
2 Application Status : UOW-Executing
405 Application Status : UOW-Waiting
0x0A000200641FB500 4731 [000-04731] 1 121247 UOW-Executing 416 86110 416 86109 10.32.95.202.58111.220621101853
0x0A0002006350DAC0 2667 [000-02667] 1 7156464 UOW-Executing 253 36688 934 13977 10.32.94.14.64378.220621102017
版权声明:本文为博主原创文章,未经博主允许不得转载。
DB2
- 上一篇:db2exfmt查看执行计划
- 下一篇:DB2普通表修改成分区表