Hi, I am using DBMS_JOB for the first time. I created a DBMS_JOB. This job is runs everyday at 6 AM. This job executes INSERT INTO SELECT FROM .
When this job ran at 6 AM, it failed because insert statements failed with primary key constraint. Since this run failed, its trying repeatedly after random duration. Is there any way we can stop executing this job repeatedly?
...it failed because insert statements failed with primary key constraint... Is there any way we can stop executing this job repeatedly?
It is clear the reason the job is failing has nothing to do with DBMS_JOB, procedure is trying to insert a row with a duplicate PK value.
As per your question ... I'm pretty sure the job is executed as it was scheduled, if you want a different schedule... just change the schedule or set the job flag as broken which will cause the job not to be executed.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
- If this job is failed to run because of any reason, it should not be run again.
- I want the job to be run at specified period ONLY without any automatic retries in case of failures.
By design DBMS_JOBS would retry any failed job after 1 minute, 2 minutes, 4 minutes... etc until it reachs 16 failed retries. At this point in time DBMS_JOBS gaves up and marks the job as "broken".
I would intercept the failure in an EXCEPTIONS section, there you could...
1- Send an email, page or whatever alter you have in place to the person or team that can do something about it.
2- Set the job as "broken" so DBMS_JOBS wouldn't try again.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Bookmarks