您好,登錄后才能下訂單哦!
下面是測試會話的狀態是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 |
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中更好使啊。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。