Skip to content

Instantly share code, notes, and snippets.

@igelbox
Last active May 25, 2016 06:15
Show Gist options
  • Save igelbox/a98875117dcfc810a6c4f6148ad96c79 to your computer and use it in GitHub Desktop.
Save igelbox/a98875117dcfc810a6c4f6148ad96c79 to your computer and use it in GitHub Desktop.
select
sw.sid||','||sw.serial#, sw.machine, sw.program, sw.wait_event, sw.blocking_session, o.object_name
, (select sql_text from v$sql where sql_id=sw.sql_id and rownum=1) as sql, p.spid
from (
select s.*, w.event as wait_event
from v$session_wait w
join v$session s on s.sid=w.sid
start with w.event not in ('SQL*Net message from client', 'rdbms ipc message')
connect by prior s.blocking_session = w.sid
) sw
left outer join v$process p on p.addr = sw.paddr
left outer join dba_objects o on o.data_object_id = sw.row_wait_obj#
order by sw.machine, sw.program, sw.event
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment