oracle 锁表解决方式

2019-02-14  本文已影响0人  BETWEENAND
/*查看被锁住的存储过程*/
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即可

上一篇下一篇

猜你喜欢

热点阅读