Oracle 表死結處理 ORA-00054

來源:互聯網
上載者:User

第一步:嘗試在sqlplus中通過sql命令進行刪除,如果能夠刪除成功,則萬事大吉!但通常情況下,出現死結時,想通過命令列或者通過Oracle的管理工具刪除有死結的session,oracle只會將該session標記為killed,但無法清除掉,往往需要通過第二步在作業系統層級進行刪除!
 

Connected to Oracle9i Enterprise Edition Release 9.2.0.1.0
 Connected as quik
 

SQL> select xidusn, object_id, session_id, locked_mode from v$locked_object; --查死結的對象,擷取其SESSION_ID
 

    XIDUSN OBJECT_ID SESSION_ID LOCKED_MODE
 ---------- ---------- ---------- -----------
        10      30724        29          3
        10      30649        29          3
 

SQL> select username,sid,serial# from v$session where sid=29; --根據上步擷取到的sid查看其serial#號
 

USERNAME                              SID    SERIAL#
 ------------------------------ ---------- ----------
 QUIK                                  29      57107
 

SQL> alter system kill session '29,57107'; --刪除進程,如已經刪除過,則會報ora-00031的錯誤;否則oracle會將該session標記為killed狀態,等待一段時間看能否會自動消失,如長時間消失不掉,則需要做後續步驟
 

alter system kill session '29,57107'
 

ORA-00031: session marked for kill
 

SQL> select pro.spid from v$session ses,v$process pro where ses.sid=29 and ses.paddr=pro.addr; --查看spid號,以便在作業系統中根據該進程號刪除進程
 

SPID
 ------------
 2273286

相關文章

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.