Wednesday, April 7, 2010

All about Locks

Good Query for finding Locks:
=============================

select s.sid, s.serial#, p.spid
from
   v$session s,
   v$process p
where
   s.paddr = p.addr
and
   s.sid in (select SESSION_ID from v$locked_object);

*************************************************


select * from v$lock where request!=0;

-- To find the blocked process.

select * from v$lock where type='TX' and id1='&1' and id2='&2';

-- where &1 and &2 are the ID for the lock we are waiting on from above.

No comments:

Post a Comment