oracle 存命中率 收集
时间:2010-09-29 来源:todayboy
查询缓冲区命中率:
select (1 - (sum(decode(name, 'physical reads',value,0)) /
(sum(decode(name, 'db block gets',value,0)) +
sum(decode(name, 'consistent gets',value,0))))) * 100 "Hit Ratio"
from v$sysstat;
数据字典缓存命中率:
SQL> select (1-(sum(getmisses)/sum(gets))) * 100 "Hit Ratio"from v$rowcache;
Hit Ratio
----------
99.715218
如果数据缓存命中率低于95%,必须增大初始参数文件里的SHARED_POOL_SIZE 参数的值。
查询库缓存命中率:
select Sum(Pins) / (Sum(Pins) + Sum(Reloads)) * 100 "Hit Ratio"
from V$LibraryCache;
库缓存命中率显示了对实际语句和PL/SQL对象的内存读操作所占的百分比。注意,很高的命中率并不总是一件好事
查询PGA内存排序命中率:
select a.value "Disk Sorts", b.value "Memory Sorts",round((100*b.value)/decode((a.value+b.value),0,1,(a.value+b.value)),2) "Pct Memory Sorts" from v$sysstat a, v$sysstat b where a.name = 'sorts (disk)' and b.name = 'sorts (memory)';
查询空闲的数据缓冲区:
SQL> select decode(state,0, 'FREE',1,decode(lrba_seq,0,'AVAILABLE','BEING USED'), 3, 'BEING USED', state) "BLOCK STATUS", count(*) from x$bh group by decode(state,0,'FREE',1,decode(lrba_seq,0,'AVAILABLE','BEING USED'),3, 'BEING USED', state);
设置缓存和共享池大小时需要记住的建议:
字典缓存命中率很低(低于95%),可以考虑增大shared_pool_size . 如果库缓存重载率很高(>1%) 可以增大shared_pool_size
参考: