Thursday, December 19, 2013

Identifying Blocked and Blocking Sessions


select decode(request,0,'Holder: ','Waiter: ')||sid sess,
id1, id2, lmode, request, type
from v$lock
where (id1, id2, type) in
(select id1, id2, type from v$lock where request>0)
order by id1, request;

----------------------------------------------

select sid,type,lmode,request,ctime,block from v$lock;

--------------------------------------------------

select blocking_session, sid, wait_class,
seconds_in_wait
from v$session
where blocking_session is not NULL
order by blocking_session;

---------------------------------------------------

select 'alter system kill session ' || '''' || sid || ',' || serial# || '''' || ' immediate;' from v$session where BLOCKING_SESSION IS NOT NULL

No comments:

Post a Comment