Thursday, October 7, 2010

Kill sessions in Oracle

  • ALTER SYSTEM KILL SESSION 'sid,serial#';
It marks the session as 'killed' in v$session. When client session tries to issue more commands like commit, DMLs, error "ORA-00028: your session has been killed" returned. Then the session is rolled back and removed from v$session
  • ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;
The session is rolled back and removed from v$session immediately. When client session tries to issue more commands like commit, DMLs, error "ORA-03113: end-of-file on communication channel" returned.

  • ALTER SYSTEM DISCONNECT SESSION 'sid,serial#' POST_TRANSACTION;
It waits for the client session to finish the transactions and commit. Once committed, when client session tries to issue more commands like DMLs, error "ORA-00028: your session has been killed" returned. Then the session is removed from v$session. There is no rollback as the session has committed.

No comments:

Post a Comment