首页 > 代码库 > 关于ORA-04021解决办法(timeout occurred while waiting to lock object)

关于ORA-04021解决办法(timeout occurred while waiting to lock object)

某个应用正在锁定该表或者包
表为
select b.SID,b.SERIAL#,c.SQL_TEXT
from v$locked_object a, v$session b, v$sqlarea c
where a.SESSION_ID = b.SID
and b.SQL_ADDRESS = c.ADDRESS
and c.sql_text like %table_name%
包为
select B.SID,b.USERNAME,b.MACHINE FROM V$ACCESS A, V$SESSION B WHERE A.SID=B.SID and a.OBJECT = %PACKAGE_name% and a.TYPE = PACKAGE
找出这个session
然后 kill
alter system kill session sid,serial#