Home » RDBMS Server » Server Administration » Kill many session (Oracle 10G / Windows)
Kill many session [message #515214] Fri, 08 July 2011 11:49 Go to next message
Karlia
Messages: 40
Registered: May 2011
Location: Algiers
Member
Hi every body,

I want to know if it's possible , in the syntax of :

ALTER SYSTEM KILL SESSION ...

to specify a group of sessions, such as all sessions belonging to a particular user,

for example

ALTER SYSTEM KILL SESSION ... WHERE USERNAME='SCOTT';
or some thing like this.


Thanks
Re: Kill many session [message #515215 is a reply to message #515214] Fri, 08 July 2011 12:05 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>to specify a group of sessions, such as all sessions belonging to a particular user,
not directly

conn / as sysdba

set heading off
set termout off
set verify off
set echo off
set feedback off

ALTER SYSTEM enable restricted session;

ALTER SYSTEM checkpoint global;

spool kill_all.sql

SELECT 'execute kill_session('|| chr(39) || sid || chr(39) || ',' || chr(39) || serial# || chr(39) || ');'
FROM gv_$session
WHERE (username = 'SCOTT');

spool off

@kill_all
Re: Kill many session [message #515217 is a reply to message #515215] Fri, 08 July 2011 12:37 Go to previous messageGo to next message
Michel Cadot
Messages: 68647
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
or rather:
connect system/manager
set heading off
set termout off
set verify off
set echo off
set feedback off
spool kill_scott.sql
SELECT 'alter system kill session '''|| sid || ',' || serial# || ''';'
FROM v$session
WHERE username = 'SCOTT';
spool off
@kill_scott


Regards
Michel
Re: Kill many session [message #515225 is a reply to message #515217] Fri, 08 July 2011 15:37 Go to previous messageGo to next message
Karlia
Messages: 40
Registered: May 2011
Location: Algiers
Member
Thank you , BlackSwan, Michel Cadot
So, I understand that there is no way to do it without scripts ? I mean trough just a single SQL statement ?
Re: Kill many session [message #515234 is a reply to message #515225] Sat, 09 July 2011 00:08 Go to previous messageGo to next message
Michel Cadot
Messages: 68647
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You understand well.

Regards
Michel
Re: Kill many session [message #515297 is a reply to message #515214] Sun, 10 July 2011 04:33 Go to previous message
Karlia
Messages: 40
Registered: May 2011
Location: Algiers
Member
Thanks a lot,
Previous Topic: Drawback of DBMS_PIPE
Next Topic: can't change the parameters resource_manager_plan
Goto Forum:
  


Current Time: Sat Apr 27 13:35:04 CDT 2024