ORA-00031: session marked for kill 處理Oracle中殺不掉的鎖 作者: moonsoft(http://moonsoft.itpub.net) 發表於: 2006.09.06 09:24 分類: Oracle基礎/資料倉儲/BI 出處: http://moonsoft.itpub.net/post/15182/203828 --------------------------------------------------------------- 一些ORACLE中的進程被殺掉後,狀態被置為"killed",但是鎖定資源很長時間不釋放,有時實在沒辦法,只好重啟資料庫。現在提供一種方法解決這種問題,那就是在ORACLE中殺不掉的,在OS一級再殺。 1.下面的語句用來查詢哪些對象被鎖: select object_name,machine,s.sid,s.serial# from v$locked_object l,dba_objects o ,v$session s where l.object_id = o.object_id and l.session_id=s.sid; 2.下面的語句用來殺死一個進程: alter system kill session '24,111'; (其中24,111分別是上面查詢出的sid,serial#) 【注】以上兩步,可以通過Oracle的管理主控台來執行。 3.如果利用上面的命令殺死一個進程後,進程狀態被置為"killed",但是鎖定資源很長時間沒有被釋放,那麼可以在os一級再殺死相應的進程(線程),首先執行下面的語句獲得進程(線程)號: select spid, osuser, s.program from v$session s,v$process p where s.paddr=p.addr and s.sid=24 (24是上面的sid) 4.在OS上殺死這個進程(線程): 1)在unix上,用root身份執行命令: #kill -9 12345(即第3步查詢出的spid) 2)在windows(unix也適用)用orakill殺死線程,orakill是oracle提供的一個可執行命令,文法為: orakill sid thread 其中: sid:表示要殺死的進程屬於的執行個體名 thread:是要殺掉的線程號,即第3步查詢出的spid。 例:c:>orakill orcl 12345 ORA-00031: session marked for kill Cause: The session specified in an ALTER SYSTEM KILL SESSION command cannot be killed immediately (because it is rolling back or blocked on a network operation), but it has been marked for kill. This means it will be killed as soon as possible after its current uninterruptible operation is done. Action: No action is required for the session to be killed, but further executions of the ALTER SYSTEM KILL SESSION command on this session may cause the session to be killed sooner. |