首页 > 代码库 > oracle 锁查询

oracle 锁查询

--v$lock中 id1 在锁模式是 TX 时保存的是 实物id 的前2段
SELECT *
FROM (SELECT s.SID,
TRUNC(id1 / power(2, 16)) rbs,
bitand(id1, to_number(‘ffff‘, ‘xxxx‘)) + 0 slot,
id2 seq,
lmode,
request,
s.USERNAME
from v$lock l, v$session s
where l.SID = s.SID) ls,
v$transaction T
WHERE t.XIDUSN = ls.rbs
and t.XIDSLOT = ls.slot
and t.XIDSQN = ls.seq

--v$lock中 id1 在锁模式是 TM 时表示对象 id
select * from v$lock l,dba_objects d where d.OBJECT_ID = l.ID1;

--ddl锁
select * from dba_ddl_locks;

oracle 锁查询