Professional Documents
Culture Documents
select
(select username from v$session where sid=a.sid) blocker,
a.sid,
' is blocking ',
(select username from v$session where sid=b.sid) blockee,
b.sid
from
v$lock a,
v$lock b
where
a.block = 1
and
b.request > 0
and
a.id1 = b.id1
and
a.id2 = b.id2;
QUERY 4: To find blocking session and type of lock.
FIMASTER.USERSESSIONDATA
To kill sessions:
SQL> alter session kill session 'sid,serial#' immediate;
select c.owner,c.object_name,c.object_type,b.sid,b.serial#,
b.status,b.osuser,b.machine from v$locked_object a, v$session b,dba_objects c
where b.sid=a.session_id and a.OBJECT_ID=c.OBJECT_ID ;