如何快速查出 oracle 数据库中的锁等待
2个回答
展开全部
被锁定的数据库表及相关的sid、serial#及spid
select object_name as 对象名称,s.sid,s.serial#,p.spid as 系统进程号
from v$locked_object l , dba_objects o , v$session s , v$process p
where l.object_id=o.object_id and l.session_id=s.sid and s.paddr=p.addr;
--锁检查
select /*+ rule */
lpad('--', decode(b.block, 1, 0, 4)) || s.username user_name,
b.type,
o.owner || '.' || o.object_name object_name,
s.sid,
s.serial#,
decode(b.request, 0, 'BLOCKED', 'Waiting') status,
t.SQL_TEXT
from dba_objects o,
v$session s,
v$lock v,
v$lock b,
v$sqltext_with_newlines t
where v.id1 = o.object_id
and v.sid = s.sid
and v.sid = b.sid
and (b.block = 1 or b.request > 0)
and v.type = 'TM'
and t.ADDRESS = s.PREV_SQL_ADDR
order by status,s.sid;
select object_name as 对象名称,s.sid,s.serial#,p.spid as 系统进程号
from v$locked_object l , dba_objects o , v$session s , v$process p
where l.object_id=o.object_id and l.session_id=s.sid and s.paddr=p.addr;
--锁检查
select /*+ rule */
lpad('--', decode(b.block, 1, 0, 4)) || s.username user_name,
b.type,
o.owner || '.' || o.object_name object_name,
s.sid,
s.serial#,
decode(b.request, 0, 'BLOCKED', 'Waiting') status,
t.SQL_TEXT
from dba_objects o,
v$session s,
v$lock v,
v$lock b,
v$sqltext_with_newlines t
where v.id1 = o.object_id
and v.sid = s.sid
and v.sid = b.sid
and (b.block = 1 or b.request > 0)
and v.type = 'TM'
and t.ADDRESS = s.PREV_SQL_ADDR
order by status,s.sid;
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询