Blokked sessions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SELECT (
SELECT username
FROM gv$session
WHERE sid=a.sid) blocker,
a.sid, ' is blocking ', (
SELECT username
FROM gv$session
WHERE sid=b.sid) blockee,
b.sid
FROM gv$lock a, gv$lock b
WHERE a.block = 1
AND b.request > 0
AND a.id1 = b.id1
AND a.id2 = b.id2;
SELECT (SELECT username
FROM gv$session
WHERE SID = a.SID AND inst_id = a.inst_id) blocker, a.SID,
' is blocking ', (SELECT username
FROM gv$session
WHERE SID = b.SID AND inst_id = b.inst_id) blockee,
b.SID,b.type,b.lmode,b.request
FROM gv$lock a, gv$lock b
WHERE a.BLOCK > 0
AND b.request > 0
AND a.id1 = b.id1
AND a.id2 = b.id2
AND a.TYPE = b.TYPE
AND a.inst_id = b.inst_id;
SELECT B.USERNAME,b.sid, B.MACHINE, B.TERMINAL, B.STATUS, A.SQL_FULLTEXT, A.SQL_TEXT FROM V$SQLAREA A, V$SESSION B WHERE A.HASH_VALUE=B.PREV_HASH_VALUE AND b.username='STDUIAPR29A' and sid=1531;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SELECT (
SELECT username
FROM gv$session
WHERE sid=a.sid) blocker,
a.sid, ' is blocking ', (
SELECT username
FROM gv$session
WHERE sid=b.sid) blockee,
b.sid
FROM gv$lock a, gv$lock b
WHERE a.block = 1
AND b.request > 0
AND a.id1 = b.id1
AND a.id2 = b.id2;
SELECT (SELECT username
FROM gv$session
WHERE SID = a.SID AND inst_id = a.inst_id) blocker, a.SID,
' is blocking ', (SELECT username
FROM gv$session
WHERE SID = b.SID AND inst_id = b.inst_id) blockee,
b.SID,b.type,b.lmode,b.request
FROM gv$lock a, gv$lock b
WHERE a.BLOCK > 0
AND b.request > 0
AND a.id1 = b.id1
AND a.id2 = b.id2
AND a.TYPE = b.TYPE
AND a.inst_id = b.inst_id;
SELECT B.USERNAME,b.sid, B.MACHINE, B.TERMINAL, B.STATUS, A.SQL_FULLTEXT, A.SQL_TEXT FROM V$SQLAREA A, V$SESSION B WHERE A.HASH_VALUE=B.PREV_HASH_VALUE AND b.username='STDUIAPR29A' and sid=1531;