jueves, 25 de junio de 2020

SCRIPT BLOQUEOS INSTANCIA DE BASE DE DATOS

select sid, ctime from v$lock
where block > 0;

select sid, serial#, username
from v$session where sid in (select blocking_session from v$session);

SELECT B.Owner, B.Object_Name, A.Oracle_Username, A.OS_User_Name  
FROM V$Locked_Object A, All_Objects B
WHERE A.Object_ID = B.Object_ID
Select
 s.sid SID,
 s.serial# Serial#,
 l.type type,
 ' ' object_name,
 lmode held,
 request request
from
 v$lock l,
 v$session s,
 v$process p
where
 s.sid = l.sid and
 s.username <> ' ' and
 s.paddr = p.addr and
 l.type <> 'TM' and
 (l.type <> 'TX' or l.type = 'TX' and l.lmode <> 6)
union
select
 s.sid SID,
 s.serial# Serial#,
 l.type type,
 object_name object_name,
 lmode held,
 request request
from
 v$lock l,
 v$session s,
 v$process p,
 sys.dba_objects o
where
 s.sid = l.sid and
 o.object_id = l.id1 and
 l.type = 'TM' and
 s.username <> ' ' and
 s.paddr = p.addr
union
select
 s.sid SID,
 s.serial# Serial#,
 l.type type,
 '(Rollback='||rtrim(r.name)||')' object_name,
 lmode held,
 request request
from
 v$lock l,
 v$session s,
 v$process p,
 v$rollname r
where
 s.sid = l.sid and
 l.type = 'TX' and
 l.lmode = 6 and
 trunc(l.id1/65536) = r.usn and
 s.username <> ' ' and
 s.paddr = p.addr
order by 5, 6
/

No hay comentarios: