![drdb2](https://www.talkwithtrend.com/ucenter/avatar.php?uid=47604&size=small&v=1718562224)
系统工程师
·se
A script to calc RRR or SRR
字数 2183阅读 1984评论 0赞 2
[db2inst1@q1 ~]$ cat calc_rrr.sh
db=sample
db2 get snapshot for database on $db | grep reads | tee tmpfile
dpr=`cat tmpfile | grep '^Buffer pool data physical reads' | awk '{print $NF}'`
ipr=`cat tmpfile | grep '^Buffer pool index physical reads' | awk '{print $NF}'`
adr=`cat tmpfile | grep '^Asynchronous pool data page reads' | awk '{print $NF}'`
air=`cat tmpfile | grep '^Asynchronous pool index page reads' | awk '{print $NF}'`
echo "100 - 100 * ($adr+$air)/($dpr+$ipr)"
rrr=`echo "100 - 100 * ($adr+$air)/($dpr+$ipr)" | bc`
echo "Random(Sync) Read Ratio = $rrr"
[db2inst1@q1 ~]$ sh calc_rrr.sh
Buffer pool data logical reads = 10375
Buffer pool data physical reads = 430
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads = 0
Asynchronous pool data page reads = 96
Buffer pool index logical reads = 14913
Buffer pool index physical reads = 609
Buffer pool temporary index logical reads = 0
Buffer pool temporary index physical reads = 0
Asynchronous pool index page reads = 23
Buffer pool xda logical reads = 0
Buffer pool xda physical reads = 0
Buffer pool temporary xda logical reads = 0
Buffer pool temporary xda physical reads = 0
Asynchronous pool xda page reads = 0
Direct reads = 1848
Direct reads elapsed time (ms) = 1049
100 - 100 * (96+23)/(430+609)
Random(Sync) Read Ratio = 89
如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!
赞2
添加新评论0 条评论