Home » RDBMS Server » Server Administration » disconnect users
disconnect users [message #115446] Mon, 11 April 2005 12:35 Go to next message
m_scandroglio
Messages: 26
Registered: March 2005
Junior Member
hi all!
I have to disconnect a user from all his sessions, how can I do?
I'd like a command like.."disconnect scott all sessions..."...so I have not to read the session table to kill the session ....

thanks
Re: disconnect users [message #115448 is a reply to message #115446] Mon, 11 April 2005 12:42 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
unfortunately it is the only way (alter system kill session ).

a simple pl/sql coding might help( to fetch all sessions of aparticular user, kill all sessions using execute immediate).



Re: disconnect users [message #115450 is a reply to message #115446] Mon, 11 April 2005 12:55 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Something like this.
Please change the code to fit yours
mag@mutation_mutation > exec kill_allsession('MAG');
Alter System kill session(9,39974);
Alter System kill session(15,2111);
Alter System kill session(16,8);

PL/SQL procedure successfully completed.

mag@mutation_mutation > get kill
  1   create or replace procedure kill_allsession (p_username in varchar2)
  2   as
  3   cursor c1 is select sid,serial# from v$session where username=p_username;
  4   begin
  5   for mag in c1 loop
  6     exit when c1%notfound;
  7     DBMS_OUTPUT.PUT_LINE ('Alter System kill session('||mag.sid||','||mag.serial#||');');
  8  end loop;
  9* end;
Previous Topic: the error during using logminer to analyze logfile
Next Topic: CPU allocation per user
Goto Forum:
  


Current Time: Fri Sep 27 02:28:08 CDT 2024