Home > Database Script, Kill all oracle sessions > Kill all oracle sessions

Kill all oracle sessions

rem ##################################################################
rem Filename:   kill_all_oracle_sessions.sql
rem Purpose:    Kill all oracle sessions for a user
rem Date:       23-Feb-2011
rem Author:     Tamim Khan (Email: tamimdba@gmail.com)
rem ##################################################################

set pagesize 0
spool kill_all.sql
select 'alter system kill session '''||sess.sid||', '||sess.serial#||''';' from v$session sess where username = '<User Name>';
spool off
spool kill_all.log
@kill_all.sql
spool off

To run the script connect oracle as a system user then run the file kill_all_oracle_sessions.sql

@kill_all_oracle_sessions.sql
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: