Home > Database > Mysql Tutorial > body text

Oracle进程无法KILL处理方案

WBOY
Release: 2016-06-07 17:04:58
Original
1189 people have browsed it

ORACLE进程被KILL之后,状态被置为quot;KILLEDquot;,但是锁定的资源长时间不释放,会出现类似下面这样的错误提示:ORA-00030:

Oracle进程被KILL之后,状态被置为"KILLED",但是锁定的资源长时间不释放,会出现类似下面这样的错误提示:

ORA-00030: User session ID does not exist

ORA-00031: session marked for kill

以往大多都是通过重启数据库的方式来强行释放锁资源。
现提供另一种方式解决该问题,在ORACLE中KILL不掉,在OS系统中再杀,,操作方式如下:

1. 查看哪些对象被锁
SELECT DISTINCT t2.username,t2.sid,t2.serial#,t2.logon_time
from v$locked_object t1,v$session t2
where t1.session_id=t2.sid order by t2.logon_time;

2.查看对应执行的是哪一个SQL语句(会提示输入SID参数,就是上一步查询出来 的SID)
select sql_text from v$session a,v$sqltext_with_newlines b
  where DECODE(a.sql_hash_value, 0, prev_hash_value, sql_hash_value)=b.hash_value
  and a.sid=&sid order by piece;


3.杀死对应的进程(上述的sid与serial#参数传入)
  alter system kill session 'sid,serial#';

上述步骤完成之后,若还是无法释放对应的资源,进行下一步操作:

4. 取得语句的进程号
select spid,oSUSEr,s.program from v$session s,v$process p
where s.paddr=p.addr and s.sid=&sid;

5.在OS级别中杀死该进程
a. unix系统,以root身份执行以下命令
 # kill -9 &spid(即第4步查询出来的进程号spid)
 b. windows系统,用orakill命令执行
语法为:orakill  sid thread
sid: oracle实例名
thread 线程号,即第4步中的spid
eg: c:> orakill orcl 12345

上述直至第4步,都是在oracle中执行的,第5步是在操作系统(服务端,非客户端)中执行的

linux

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!