RE: PL/sql example

RE: PL/sql example

 

  

begin
for rec in (
select sid,serial#
from sys.v_$session
where schemaname <> 'SYS'
and audsid <> sys_context('USERENV','SESSIONID')
)
loop
dbms_output.put_line('alter system kill session
'||chr(39)||rec.sid||','||rec.serial#||chr(39)||';');
execute immediate 'alter system kill session
'||chr(39)||rec.sid||','||rec.serial#||chr(39);
end loop;
end;
/

-----Original Message-----
From: James Oddo
[mailto:oracledba-ezmlmshield-x91416810.[Email address protected]
Sent: Thursday, March 31, 2005 8:48 AM
To: LazyDBA Discussion
Subject: PL/sql example


Does any one have an example of a pl/sql block that will query connected
sessions place the sid and serial # in a cursor then loop thru cursor
and perform a alter system kill session.........

Just trying to drop a user that holds a connection to DB from
application and automate the process

Thnaks all!!!!


--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html

Oracle LazyDBA home page