Kill all sessions from host in Oracle


/ Published in: PL/SQL
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.