现在的位置: 首页 > 综合 > 正文

查看锁对象

2013年03月05日 ⁄ 综合 ⁄ 共 466字 ⁄ 字号 评论关闭
set linesize 200; 
select p.spid,
       c.object_name,
       c.subobject_name,
       b.session_id,
       b.oracle_username,
       b.os_user_name
  from gv$process p, gv$session a, gv$locked_object b, all_objects c
 where p.addr = a.paddr
   and a.process = b.process
   and c.object_id = b.object_id
   and object_name != 'OBJ$';

--查看阻塞
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;

抱歉!评论已关闭.