在计算SGA命中率时,提示除数为0,为什么?

[复制链接]
查看11 | 回复8 | 2005-10-30 17:05:33 | 显示全部楼层 |阅读模式
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;
提示除数为零,为什么?
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
那就把除数加上0.0000000001 什么的
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
那为什么除数会是0呢?
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
9i命中率应该时这样算
//9i计算SGA命中率
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;
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
40 db block gets
41 consistent gets
42 physical reads
理论上讲每个物理读取都应该是由一个或多个逻辑读取形成的呀
为什么逻辑读取会是0呢?
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
he use statistic# 38 and 39, that's why get "0" complain.
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
没有发现两条SQL的条件是不一样的
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
刚才我试验了一下,8I中,如果不加后边的WHERE子句,就是提示除数为0,你是不是没有选中后面的条件语句呢!
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
不加参数有什么意义,每个统计项都不一样的,肯定会有为0的
我现在没有8I,不知道8i的38,39,40是什么
理论上就是(数据块的读取+一致性读取)/物理读取=SGA命中率
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行