Oracle锁表查询和解锁方法

查询锁表的信息

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;

解除锁

alter system kill session 'SID,SERIAL#';

如:alter system kill session '1290,6601';

posted @ 2022-02-11 16:25  daheww  阅读(1364)  评论(0编辑  收藏  举报