欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

通过视图查历史等待事件

程序员文章站 2022-05-17 11:54:40
...

过去发生的等待事件,我们可以通过什么视图查出来呢? 1.自实例启动以来 select * from ( select event,total_waits,time_waited,wait_class from v$system_event where wait_classIdle order by 3 desc )where rownum=50; 9i select * from ( select event,

过去发生的等待事件,我们可以通过什么视图查出来呢?

1.自实例启动以来

select * from ( select event,total_waits,time_waited,wait_class from v$system_event where wait_class'Idle' order by 3 desc )where rownum

2.当前已连接的各会话的历史等待事件信息

select * from (select event, wait_class, sum(total_waits), sum(time_waited) from v$session_event where wait_class 'Idle' group by event, wait_class order by sum(time_waited) desc) where rownum 9i select * from (select event, sum(total_waits), sum(time_waited) from v$session_event where event not in ('rdbms ipc message','pmon timer','smon timer','SQL*Net message from client','rdbms ipc reply','SQL*Net more data from client') group by event order by sum(time_waited) desc) where rownum

3.当前已连接的某SESSION的历史等待事件信息

select * from (select sid, event, total_waits, time_waited from v$session_event where sid=&1 order by sid asc,time_waited desc) where event not like '%rdbms ipc%' and event not like '%SQL*Net message%';
9i: select sid, event, total_waits, time_waited from v$session_event where sid in (&1) order by sid asc,time_waited desc

备注: total_waits代表总共等待的次数,比较重要的是time_waited的,这反映了用户的等待体验,time_waited是百分之一秒。