select SID, SERIAL#, USERNAME, LAST_CALL_ET/86400 from v$session where upper(program) like upper('%SQL%') and STATUS = 'INACTIVE' and LAST_CALL_ET/86400 > 1 and PREV_SQL_ID='204qjzdg14182' order by 3;
select 'ALTER SYSTEM KILL SESSION '''||SID||','||SERIAL#||',@'||inst_id||''' IMMEDIATE;' from gv$session where username='XXXX';
select 'ALTER SYSTEM KILL SESSION '''||SID||','||SERIAL#||',@'||inst_id||''' IMMEDIATE;' from gv$session where SQL_ID IN (SELECT SQL_ID FROM V$SQL WHERE SQL_TEXT LIKE '%PARTE DO SQL%' AND SQL_TEXT NOT LIKE '%ALTER SYSTEM KILL SESSION%');