Return to Snippet

Revision: 16494
at August 6, 2009 06:10 by kamilch


Initial Code
declare
    host_name varchar2(128) = 'hostname';
    
    cursor host_sessions is select '' || sid || '' || serial# as session_id
                from v$session where machine = host_name order by sid desc;
begin
    for next_row in host_sessions
    loop
        execute immediate 'alter system kill session :1 immediate'
                           using next_row.session_id;
    end loop;
end;
/

Initial URL

                                

Initial Description

                                

Initial Title
Kill all sessions from host in Oracle

Initial Tags
Oracle

Initial Language
PL/SQL