Name

orakill

Use orakill to kill Oracle sessions from the operating system prompt. This utility is available on Windows operating systems only. It is similar to the kill −9 command on Unix platforms. Unlike on Unix, Oracle on Windows does not use Unix-like processes; instead, it uses threads. orakill enables you to kill a thread corresponding to an Oracle session.

Syntax

orakill SID OS_PID

Parameters

SID

Specifies the target Oracle instance.

OS_PID

Identifies the operating system process to be killed. The operating system process ID for an Oracle session can be identified by querying the V$PROCESS and V$SESSION data dictionary views.

Examples

The following example illustrates the usage of orakill to kill an Oracle session. First, query the data dictionary views to obtain the operating system PID of the session you want to kill:

SELECT p.SPID, s.OSUSER, s.PROGRAM
FROM V$PROCESS p JOIN V$SESSION s
ON p.ADDR= s.PADDR
WHERE s.USERNAME IS NOT NULL;

SPID  OSUSER               PROGRAM
----- -------------------- -------------
1328  MISHRA\sanjay        sqlplus.exe
1788  MISHRA\sanjay        java.exe
2008  MISHRA\sanjay        sqlplusw.exe
2228  MISHRA\sanjay        sqlplusw.exe

Once you’ve gotten the PID, pass it to orakill to kill the session:

D:\>orakill SANDBOX 1328
Kill of thread id 1328 in instance SANDBOX successfully signalled.

Get Oracle Utilities Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.