【赛迪网-it技术报道】在oracle数据库性能调优的过程中,当需要观察缓存命中率(measure the buffer cache hit ratio)时,我们可以使用下面的语句:
rem-------------------------------------------
rem 测量缓存命中率
rem ------------------------------------------
-- 获取初始缓存命中率...
select round((1-(phy.value / (cur.value + con.value)))*100,2) "cache hit ratio"
from v$sysstat cur, v$sysstat con, v$sysstat phy
where cur.name = 'db block gets'
and con.name = 'consistent gets'
and phy.name = 'physical reads'
/
-- 我们人为来增加缓存命中率...
declare
v_dummy dual.dummy%type;
begin
for i in 1..1000 loop
select dummy into v_dummy from dual;
end loop;
end;
/
-- 我们再来测量...
select round((1-(phy.value / (cur.value + con.value)))*100,2) "cache hit ratio"
from v$sysstat cur, v$sysstat con, v$sysstat phy
where cur.name = 'db block gets'
and con.name = 'consistent gets'
and phy.name = 'physical reads'
/
|