如果觉得io不正常,例如top命令的wait%大于20%,会不会是导致数据库慢的原因呢?
先看这个
-
-
col name for a25
-
-
select m.intsize_csec,
-
n.name ,
-
round(m.time_waited,3) time_waited,
-
m.wait_count,
-
round(10*m.time_waited/nullif(m.wait_count,0),3) avgms
-
from v$eventmetric m,
-
v$event_name n
-
where m.event_id=n.event_id
-
and n.name in (
-
'db file sequential read',
-
'db file scattered read',
-
'direct path read',
-
'direct path read temp',
-
'direct path write',
-
'direct path write temp',
-
'log file sync',
-
'log file parallel write'
-
);
-
效果如下:
如果最右列的值大于20,则说明io的确有问题,不符合oracle预期。
操作系统层面呢?
最简单的方法可以试试cp一个1g的文件,读取速度如果小于50mb/s,说明速度不快,例如:
time cp /oradata/sysaux01.dbf /oradata/test1.log
我的虚拟机上效果:
读取速度是37mb/s
当然猎户座可以帮忙,orion
[oracle@db01 ~]$ orion -help
如果间歇性io慢怎么办?
osw 或者 sar -f /var/log/sa/sa28 看看wait%历史
展示一下io等待统计结果
-
-- from tanelpoder.com
-
-
break on snap_begin skip 1 on snap_end on event_name
-
-
col event_name for a40
-
-
select
-
cast(begin_interval_time as date) snap_begin
-
, to_char(cast(end_interval_time as date), 'hh24:mi') snap_end
-
, event_name
-
, wait_time_milli
-
, case when wait_count >= lag(wait_count) over (partition by event_name,wait_time_milli order by cast(begin_interval_time as date)) then
-
wait_count - lag(wait_count) over (partition by event_name,wait_time_milli order by cast(begin_interval_time as date))
-
else
-
wait_count
-
end wait_count
-
from
-
dba_hist_snapshot
-
natural join
-
dba_hist_event_histogram
-
where
-
begin_interval_time > sysdate - 1/24
-
--and event_name like 'asm file metadata operation'
-
--and event_name like 'flashback log switch'
-
-- and event_name like 'ksv master wait'
-
and wait_class = 'user i/o'
-
order by
-
event_name
-
, snap_begin
-
, wait_time_milli
-
/
效果如下:
如果io没有问题,那么就要分析方向就要转向是不是内存用完了,大量换页导致?
当然大部分是由于sql性能较差导致。
阅读(2339) | 评论(0) | 转发(0) |