Saturday, May 10, 2014

How to kill a job

DBA_JOBS_Running view provides the list of all jobs that are currently running.

If you run the below SQL as SYS or SYSTEM, You will get the list of all jobs, as well as the remove job and kill session statements.

select j.job,j.log_user,j.schema_user,j.broken,nvl2(r.job,'Running now','Not Running') job_current_status,j.what,
'exec dbms_ijob.remove('||j.job||');' Remove_Job,
'Alter System Kill Session '''||s.sid||','||s.serial#||''';' Kill_Session
from dba_jobs j, dba_jobs_running r, v$session s
where j.job = r.job
and r.sid = s.sid
 


If you kill the session, without removing the job from the job queue, it will reappear after some time. So, remove the job from the queue , and then kill the session





No comments:

Post a Comment