How to detect and kill long running processes in Oracle
To get a list of long running processes/sessions:
SELECT sid,opname,sofar,totalwork,units,elapsed_seconds,time_remaining
FROM v$session_longops
--WHERE sofar != totalwork;
orderby ELAPSED_SECONDS DESC
To view all sessions:
select *
from v$session s
orderbysid;
To kill a session:
ALTER SYSTEM KILL SESSION 'sid,serial#';
(where sid and serial no are taken from the data shown in the script above.