Oracle 查看锁情况

/*查看锁(lock)情况*/
SELECT ls.osuser os_user_name,
       ls.username user_name,
       decode(ls.type,
              ‘RW‘,
              ‘Row wait enqueue lock‘,
              ‘TM‘,
              ‘DML enqueue lock‘,
              ‘TX‘,
              ‘Transaction enqueue lock‘,
              ‘UL‘,
              ‘User supplied lock‘) lock_type,
       o.object_name OBJECT,
       decode(ls.lmode,
              1,
              NULL,
              2,
              ‘Row Share‘,
              3,
              ‘Row Exclusive‘,
              4,
              ‘Share‘,
              5,
              ‘Share Row Exclusive‘,
              6,
              ‘Exclusive‘,
              NULL) lock_mode,
       o.owner,
       ls.sid,
       ls.serial# serial_num,
       ls.id1,
       ls.id2
  FROM sys.dba_objects o,
       (SELECT s.osuser,
               s.username,
               l.type,
               l.lmode,
               s.sid,
               s.serial#,
               l.id1,
               l.id2
          FROM v$session s, v$lock l
         WHERE s.sid = l.sid) ls
 WHERE o.object_id = ls.id1
   AND o.owner <> ‘SYS‘
   AND o.object_name = ‘CUX_CUX_PA_REVENUE_COST_TEMP‘
 ORDER BY o.owner, o.object_name
;

原文地址:https://www.cnblogs.com/jenrry/p/10006774.html

时间: 2024-11-17 18:07:42

Oracle 查看锁情况的相关文章

oracle 查看锁表情况与解表

oracle 查看锁表情况与解表 CreateTime--2018年4月27日17:24:37 Author:Marydon 1.锁表查询 --锁表查询 SELECT OBJECT_NAME AS TABLE_NAME, MACHINE, S.SID, S.SERIAL# FROM GV$LOCKED_OBJECT L, DBA_OBJECTS O, GV$SESSION S WHERE L.OBJECT_ID = O.OBJECT_ID AND L.SESSION_ID = S.SID; 2.

oracle查看锁表进程,杀掉锁表进程

查看锁表进程SQL语句1: select sess.sid,     sess.serial#,     lo.oracle_username,     lo.os_user_name,     ao.object_name,     lo.locked_mode     from v$locked_object lo,     dba_objects ao,     v$session sess where ao.object_id = lo.object_id and lo.session_

Oracle查看锁表

查看锁表进程SQL语句1: select sess.sid,     sess.serial#,     lo.oracle_username,     lo.os_user_name,     ao.object_name,     lo.locked_mode     from v$locked_object lo,     dba_objects ao,     v$session sess where ao.object_id = lo.object_id and lo.session_

Oracle 查看锁表进程_杀掉锁表进程 [转]

查看锁表进程SQL语句1: select sess.sid, sess.serial#, lo.oracle_username, lo.os_user_name, ao.object_name, lo.locked_mode from v$locked_object lo, dba_objects ao, v$session sess where ao.object_id = lo.object_id and lo.session_id = sess.sid; 查看锁表进程SQL语句2: sel

oracle 查看锁表情况并处理锁表

/* *locked *query locked object and analyse reason,kill it * */ select 'alter system kill session ''' || SID || ',' || SERIAL# || ''';' from (select distinct a.sid, a.Serial#, status, machine, LOCKWAIT, logon_time from v$session a, v$locked_object b

ORACLE查看锁(lock)情况

  SELECT /*+ RULE */         ls.osuser os_user_name,          ls.username user_name,          DECODE (ls.TYPE,                  'RW', 'Row wait enqueue lock',                  'TM', 'DML enqueue lock',                  'TX', 'Transaction enqueue lock

Oracle 查看锁和释放锁

--查找sid和serial#SELECT object_name, machine, s.sid, s.serial#FROM gv$locked_object l, dba_objects o, gv$session sWHERE l.OBJECT_ID = o.OBJECT_IDAND l.session_id = s.sid; SID    SERIAL# ORACLE_USERNAME---------- ---------- -----------------------------

oracle查看锁和释放锁

详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt108 Oracle数据库操作中,我们有时会用到锁表查询以及解锁和kill进程等操作,那么这些操作是怎么实现的呢?本文我们主要就介绍一下这部分内容. (1)锁表查询的代码有以下的形式: select count(*) from v$locked_object; select * from v$locked_object; (2)查看哪个表被锁 select b.owner,b

oracle,查看锁表

(1)锁表查询的代码有以下的形式:select count(*) from v$locked_object;select * from v$locked_object;(2)查看哪个表被锁select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b where b.object_id = a.object_id;(3)查看是哪个session引起的select b.user