oracle死锁问题怎么解决
查看数据库的alert(SID).log
发现死锁警告:
Fri Dec 10 10:04:19 2010
deadlock detected, reached max # (20) of servers
Fri Dec 10 10:04:19 2010
deadlock detected, reached max # (20) of servers
Fri Dec 10 10:04:25 2010
deadlock detected, reached max # (20) of servers
Fri Dec 10 10:07:11 2010
deadlock detected, reached max # (20) of servers
Fri Dec 10 10:09:05 2010
deadlock detected, reached max # (20) of servers
Fri Dec 10 10:09:06 2010
deadlock detected, reached max # (20) of servers
Fri Dec 10 10:34:09 2010
死锁得造成原因又很多,大部分是由于应用的问题,对系统资源的访问没有正确的顺序,造成
进程双方互相用友对方需要的资源,而出现死锁!
oracle 系统会自动处理死锁问题!
但是有时候可以考虑alter system kill session 杀掉那个会话。
解决方法如下:
SELECT s.username,s.SID,s.SERIAL#,
decode(l.type,''TM'',''TABLE LOCK'',
''TX'',''ROW LOCK'',
NULL) LOCK_LEVEL,
o.owner,o.object_name,o.object_type,
s.sid,s.serial#,s.terminal,s.machine,s.program,s.osuser
FROM v$session s,v$lock l,dba_objects o
WHERE l.sid = s.sid
AND l.id1 = o.object_id(+)
AND s.username is NOT NULL;
根据上面的sql找出 sid 和 serial
alter system kill session ''s.SID,s.SERIAL''