Home > Software design >  DBMS_JOB.Broken in oracle
DBMS_JOB.Broken in oracle

Time:11-23

Unable to find the replacement for DBMS_JOB.Broken command to make the job broken. Please assist me for the same. Command used in my code is

dbms_job.broken(oracle_job_num, true);

Have done the changes for the below commands which was used in our code.

DBMS_JOB.SUBMIT -> DBMS_SCHEDULER.CREATE_JOB
DBMS_JOB.REMOVE -> DBMS_SCHEDULER.DROP_JOB

CodePudding user response:

I don’t think there is a specific api to mark a job as broken in dbms_scheduler but there is one to enable it again:

DBMS_SCHEDULER.enable(name=>'test_job');

There is an api to change after how many failures a job will be disabled:

DBMS_SCHEDULER.set_attribute (name=>'test_job', attribute=>'max_failures',value=>3);

CodePudding user response:

Use DBMS_SCHEDULER.DISABLE('JOB_NAME') and DBMS_SCHEDULER.ENABLE('JOBNAME') instead of DBMS_JOB.BROKEN(ORACLE_JOB_NUM, TRUE) and DBMS_JOB.BROKEN(ORACLE_JOB_NUM, FALSE). The "broken" and "enabled" functionality are not exactly the same, because DBMS_JOBS automatically breaks jobs after 16 failures, whereas DBMS_SCHEDULER does not. But if you're just using BROKEN to manually disable and enable, then the behavior should be close enough.

  • Related