通过在command命令行直接使用orakill命令便可得到简单但清晰的实用使用指导。
需要注意的是:“sid”指的是“instance name”,不要被名字误导!C:\>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
2.orakill命令何时用?
1)当手工使用“alter system kill session 'sid,serial#';”命令杀数据库中的session后,会话信息可能还会驻留在数据库中。使用这个orakill命令便可在操作系统一级可以彻底清除之;
2)从操作系统一级直接杀掉某个异常的会话。
3.orakill命令这样用。
sys@secooler> col sid for 9999
sys@secooler> col serial# for 9999
sys@secooler> col spid for 99999
sys@secooler> col OSUSER for a20
sys@secooler> col program for a30
sys@secooler> select s.sid, s.serial#, p.spid, s.osuser, s.program from v$process p, v$session s where p.addr=s.paddr order by s.sid;
SID SERIAL# SPID OSUSER PROGRAM
----- ------- ------- -------------------- --------------------
147 9 2300 BJSECDB\Housw sqlplus.exe
149 2 5904 SYSTEM ORACLE.EXE (q001)
151 2 3096 SYSTEM ORACLE.EXE (q000)
155 9 2884 SYSTEM ORACLE.EXE (QMNC)
158 17 5588 SYSTEM ORACLE.EXE (J000)
159 3 1088 BJSECDB\Housw sqlplus.exe
160 1 4776 SYSTEM ORACLE.EXE (MMNL)
161 1 4308 SYSTEM ORACLE.EXE (MMON)
162 1 3224 SYSTEM ORACLE.EXE (CJQ0)
163 1 5780 SYSTEM ORACLE.EXE (RECO)
164 1 2272 SYSTEM ORACLE.EXE (SMON)
165 1 2804 SYSTEM ORACLE.EXE (CKPT)
166 1 2696 SYSTEM ORACLE.EXE (LGWR)
167 1 4876 SYSTEM ORACLE.EXE (DBW0)
168 1 5668 SYSTEM ORACLE.EXE (MMAN)
169 1 4644 SYSTEM ORACLE.EXE (PSP0)
170 1 1112 SYSTEM ORACLE.EXE (PMON)
17 rows selected.
数据库的实例名字是“secooler”,我们打算杀死SPID是“2300”这个session,那么方法如下:
sys@secooler> host orakill secooler 2300
Kill of thread id 2300 in instance secooler successfully signalled.
You can also use the Windows taskkill utility to remove an Oracle Windows process:
c:>tasklist
oracle.exe 9311 Console 0 5,072 K
c:>taskkill /pid 9311oracle.exe 9311 Console 0 5,072 K
SUCCESS: The process with PID 9311 has been terminated.
沒有留言:
張貼留言