贴一些等待事件方面的查询语句(集体来找问题)

select event, sum(decode(wait_time,0,1,0)) "Waiting Now",
sum(decode(wait_time,0,0,1)) "Previous Waits",
count(*) "Total"
from v$session_wait
group by event
order by count(*);

select event, sum(decode(wait_time,0,1,0)) "Waiting Now",
sum(decode(wait_time,0,0,1)) "Previous Waits",
count(*) "Total"
from v$session
group by event
order by count(*);

SELECT /*+ ordered */ sid, event, owner, segment_name, segment_type,p1,p2,p3
FROM   v$session_wait sw, DBA_extents de
WHERE  de.file_id = sw.p1
AND sw.p2 between de.block_id and de.block_id+de.blocks - 1
AND (event = 'buffer busy waits' OR event = 'write complete waits')
AND p1 IS NOT null
ORDER BY event,sid;

SELECT /*+ ordered */ sid, event, owner, segment_name, segment_type,p1,p2,p3
FROM v$session_wait_history sw, dba_extents de
WHERE  de.file_id = sw.p1
AND sw.p2 between de.block_id and de.block_id+de.blocks - 1
AND (event = 'buffer busy waits' OR event = 'write complete waits')
AND p1 IS NOT null
ORDER BY event,sid;

col name for a20
col p1 for a10
col p2 for a10
col p3 for a10
select event#,name,parameter1 p1,parameter2 p2,parameter3 p3
from v$event_name
where name in ('buffer busy waits', 'write complete waits');

select  sid, event, total_waits, time_waited, event_id
from  v$session_event
where time_waited > 0
order by time_waited;

select sid, wait_class, total_waits
from    v$session_wait_class;

select  event, total_waits, time_waited, event_id
from  v$system_event
where   time_waited > 0
order   by time_waited;

select wait_class, total_waits
from  v$system_wait_class
order by total_waits desc;
select session_id,count(1)
from  v$active_session_history
group by session_id
order by 2;
select c.sql_id, a.sql_text
from v$sql a, (select sql_id,count(1)
from v$active_session_history b where sql_id is not null
group by sql_idorder by 2 desc) c
where rownum <= 5
order by rownum;
标签: 暂无标签
oraunix

写了 199 篇文章,拥有财富 1026,被 339 人关注

转播转播 分享分享 分享淘帖
回复

使用道具

成为第一个吐槽的人

您需要登录后才可以回帖 登录 | 加入社区

本版积分规则

意见
反馈