同事在自己机器上用 alter system kill session 'sid, serial#';杀了一个会话。但这个会话只是被标记成killed,并没有真正中断。
问怎么杀掉这个会话。windows中没有unix中的kill命令,我们可以利用orakill来解决这个问题。
SQL> host orakill
Usage: orakill sid thread
where sid = the Oracle instance to target
thread = the thread id of the thread to kill
The thread id should be retrieved from the spid column of a query such as:
select spid, osuser, s.program from
v$process p, v$session s where p.addr=s.paddr
SQL> conn scott/tiger
已连接。
SQL> select * from v$mystat where rownum=1;
SID STATISTIC# VALUE
---------- ---------- ----------
141 0 0
SQL> col spid for a5;
SQL> col osuser for a20;
SQL> col program for a12;
SQL> SELECT SPID, OSUSER, S.PROGRAM, S.SID, S.SERIAL#
2 FROM V$PROCESS P, V$SESSION S
3 WHERE P.ADDR = S.PADDR
4 AND S.SID = 141;
SPID OSUSER PROGRAM SID SERIAL#
------- -------------------------------- ------------------ ---------- ----------
1328 SS-LIANGWEI\Liangwei sqlplus.exe 141 339
SQL> SELECT instance_name FROM v$instance;
INSTANCE_NAME
--------------------------------
lw
SQL> host orakill lw 1328
Kill of thread id 1328 in instance lw successfully signalled.
SQL> SELECT instance_name FROM v$instance;
SELECT instance_name FROM v$instance
*
第 1 行出现错误:
ORA-03113: 通信通道的文件结尾
进程 ID: 1328
会话 ID: 141 序列号: 339