SELECT 'alter system kill session '''||s.sid||','||s.serial#||''';',s.sid,s.serial#,s.username,s.schemaname,s.osuser,s.process,s.machine,s.terminal,s.logon_time,l.type FROM v$session s,v$lock l WHERE s.sid = l.sid AND s.username IS NOT NULL ORDER BY sid;