watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=

          subject         part

stay Oracle in , How to kill a specific database session ?

     

          Answer section          

“ALTER SYSTEM KILL SESSION ‘SID,SERIAL#’ IMMEDIATE;” perhaps “ALTER SYSTEM DISCONNECT SESSION ‘SID,SERIAL#’ IMMEDIATE;”.

In general , Can be executed by SQL sentence “ALTER SYSTEM KILL SESSION ‘SID,SERIAL#’” Just kill the conversation . When SESSION yes ACTIVE When ,ALTER SYSTEM KILL SESSION Just to SESSION The status of is marked as KILLED,SERVER Turn into PSEUDO state , But it may not be released immediately SESSION All the resources held , therefore , The execution of the ALTER SYSTEM KILL SESSION after , Conversation still exists (V$SESSION There are , And then OS Processes exist ). therefore , Executing orders KILL SESSION When , It can be followed by IMMEDIATE, So without a transaction , The related session is immediately deleted without becoming KILLED The state of (V$SESSION Does not exist in view ), When there is a transaction , The related transaction will be rolled back first , Then release the resources occupied by the session .

stay Windows It’s also possible to use Oracle Provided orakill Kill a thread ( It’s really just a Oracle process ). stay Linux On , Can be used directly kill -9 Kill the database process corresponding to OS process .