1.what.sql
SELECT S.SID
,S.USERNAME
,S.OSUSER
,NVL(S.MACHINE,'?') MACHINE
,NVL(S.PROGRAM,'?') PROGRAM
,S.PROCESS F_GROUND
,P.SPID B_GROUND
,X.SQL_TEXT
FROM SYS.V_$SESSION S
,SYS.V_$PROCESS P
,SYS.V_$SQLAREA X
WHERE
S.SID = '505'
AND S.PADDR = P.ADDR
AND S.TYPE != 'BACKGROUND'
AND S.SQL_ADDRESS = X.ADDRESS
AND S.SQL_HASH_VALUE = X.HASH_VALUE
ORDER BY S.SID
2.引起死锁的SQL语句
SELECT SQL_TEXT
FROM V$SQL
WHERE HASH_VALUE IN (SELECT SQL_HASH_VALUE FROM V$SESSION WHERE SID IN
(SELECT SESSION_ID FROM V$LOCKED_OBJECT))
3.
Oracle数据库死锁查询语句
SELECT T2.USERNAME
,T2.SID
,T2.SERIAL#
,T3.OBJECT_NAME
,T2.OSUSER
,T2.MACHINE
,T2.PROGRAM
,T2.LOGON_TIME
,T2.COMMAND
,T2.LOCKWAIT
,T2.SADDR
,T2.PADDR
,T2.TADDR
,T2.SQL_ADDRESS
,T1.LOCKED_MODE
FROM V$LOCKED_OBJECT T1
,V$SESSION T2
,DBA_OBJECTS T3
WHERE T1.SESSION_ID = T2.SID
AND T1.OBJECT_ID = T3.OBJECT_ID
ORDER BY T2.LOGON_TIME DESC