Think Foward Logo Tested on Oracle 7 Tested on Oracle 8.0 Tested on Oracle 8i Tested on Oracle 9i Tested on Oracle 10g

SQL Script

Database DeadLocks

Updated: 03-Nov-1998
Version: 1.0

Description

This script lists details of all current database deadlocks on the system, who is holding the lock, and the object name where the lock is held

Parameters

None

SQL Source

REM Copyright (C) Think Forward.com 1998- 2005. All rights reserved. 
col username form A15 col sid form 9990 col type form A4 col lmode form 990 col request form 990 col id1 form 9999990 col id2 form 9999990 break on id1 skip 1 dup spool check_lock.lis SELECT sn.username, m.sid, m.type, DECODE(m.lmode, 0, 'None' , 1, 'Null' , 2, 'Row Share' , 3, 'Row Excl.' , 4, 'Share' , 5, 'S/Row Excl.' , 6, 'Exclusive' , lmode, ltrim(to_char(lmode,'990'))) lmode, DECODE(m.request, 0, 'None' , 1, 'Null' , 2, 'Row Share' , 3, 'Row Excl.' , 4, 'Share' , 5, 'S/Row Excl.' , 6, 'Exclusive' , request, ltrim(to_char(request,'990'))) request, m.id1,m.id2 FROM v$session sn, V$lock m WHERE (sn.sid = m.sid AND m.request != 0) OR (sn.sid = m.sid AND m.request = 0 AND lmode != 4 AND (id1, id2 ) IN (SELECT s.id1, s.id2 FROM v$lock s WHERE request != 0 AND s.id1 = m.id1 AND s.id2 = m.id2 ) ) ORDER BY id1,id2, m.request; spool off clear breaks

Return to Index of SQL Scripts


Site Map

General Information : Home | Company Profile | Contact Us | Legal
Database Support : Proactive Support | Pay Per Incident Support
Expert Services : High Availability | Creative Solutions | Training
Build Services : Oracle Installations | Revive your Oracle Setup | Low Cost Development
Free Oracle Resources: DBA Scripts | Oracle Links