kill状态为killed的进程

       下面是测试会话的状态是killed的时候,怎么去kill进程,今天在MOS上面看到有官方的文档,原来是自己写的SQL,功能差不多。

 

欢迎大家加入ORACLE超级群:17115662 免费解决各种ORACLE问题,以后BLOG将迁移到http://www.htz.pw

 

1,数据库版本

www.htz.pw > select * from v$version;

 

BANNER

--------------------------------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

PL/SQL Release 11.2.0.4.0 - Production

CORE    11.2.0.4.0      Production

TNS for Linux: Version 11.2.0.4.0 - Production

NLSRTL Version 11.2.0.4.0 - Production

2WIN远程登陆数据库

d:\wendang\SkyDrive\rs2\sql>sqlplus scott/oracle@192.168.188.5/orcl1124

 

SQL*Plus: Release 11.2.0.3.0 Production on 星期四 6 5 16:28:36 2014

 

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL>

3,手动KILL掉会话

www.htz.pw > select sid,serial# from v$session where username='SCOTT';

 

       SID    SERIAL#

---------- ----------

        35         51

 

www.htz.pw > alter system kill session '35,51';

 

System altered.

4,查看会话的状态

www.htz.pw > select status,program,server from v$session where username='SCOTT';

 

STATUS   PROGRAM                                          SERVER

-------- ------------------------------------------------ ---------

KILLED   sqlplus.exe                                      PSEUDO

这里看到SERVER已经变成了pseudo

 

下面是11G之前的方法,不过这里把D000的进程都显示出现了

www.htz.pw > select spid, program from v$process

  2      where program!= 'PSEUDO'

  3      and addr not in (select paddr from v$session)

  4      and addr not in (select paddr from v$bgprocess)

  5      and addr not in (select paddr from v$shared_server);

 

SPID                     PROGRAM

------------------------ ------------------------------------------------

9659                     oracle@orcl9i

7095                     oracle@orcl9i (D000)

下面是11G的方法

www.htz.pw > select 'kill -9 '||spid,program from v$process where addr=(select creator_addr from v$session where status='KILLED');

 

 

SPID                     PROGRAM

------------------------ ------------------------------------------------

9659                     oracle@orcl9i

还是在11G中更好使啊。



     本文转自7343696 51CTO博客,原文链接:http://blog.51cto.com/luoping/1422690,如需转载请自行联系原作者



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值