

If the marked session persists for some time you may consider killing the process at the operating system level. This does not affect the work performed by the command, but it returns control back to the current session immediately, rather than waiting for confirmation of the kill. SQL> ALTER SYSTEM KILL SESSION ‘sid,serial#’ IMMEDIATE In addition to the syntax described above, you can add the IMMEDIATE clause. It will then be killed as soon as possible.

In these cases the session will have a status of “marked for kill”. In some situations, like waiting for a reply from a remote database or rolling back transactions, the session will not kill itself immediately and will wait for the current operation to complete. It merely asks the session to kill itself. SQL> ALTER SYSTEM KILL SESSION KILL SESSION command doesn’t actually kill the session. This allows you to kill a session on different RAC node. In a RAC environment, you optionally specify the INST_ID, shown when querying the GV$SESSION view. SQL> ALTER SYSTEM KILL SESSION ‘sid,serial#’ The basic syntax for killing a session is shown below. The SID and SERIAL# values of the relevant session can then be substituted into the commands in the following sections. INST_ID SID SERIAL# SPID USERNAME PROGRAM JOIN gv$process p ON p.addr = s.paddr AND p.inst_id = s.inst_id Identify the offending session using the V$SESSION and V$PROCESS views as follows. If you kill a session belonging to a background process you will cause an instance crash. Killing sessions can be very destructive if you kill the wrong session, so be very careful when identifying the session to be killed.
