当前位置:网站首页>Common locking table processing methods in Oracle

Common locking table processing methods in Oracle

2022-07-07 11:55:00 Auspicious flight

1、 View locked table information

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;

2、 Kill the lock table process

alter system kill session '68,51';-- Respectively SID and SERIAL# Number 


3、 View the table that caused the lock in the database SQL sentence  

SELECT A.USERNAME,
       A.MACHINE,
       A.PROGRAM,
       A.SID,
       A.SERIAL#,
       A.STATUS,
       C.PIECE,
       C.SQL_TEXT
  FROM V$SESSION A, V$SQLTEXT C
 WHERE A.SID IN (SELECT DISTINCT T2.SID
                   FROM V$LOCKED_OBJECT T1, V$SESSION T2
                  WHERE T1.SESSION_ID = T2.SID)
   AND A.SQL_ADDRESS = C.ADDRESS(+)
 ORDER BY C.PIECE;
原网站

版权声明
本文为[Auspicious flight]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070905587125.html

随机推荐