Sunday, April 3, 2016

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

No comments:

Post a Comment