Skip to content

Instantly share code, notes, and snippets.

@dincosman
Last active August 16, 2024 10:31
Show Gist options
  • Save dincosman/dabf7483be5cf6f45f563d094df50234 to your computer and use it in GitHub Desktop.
Save dincosman/dabf7483be5cf6f45f563d094df50234 to your computer and use it in GitHub Desktop.
Detected sessions waiting for lock and the session holding the lock.
SQL> SELECT gvs.inst_id,DECODE (request, 0, 'Holder: ', 'waiter:') || gvl.sid sess,
status,
id1,
id2,
lmode,
request,
gvl.TYPE
FROM gv$lock gvl, gv$session gvs
WHERE (id1, id2, gvl.TYPE) IN (SELECT id1, id2, TYPE
FROM gv$lock
WHERE request > 0)
AND gvl.sid = gvs.sid and gvl.inst_id=gvs.inst_id
ORDER BY id1, request;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment