参考:
Oracle的锁表与解锁
查看锁表进程SQL语句:
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';
Oracle有自己的进程管理策略,很多情况下杀进程往往不能即使生效,可以加alter system kill ... immediately 试试
稍微整理比较直观的看oracle当前进程信息的sql:
SELECT a.FIRST_LOAD_TIME,a.LAST_ACTIVE_TIME,a.sql_text,a.LAST_LOAD_TIME,a.action, s.terminal,l.session_id sid, s.serial#, l.locked_mode, l.oracle_username, s.user#,
l.os_user_name,s.machine,a.*
FROM v$sqlarea a,v$session s, v$locked_object l
WHERE l.session_id = s.sid
AND s.prev_sql_addr = a.address
ORDER BY sid, s.serial#;