ORACLE数据库表解锁record is locked by another user
方案步骤:
1、查锁
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;
2、解锁(KILL)
--alter system kill session 'sid,serial#';
alter system kill session '151,14678'; --151是sid,14678是serial#
运行以上命令后,就可以解决此问题。
操作记录:
1、数据库表被锁;
2、查锁
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 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
3、解锁
alter system kill session '64,40449';
如果还是无法连接到数据库,此时重启库数据库是最快的解决方式