加载中…
  
博文
标签:

随笔/感悟

分类: Oracle Study
 死锁描述:
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.

用如下sql脚本查找造成死锁的session
(To find out who is blocking you, run the query in another session while you're compiling.
Kill the offending session, and your complilation should go through.):

SELECT sid, DECODE( block, 0, 'NO', 'YES' ) BLOCKER,
DECODE( request, 0, 'NO', 'YES' ) WAITER, id1, id2, lmode /* 6 is exclusive lock. For others, refer to SV10 */
FROM v$lock
WHERE request > 0 OR block > 0
ORDER BY block DESC
/

用如下sql脚本查找该session锁定的对象(To find out what objects is being hold):

SELECT b.object_name,
decode( a.locked_mode,
0, 'None', /* Mon Lock equivalent */
1, 'Null', /* N */
2, 'Row-S (SS)', /* L */
3,
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有