oracle 死锁

oracle 死锁

--查用户名,查客户端机器
SELECT distinct  s.username,s.MACHINE, s.sid||','||s.serial#
    FROM gv$session s, gv$lock l, dba_objects o
   WHERE l.sid = s.sid
     AND l.id1 = o.object_id(+)
    
     AND s.username is NOT NULL
      and s.MACHINE = 'WORKGROUP\PC-201301201414'
     
--这个SQL可以查看哪个用户用什么方式锁住了哪些表,使用的哪个Session。
SELECT   s.username,S.MACHINE,s.SQL_EXEC_START,
         decode(l.type, 'TM', 'TABLE LOCK', 'TX', 'ROW LOCK', NULL) LOCK_LEVEL,
         o.owner,
         o.object_name,
         o.object_type,
         s.sid,
         s.serial#,
         s.sid||','||s.serial#
    FROM gv$session s, gv$lock l, dba_objects o
   WHERE l.sid = s.sid
     AND l.id1 = o.object_id(+)
     AND s.username is NOT NULL
     AND (s.username='' or s.username = 'TPSC_TEST' or s.username = '') --'TPSC'   TPSC_TEST  --必须要大写
   

 

posted @ 2018-11-16 16:06  xiluhua  阅读(175)  评论(0编辑  收藏  举报