ORACLE中的KILLED SESSION
在Oracle中終止會話
alter system kill session 'sid,serial#';
在用此命令終止會話後,其狀態為killed,資源並沒有回收.
在被使用kill終止的程式paddr發生了變化,不能通過v$session和v$process檢視的關聯來找到spid。參考:http://www.eygle.com/faq/Kill_Session.htm
在最近的一個案例中,有一個程式dllhost.exe,是由於COM+呼叫時未能中斷,
利用alter system kill session 'sid,serial#',其狀態為KILLED,
SQL> col program for a20
SQL> select sid,serial#,program,status from v$session where program ='dllhost.e
xe' and status = 'INACTIVE';
SID SERIAL# PROGRAM STATUS
---------- ---------- -------------------- --------
24 469 dllhost.exe INACTIVE
37 726 dllhost.exe INACTIVE
44 1098 dllhost.exe INACTIVE
56 526 dllhost.exe INACTIVE
61 476 dllhost.exe INACTIVE
79 294 dllhost.exe INACTIVE
80 577 dllhost.exe INACTIVE
90 1552 dllhost.exe INACTIVE
92 732 dllhost.exe INACTIVE
94 757 dllhost.exe INACTIVE
96 1095 dllhost.exe INACTIVE
SID SERIAL# PROGRAM STATUS
---------- ---------- -------------------- --------
97 393 dllhost.exe INACTIVE
98 62 dllhost.exe INACTIVE
102 1487 dllhost.exe INACTIVE
105 682 dllhost.exe INACTIVE
106 521 dllhost.exe INACTIVE
107 852 dllhost.exe INACTIVE
108 730 dllhost.exe INACTIVE
109 976 dllhost.exe INACTIVE
111 137 dllhost.exe INACTIVE
116 1030 dllhost.exe INACTIVE
118 3183 dllhost.exe INACTIVE
SID SERIAL# PROGRAM STATUS
---------- ---------- -------------------- --------
120 432 dllhost.exe INACTIVE
121 366 dllhost.exe INACTIVE
122 1033 dllhost.exe INACTIVE
124 377 dllhost.exe INACTIVE
125 2074 dllhost.exe INACTIVE
126 704 dllhost.exe INACTIVE
131 137 dllhost.exe INACTIVE
133 1073 dllhost.exe INACTIVE
135 963 dllhost.exe INACTIVE
137 401 dllhost.exe INACTIVE
138 488 dllhost.exe INACTIVE
SID SERIAL# PROGRAM STATUS
---------- ---------- -------------------- --------
139 433 dllhost.exe INACTIVE
141 667 dllhost.exe INACTIVE
142 1302 dllhost.exe INACTIVE
147 1029 dllhost.exe INACTIVE
149 1255 dllhost.exe INACTIVE
150 2498 dllhost.exe INACTIVE
152 390 dllhost.exe INACTIVE
154 493 dllhost.exe INACTIVE
155 505 dllhost.exe INACTIVE
156 257 dllhost.exe INACTIVE
159 3371 dllhost.exe INACTIVE
SID SERIAL# PROGRAM STATUS
---------- ---------- -------------------- --------
162 704 dllhost.exe INACTIVE
163 668 dllhost.exe INACTIVE
164 1459 dllhost.exe INACTIVE
165 469 dllhost.exe INACTIVE
168 620 dllhost.exe INACTIVE
169 1437 dllhost.exe INACTIVE
170 57 dllhost.exe INACTIVE
171 638 dllhost.exe INACTIVE
173 935 dllhost.exe INACTIVE
176 389 dllhost.exe INACTIVE
177 359 dllhost.exe INACTIVE
SID SERIAL# PROGRAM STATUS
---------- ---------- -------------------- --------
178 2623 dllhost.exe INACTIVE
179 947 dllhost.exe INACTIVE
180 1255 dllhost.exe INACTIVE
181 1342 dllhost.exe INACTIVE
184 4277 dllhost.exe INACTIVE
60 rows selected.
SQL> select count(*) from v$session where program ='dllhost.exe' and status = 'INACTIVE';
COUNT(*)
----------
60
而後,其KILLED的程式也自動地回收資源
SQL> select count(*) from v$session where status='KILLED';
COUNT(*)
----------
12
SQL> select sid,serial#,program,status from v$session where status='KILLED';
SID SERIAL# PROGRAM STATUS
---------- ---------- -------------------- --------
81 371 dllhost.exe KILLED
84 579 dllhost.exe KILLED
85 547 dllhost.exe KILLED
91 599 dllhost.exe KILLED
100 1147 dllhost.exe KILLED
103 2018 dllhost.exe KILLED
113 1578 dllhost.exe KILLED
117 1190 dllhost.exe KILLED
148 488 dllhost.exe KILLED
174 675 dllhost.exe KILLED
182 1055 dllhost.exe KILLED
SID SERIAL# PROGRAM STATUS
---------- ---------- -------------------- --------
186 1461 dllhost.exe KILLED
12 rows selected.
檢視未能關聯的paddr
SQL> select p.addr from v$process p where pid <> 1
2 minus
3 select s.paddr from v$session s;
ADDR
--------
1E53E22C
1E53E5EC
1E5461AC
1E54746C
1E54782C
1E54926C
1E54A52C
1E54E4EC
1E54F02C
1E54F7AC
查詢未能關聯的spid
select p.spid, p.program, p.addr from v$process p where pid <> 1
and addr not in (select paddr from v$session);
winodows下kill session
orakill sid,spid
linux下kill session
kill -9 spid
問題:COM+怎麼自動終止會話?
kill oralce session參考:http://www.oracle-base.com/articles/misc/KillingOracleSessions.php
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9932141/viewspace-665050/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【Oracle】-【SNIPED和KILLED】-SPINED和KILLED的session清理流程OracleSession
- oracle 什麼時候才回收v$session 中status='KILLED'的程式OracleSession
- Killed Session Are Not Cleaned By PMONSession
- kill session V$SESSION標記為KILLED 的2種情況Session
- SESSION處於KILLED狀態下如何找出對應的程式Session
- Oracle中Kill session的研究OracleSession
- Oracle中Kill session的研究 for oracle -- 轉OracleSession
- Oracle中Kill sessionOracleSession
- Oracle中診斷阻塞的sessionOracleSession
- Oracle V$SESSION中的常用列OracleSession
- 處理Oracle Session中的鎖OracleSession
- oracle中session跟process的研究OracleSession
- 大話Oracle中的kill sessionOracleSession
- Oracle中Kill session [轉]OracleSession
- oracle中的processes,session,transaction引數OracleSession
- Oracle中的Connect、session、process的區別OracleSession
- oracle中的processes,session,transaction引數詳解OracleSession
- 在Oracle中session和process的區別(轉)OracleSession
- 關於oracle中session跟蹤的總結OracleSession
- Oracle中的Session kill不釋放問題OracleSession
- session bean中的session如何理解?SessionBean
- Oracle中診斷阻塞session的方法 blocking errorOracleSessionBloCError
- Oracle 10g中對resumable session的增強Oracle 10gSession
- oracle中引數session和 processes的設定(轉)OracleSession
- 【Oracle】-【v$session】v$session的SNIPED狀態OracleSession
- 輕鬆接觸Oracle資料庫中的Kill sessionOracle資料庫Session
- ORACLE session中SPID、PID、SID的區別OracleSession
- 【新炬網路名師大講堂】Oracle小知識- Oracle KILLED會話的釋放Oracle會話
- Oracle session traceOracleSession
- Oracle kill sessionOracleSession
- ulimit限制導致的 +++ killed by SIGKILL +++MIT
- 快速殺掉Oracle的SessionOracleSession
- v$session中的serverSessionServer
- Oracle 11g中v$session檢視server列的含義OracleSessionServer
- Oracle 會話(Session)Oracle會話Session
- Oracle kill session scriptOracleSession
- ORACLE SESSION 和 PROCESSOracleSession
- oracle_kill_sessionOracleSession