一、获取快照日志
#1.查看数据库编目
db2 list db directory
#2.attach 到要分析的数据库
db2 attach to pm1_9 user db2dev
#3.connect 到要分析的数据
db2 connect to pm1_9 user db2dev
#4.抓取快照
db2 get snapshot for all on pm1_9 > /tmp/snap.out
二、分析日志
#1.Rows Read大的表定位
grep -ni "Rows Read" /tmp/snap.out | grep -v "Not Collected" | sort -k 5rn | more
#2.执行次数多的sql
grep -ni "Number of executions" /tmp/snap.out | sort -k 6rn | more