Tech and travel

Killing an Oracle session

2007-09-26

Every time you log into Oracle, you create a session. This is an easy way to kill these Oracle sessions, thanks to this article.

First, select the session ID and serial number as such :

SELECT s.sid, s.serial#, s.osuser, s.program
  FROM v$session s;

The osuser and program field can be used to identify the session.

Then you can kill the session using :

ALTER SYSTEM KILL SESSION 'sid,serial#';

It’s also possible to kill the session immediately (but that’s considered rude) :

ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;

Copyright (c) 2024 Michel Hollands