Home  >  Article  >  Database  >  Oracle教程:Oracle中kill死锁进程

Oracle教程:Oracle中kill死锁进程

WBOY
WBOYOriginal
2016-06-07 15:21:201076browse

Oracle中对于访问频率很高的包,存储过程或者函数,会引起死锁。对于用到了死锁的对象的脚本都会无法运行,造成卡死,或者报异常

Oracle中对于访问频率很高的包,存储过程或者函数,会引起死锁。对于用到了死锁的对象的脚本都会无法运行,造成卡死,或者报异常:打开的连接太多。

这时需要使用dba权限账户去kill掉死锁的对象。

使用

alter system kill session 死锁对象的ID;

执行如下sql,,查找出死锁的ID,并将alter语句拼接好:

select Distinct 'alter system kill session '||chr(39)||b.sid||','||b.serial#||chr(39)||';'As  kill对象sql语句,
b.username,b.logon_time
from v$locked_object a,v$session b
where a.session_id=b.sid
order by b.logon_time;

然后将拼接的语句拿出来执行即可。

本文永久更新链接地址

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn