薄雾倾城

导航

ORA-04021:timeout occurred while waiting to lock object

编译某存储过程 ORA-04021 timeout occurred while waiting to lock object stringstringstringstringstring Cause: While waiting to lock a library object, a timeout is occurred. Action: Retry the operation later.

 查找是否有用户类型的锁,即

TM                DML排队

TX                事务处理排队

UL                 用户提供

select * from v$lock where type in ('TM','TX','UL')

结果果然查到有一个sid17,类型为TX的锁,可以断定就是这个锁导致上面的错误

再查相应的sidserial#

select * from v$session where sid=17

杀掉它

alter system kill session '17,36383'

ORA-00031: session marked for kill ,说明已经是被kill一次过的了,session的status为killed

再查操作系统对应的SPID select spid from v$process p,v$session s where s.paddr=p.addr and sid=17

查到是17297

$ kill -9 17297

重新编译,成功了

posted on 2015-02-13 11:37  若菲  阅读(550)  评论(0编辑  收藏  举报