Oracle 查询锁表和解锁

  |   0 评论   |   222 浏览

  1. 查看数据库锁,诊断锁的来源及类型:
SELECT OBJECT_ID, SESSION_ID, LOCKED_MODE FROM V$LOCKED_OBJECT;
  1. 找出数据库的serial#,以备杀死:
SELECT T2.USERNAME, T2.SID, T2.SERIAL#, T2.LOGON_TIME
  FROM V$LOCKED_OBJECT T1, V$SESSION T2
 WHERE T1.SESSION_ID = T2.SID
 ORDER BY T2.LOGON_TIME;
  1. 杀死该session
alter system kill session 'sid,serial#'; --为步骤2中查出来的值

评论

发表评论