Skip to content

Instantly share code, notes, and snippets.

@ran488
Created August 9, 2011 19:59
Show Gist options
  • Save ran488/1135030 to your computer and use it in GitHub Desktop.
Save ran488/1135030 to your computer and use it in GitHub Desktop.
Show locks being held and by whom (Oracle)
-- show locks in Oracle
select owner||'.'||object_name obj
,oracle_username||' ('||s.status||')' oruser
,os_user_name osuser
,machine computer
,l.process unix
,s.sid||','||s.serial# ss
,r.name rs
,to_char(s.logon_time,'yyyy/mm/dd hh24:mi:ss') time
from v$locked_object l
,dba_objects o
,v$session s
,v$transaction t
,v$rollname r
where l.object_id = o.object_id
and s.sid=l.session_id
and s.taddr=t.addr
and t.xidusn=r.usn
order by osuser, ss, obj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment