-- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Author       : Sameer S Choudhari
-- Description  : Kill specified instance oracle sessions for a user in RAC
-- Call Syntax  : @kill_user_sessions_rac_nodewise.sql
-- Last Modified: 20/12/2015
-- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SET LINES 200 PAGES 49999
COLUMN kill_user_sessions FORMAT a60
SELECT 'alter system kill session ''' ||sid ||',' ||serial# ||',' ||'@' ||inst_id ||''' immediate;' kill_user_sessions
FROM gv$session
WHERE username='&username'
  AND inst_id='&inst_id'
ORDER BY
  inst_id,
  sid,
  serial#;