db2快照

1、獲取快照日誌sql

#1.查看數據庫編目數據庫

db2 list db directory日誌

#2.attach 到要分析的數據庫get

db2 attach to pm1_9 user db2devio

#3.connect 到要分析的數據grep

db2 connect to pm1_9 user db2dev數據

#4.抓取快照sort

db2 get snapshot for all on pm1_9 > /tmp/snap.outdb

2、分析日誌di

#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

相關文章
相關標籤/搜索