开启监控
su - db2inst1
db2 update monitor switches using bufferpool on lock on sort on statement on table on timestamp on uow on top
日志输出到文件
db2 get snapshot for all on dbname > snap.txt
重置监控
db2 reset monitor all
分析文件:
win-cmd:
findstr /C:"Total execution time" snap.txt|sort
找到耗时多的就行优化。
也可以找到调用次数多的、cpu耗时多的、读取行数多的等等进行优化。
——————
db2 list db directory
db2pd -d sdzywx -locks show wait
db2pd -d sdzywx -app|grep -i exec
db2pd -d sdzywx -dyn|grep 166
top
db2pd -d sdzywx -app|grep -i exec
db2 get snapshot for application agentid 18524
db2 "force application (18524)"
db2pd -d sdzywx -app|grep -i exec
appid=23769
db2 get snapshot for application agentid $appid
db2 "force application ($appid)"