ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle Lock Information Queries

Oracle Lock Information Queries

原创 Linux操作系统 作者:chncaesar 时间:2013-11-19 13:51:33 0 删除 编辑
--Find out what objects are locked.
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;

--Find out all blocking locks
select * from v$lock where block > 0;

--Find out blocker and blockee
select
(select username || ' - ' || osuser from v$session where sid=a.sid) blocker,
a.sid || ', ' ||
(select serial# from v$session where sid=a.sid) sid_serial,
' is blocking ',
(select username || ' - ' || osuser from v$session where sid=b.sid) blockee,
b.sid || ', ' ||
(select serial# from v$session where sid=b.sid) sid_serial
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;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/638844/viewspace-776963/,如需转载,请注明出处,否则将追究法律责任。

下一篇: SELinux tips
请登录后发表评论 登录
全部评论

注册时间:2013-07-30

  • 博文量
    102
  • 访问量
    902128