Posted By

kamilch on 08/06/09


Tagged

Oracle


Versions (?)

Kill all sessions from host in Oracle


 / Published in: PL/SQL
 

  1. host_name VARCHAR2(128) = 'hostname';
  2.  
  3. CURSOR host_sessions IS SELECT '' || sid || '' || serial# AS session_id
  4. FROM v$session WHERE machine = host_name ORDER BY sid DESC;
  5. FOR next_row IN host_sessions
  6. EXECUTE IMMEDIATE 'alter system kill session :1 immediate'
  7. using next_row.session_id;
  8. /

Report this snippet  

You need to login to post a comment.