ORA-00054:Oracle查詢被鎖的對象及解決方案

來源:互聯網
上載者:User

一般情況下報ORA-00054時,就很有可能有對象被鎖住了,這個錯誤一般都是“資源正忙, 但指定以 NOWAIT 方式擷取資源, 或者逾時失效”,其解決方案如下:
 
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 'sid,serial#';

一般情況下這樣就解決了鎖對象問題,但有時可能還會產生ORA 00031錯誤“session marked for kill”
 
這說明被鎖的對象長時間沒有被釋放,需要用OS去殺進程
 
1、尋找出鎖對象的進程ID
 
select spid, oSUSEr, s.program
 from v$session s,v$process p
 where s.paddr=p.addr and s.sid=sid(這裡的sid是上面查詢出來的)

2、找到進程後kill -9去殺掉

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.