disconnect users [message #115446] |
Mon, 11 April 2005 12:35 |
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 #115450 is a reply to message #115446] |
Mon, 11 April 2005 12:55 |
|
Mahesh Rajendran
Messages: 10708 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;
|
|
|