服务热线:13616026886

技术文档 欢迎使用技术文档,我们为你提供从新手到专业开发者的所有资源,你也可以通过它日益精进

位置:首页 > 技术文档 > 数据库技术 > Oracle技术 > Oracle开发 > 查看文档

oracle性能调优过程中如何观察缓存命中率

【赛迪网-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'
/

扫描关注微信公众号