方案步驟:數據庫
一、查鎖session
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;spa
二、解鎖(KILL)code
--alter system kill session 'sid,serial#';
alter system kill session '151,14678'; --151是sid,14678是serial#blog
運行以上命令後,就能夠解決此問題。get
操做記錄:it
一、數據庫表被鎖;io
二、查鎖class
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;
結果:object
1 BCSA 64 40449 2016/10/9 15:38:05 2 BCSA 64 40449 2016/10/9 15:38:05 3 BCSA 64 40449 2016/10/9 15:38:05 4 BCSA 64 40449 2016/10/9 15:38:05
三、解鎖
alter system kill session '64,40449';
若是仍是沒法鏈接到數據庫,此時重啓庫數據庫是最快的解決方式