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

  • 来源: 赛迪网 作者: 若水   2008-04-29/11:04
  • 在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'
    /

    评论 {{userinfo.comments}}

    {{money}}

    {{question.question}}

    A {{question.A}}
    B {{question.B}}
    C {{question.C}}
    D {{question.D}}
    提交

    驱动号 更多