日期:2014-05-16  浏览次数:20756 次

查询ORACLE加锁的进程和用户
select /*a.*,*/
-- b.SID      waiting_SID,
 b.MACHINE waiting_MACHINE,
 -- b.TERMINAL waiting_TERMINAL,
 b.PROGRAM waiting_PROGRAM,
 b.OSUSER  waiting_OSUSER,
 -- c.SID      holding_SID,
 c.MACHINE holding_MACHINE,
 -- c.TERMINAL holding_TERMINAL,
 c.PROGRAM     holding_PROGRAM,
 c.OSUSER      holding_OSUSER,
 e.OBJECT_NAME
  from dba_waiters     a,
       v$session       b,
       v$session       c,
       v$locked_object d,
       dba_objects     e
 where a.waiting_session = b.SID(+)
   and a.holding_session = c.SID(+)
   and a.holding_session = d.SESSION_ID(+)
   and e.OBJECT_ID(+) = d.OBJECT_ID;