进入system或者sys用户操作:
查询哪条语句锁住:
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;
查询并得出删除语句:
select distinct 'alter system kill session '''||t1.sid ||',' ||t1.serial#||''';',t1.sid,t1.serial#,sl.sql_text from v$session t1, v$sql sl where sl.sql_id=t1.sql_id;
一般到这里就结束了
如果执行后出现ORA-00031:标记要终止的会话,则执行下面这段代码(注意:686换成你想查锁的sid)
select spid, osuser, s.program from v$session s,v$process p where s.paddr=p.addr and s.sid=686
我的情况是下面这样,在plsql执行delete from 表导致进程关不掉:
kill掉184573就行了。
清空数据库缓存(ORA-00600):
alter system flush buffer_cache;