oracle被锁住后的处理方式,错误Code:ora-00054

时间:2022-07-15 07:31:50

oracle之报错:ORA-00054: 资源正忙,要求指定 NOWAIT


SQL> drop table student2;

drop table student2

ORA-00054: 资源正忙, 但指定以 NOWAIT 方式获取资源, 或者超时失效
=========================================================

解决方法如下:

=========================================================

SQL> select session_id from v$locked_object;

SESSION_ID
----------
142

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

SID SERIAL# USERNAME OSUSER
---------- ---------- ------------------------------ ------------------------------
142 38 SCOTT LILWEN

SQL> alter system kill session '142,38';


一般情况下用:alter system kill session 'sid,serial#'都可以处理,但是如果在搓澡的过程中又遇到了killed的状态的时候


SQL>select a.spid,b.sid,b.serial#,b.username from v$process a,v$session b where a.addr=b.paddr and b.status='KILLED' 


那么解决方式:

alter system kill session 'sid,serial#'的后面加上immediate

SQL> ALTER SYSTEM KILL SESSION '142,38' immediate;