189 8069 5689

kill状态为killed的进程

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

坚守“ 做人真诚 · 做事靠谱 · 口碑至上 · 高效敬业 ”的价值观,专业网站建设服务10余年为成都PVC花箱小微创业公司专业提供成都企业网站定制营销网站建设商城网站建设手机网站建设小程序网站建设网站改版,从内容策划、视觉设计、底层架构、网页布局、功能开发迭代于一体的高端网站建设服务。

 

欢迎大家加入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

2,WIN远程登陆数据库

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中更好使啊。


新闻标题:kill状态为killed的进程
URL标题:http://cdxtjz.cn/article/pecpcc.html

其他资讯