TITLE:ORACLE10G如何用alter system kill session 清除死锁进程
问题描述:用户反馈数据交换终止,查询发现大量的死锁信息
|
SID |
SERIAL# |
USERNAME |
LOGON_TIME |
1 |
1296 |
56221 |
sample |
2010-6-20 11:25:09 |
…… |
解决步骤:
1、 用下面的语句组装生成清除死锁进程的脚本
--杀锁死进程
select Distinct 'alter system kill session '||chr(39)||b.sid||','||b.serial#||chr(39)||';'As 组装语句在RAC执行时区分节点,b.username,b.logon_time
from v$locked_object a,v$session b
where a.session_id=b.sid
order by b.logon_time
执行结果格式如下:
|
组装语句在RAC执行时区分节点 |
USERNAME |
LOGON_TIME |
1 |
alter system kill session '1296,56215'; |
sample |
2010-8-20 11:20:39 |
…… |
2、以sysdba权限登录SQLPLUS 后执行上一步生成的脚本
[root@oracle2 ~]# su - oracle
[oradba@oracle2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on 星期五 6月 20 11:07:47 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> alter system kill session '989,2173';
alter system kill session '1001,26211';
alter system kill session '917,44267';
alter system kill session '929,38284';
……
SQL>
System altered.
SQL>
System altered.
SQL>
System altered.
别忘记最后敲一个回车,否则最后一条语句可能没有执行。
本文转自zylhsy 51CTO博客,原文链接:http://blog.51cto.com/yunlongzheng/380532,如需转载请自行联系原作者