我们常常在操作数据库时会遇到某个DML操作可能等待很久没有反应,遇到这种情况多半是因为表被锁住了,那么如何解锁呢?
查看哪个表被锁:
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;
查看是哪个session引起的,
/*查看锁表进程sql语句2: */
select * from v$session t1,v$locked_object t2 where t1.sid = t2.SESSION_ID;
/*杀掉锁表进程:
如有记录则表示有lock,記錄下SID和serial# ,將記錄的ID替換下面的738,1429,即可解除LOCK */
alter system kill session '738,1429'; 原文链接:https://www.f2er.com/oracle/213062.html