kill狀態爲killed的進程

       下面是測試會話的狀態是killed的時候,怎麼去kill進程,今天在MOS上面看到有官方的文檔,原來是本身寫的SQL,功能差很少。sql

 

歡迎你們加入ORACLE超級羣:17115662 免費解決各類ORACLE問題,之後BLOG將遷移到http://www.htz.pw數據庫

 

1,數據庫版本session

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

 

BANNERide

--------------------------------------------------------------------------------測試

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

PL/SQL Release 11.2.0.4.0 - Productionserver

CORE    11.2.0.4.0      Production進程

TNS for Linux: Version 11.2.0.4.0 - Productionci

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

相關文章
相關標籤/搜索