create or replace procedure KILL_HANGING_SESSIONS as begin
for x in (
select username, osuser, sid, serial#, seconds_in_wait,
event, state, wait_class
from v$session
where username = 'FARHAT'
and seconds_in_wait > 600
-- and event = 'SQL*Net more data from dblink'
) loop
execute immediate 'alter system disconnect session '''|| x.sid
|| ',' || x.serial# || ''' immediate';
dbms_output.put_line( 'Alter session done' );
end loop;
end;
No comments:
Post a Comment