how to solve oracle ORA-00031: session marked for kill

resource busy output message when dropping a table

SQL> /
DROP TABLE MGR.PFS_CRT_INV_SAVE_DT_C_TMP_202109 PURGE
               *
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

Find the locked object and try to kill the session

SQL> select b.owner, b.object_name, a.session_id, a.locked_mode from v$locked_object a,dba_objects b where b.object_id = a.object_id;

OWNER           OBJECT_NAME                         SESSION_ID LOCKED_MODE
--------------- ----------------------------------- ---------- -----------
...
MGR             PFS_CRT_INV_SAVE_DT_C_TMP_202109           985           4
...

SQL> select serial#, sid, username from v$session where sid = 985;

   SERIAL#        SID USERNAME
---------- ---------- ---------
     39888        985 SYS

SQL> alter system kill session '985,39888' immediate;
alter system kill session '985,39888' immediate
*
ERROR at line 1:
ORA-00031: session marked for kill

query os spid and kill os pid on host

SQL> SELECT S.USERNAME,S.OSUSER,S.SID,S.SERIAL#,P.SPID FROM V$SESSION S,V$PROCESS P WHERE S.PADDR=P.ADDR AND S.USERNAME IS NOT NULL AND S.SID = 985;

USERNAME        OSUSER        SID    SERIAL# SPID
--------------- --------- ------- ---------- ------------
SYS             oracle        985      39888 637968

[oracle@db4a all_dmp]$ kill -9 637968

張貼留言

0 留言