美文网首页
oracle 锁表解决方式

oracle 锁表解决方式

作者: BETWEENAND | 来源:发表于2019-02-14 15:18 被阅读0次
    /*查看被锁住的存储过程*/
    SELECT * FROM V$DB_OBJECT_CACHE WHERE OWNER = 'APPADMIN' AND LOCKS != '0';
    SELECT * FROM DBA_DDL_LOCKS WHERE NAME = UPPER('TEMP_EXPORT');
    SELECT T.SID, T.SERIAL# FROM V$SESSION T WHERE T.SID = 24;
    
    /*查看被锁住的表*/
    SELECT DO.OWNER, DO.OBJECT_NAME, LO.SESSION_ID, LO.LOCKED_MODE
      FROM V$LOCKED_OBJECT LO, DBA_OBJECTS DO
     WHERE DO.OBJECT_ID = LO.OBJECT_ID;
    
    SELECT B.USERNAME, B.SID, B.SERIAL#, LOGON_TIME
      FROM V$LOCKED_OBJECT A, V$SESSION B
     WHERE A.SESSION_ID = B.SID
     ORDER BY B.LOGON_TIME;
    
    /*kill被锁的进程 'sid, serial#' */
    ALTER SYSTEM KILL SESSION '24,30992';
    
    /*lock相关表*/
    SELECT * FROM V$LOCK;
    SELECT * FROM V$SQLAREA;
    SELECT * FROM V$SESSION;
    SELECT * FROM V$PROCESS;
    SELECT * FROM V$LOCKED_OBJECT;
    SELECT * FROM ALL_OBJECTS;
    SELECT * FROM V$SESSION_WAIT;
    
    

    将锁住的进程kill即可

    相关文章

      网友评论

          本文标题:oracle 锁表解决方式

          本文链接:https://www.haomeiwen.com/subject/ippeeqtx.html