How to delete jobs from MGMT_JOB in oracle?

725 Views Asked by At

I created two jobs through Enterprise Manager. Now I want to delete these jobs. I am trying delete jobs with this query but getting error

set linesize 300;
column job_name format a50;
column job_owner format a30;

select job_id, job_name, job_owner from mgmt_job;

exec mgmt_job_engine.stop_all_executions_with_id('8DDA2C82912B6C9FE050A8C035641D49',TRUE);

PL/SQL procedure successfully completed.

commit;

exec mgmt_job_engine.delete_job('8DDA2C82912B6C9FE050A8C035641D49');

ERROR at line 1:
ORA-20414: The specified job has active executions.
ORA-06512: at "SYSMAN.MGMT_JOB_ENGINE", line 4490
ORA-06512: at "SYSMAN.MGMT_JOB_ENGINE", line 5183
ORA-06512: at line 1

How to solve this problem Thanks

1

There are 1 best solutions below

0
Ramiz Tariq On

I solved my problem with this query

UPDATE mgmt_job_exec_summary SET status = 8, end_time = (sysdate-1) WHERE job_id = '8DDA2C82912B6C9FE050A8C035641D49';

commit;

Then again execute this query

exec mgmt_job_engine.delete_job('8DDA2C82912B6C9FE050A8C035641D49');

commit;