如何計算oracle的資料緩衝區命中率與共享池的命中率

tolywang發表於2007-07-05
1、資料緩衝區命中率:
SQL> select value from v$sysstat where name ='physical reads';
SQL> select value from v$sysstat where name ='physical reads direct';
SQL> select value from v$sysstat where name ='physical reads direct (lob)';
SQL> select value from v$sysstat where name ='consistent gets';
SQL> select value from v$sysstat where name = 'db block gets';


這裡命中率的計算應該是
令 x = physical reads direct + physical reads direct (lob)
命中率 =100 - ( physical reads - x) / (consistent gets + db block gets - x)*100
通常如果發現命中率低於90%,則應該調整應用可可以考慮是否增大資料緩衝區
2、共享池的命中率:
SQL> select sum(pinhits-reloads)/sum(pins)*100 "hit radio" from v$librarycache;
假如共享池的命中率低於95%,就要考慮調整應用(通常是沒使用bind var )或者增加記憶體
------------------------------------
9i 命中率 :
select a.value + b.value "logical_reads", c.value "phys_reads",
round(100 * ((a.value+b.value)-c.value) / (a.value+b.value)) "BUFFER HIT RATIO"
from v$sysstat a, v$sysstat b, v$sysstat c
where a.statistic# = 40 and b.statistic# = 41 and c.statistic# = 42;

8i 命中率
select a.value + b.value "logical_reads", c.value "phys_reads",
round(100 * ((a.value+b.value)-c.value) / (a.value+b.value)) "BUFFER HIT RATIO"
from v$sysstat a, v$sysstat b, v$sysstat c
where a.statistic# = 38 and b.statistic# = 39
and c.statistic# = 40;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-84735/,如需轉載,請註明出處,否則將追究法律責任。

相關文章