无效会话
SELECT sid, serial#, inst_id, module, status
FROM gv$session s
WHERE s.username = 'BOSNDS3'
AND s.last_call_et >= 10
AND s.status = 'INACTIVE'
AND EXISTS (SELECT 1
FROM gv$lock a, all_objects b
WHERE a.id1 = b.object_id
AND a.sid = s.sid
AND a.inst_id = s.inst_id)
ORDER BY inst_id ASC;
死锁
SELECT LPAD(' ',5(LEVEL-1))||S."USERNAME" AS user_name ,
LPAD(' ',5(LEVEL-1))||S."SID" AS session_id,
S."SERIAL#",
S."SQL_ID", S."ROW_WAIT_OBJ#",
S."WAIT_CLASS",
S."EVENT",
S."P1",
S."P2",
S."P3",
S."SECONDS_IN_WAIT"
FROM V$SESSION S
WHERE S."BLOCKING_SESSION" IS NOT NULL
OR S.SID IN(SELECT DISTINCT BLOCKING_SESSION FROM V$SESSION)
START WITH S."BLOCKING_SESSION" IS NULL
CONNECT BY PRIOR S."SID" = S."BLOCKING_SESSION";