Oracle – Identify Locked Objects

Identify Locked Database Objects – Oracle

select b.owner, b.object_name, a.oracle_username, a.os_user_name  
from gv$locked_object a, all_objects b
where a.object_id = b.object_id


select * from gv$locked_object

select
   c.owner,
   c.object_name,
   c.object_type,
   b.sid,
   b.serial#,
   b.status,
   b.osuser,
   b.machine
from
   gv$locked_object a ,
   gv$session b,
   dba_objects c
where
   b.sid = a.session_id
and
   a.object_id = c.object_id
and a.inst_id = b.inst_id

SELECT Decode(request, 0, 'Holder: ',
  'Waiter: ')
  ||vl.sid sess,
  status,id1,id2,lmode,request,vl.TYPE
FROM v$lock vl,v$session vs
WHERE ( id1, id2, vl.TYPE ) IN 
(SELECT id1, id2, TYPE FROM v$lock
  WHERE request > 0)
  AND vl.sid = vs.sid
ORDER BY id1, request

Leave a Reply

Your email address will not be published. Required fields are marked *