|
SQL> col username format a15;
SQL> col event format a15;
SQL> col PROGRAM format a15;
SQL> select r.root_sid, s.serial#,
2 r.blocked_num, r.avg_wait_seconds,
3 s.username,s.status,s.event,s.MACHINE,
4 s.PROGRAM,s.sql_id,s.prev_sql_id
from (select root_sid, avg(seconds_in_wait) as avg_wait_seconds,count(*) - 1 as blocked_num
5 6 from (select CONNECT_BY_ROOT sid as root_sid, seconds_in_wait
7 from v$session
8 start with blocking_session is null
9 connect by prior sid = blocking_session)
10 group by root_sid
11 having count(*) > 1) r,
12 v$session s
13 where r.root_sid = s.sid
14 order by r.blocked_num desc, r.avg_wait_seconds desc;
ROOT_SID SERIAL# BLOCKED_NUM AVG_WAIT_SECONDS USERNAME STATUS EVENT MACHINE PROGRAM SQL_ID PREV_SQL_ID
---------- ---------- ----------- ---------------- --------------- -------- --------------- -------------------- --------------- ------------- -------------
229 209 2 5801.66667 SCOTT ACTIVE SQL*Net message egisbdb1 sqlplus@egisbdb 0bkus3mb1v6s7 0ck8r21198b5q
to client 1 (TNS V1-V3)
|
|
|