温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

kill状态为killed的进程

发布时间:2020-09-19 12:59:08 来源:网络 阅读:3797 作者:7343696 栏目:关系型数据库

       下面是测试会话的状态是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中更好使啊。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI