SELECT 'alter system kill session '''|| SE.sid||',' ||SE.serial#||''';',
SE.sid,
SE.serial#,
PR.spid,
SE.status,
SUBSTR(SE.program, 1, 20) PROG,
SUBSTR(SE.machine, 1, 30) MACH,
SQ.sql_text
FROM v$session SE, v$sqlarea SQ, v$process PR
WHERE SE.paddr = PR.ADDR(+)
AND SE.sql_address = SQ.address(+)
AND schemaname <> 'SYS'
ORDER BY SE.sid;