Thanks for the question, Hariharan.
Asked: August 07, 2017 - 8:03 pm UTC
Answered by: Connor McDonald - Last updated: July 25, 2019 - 2:55 am UTC
Category: Database Administration - Version: 18.104.22.168
Viewed 1000+ times
Although they had set the max job duration to 240 minutes/4 hours, the Oracle Scheduler job continue to run for more than 15 hours until they killed it. How could we get this job to stop once past the max job duration?
I had already set that via Oracle Scheduler on OEM. It's showing in the dba_scheduler_jobs but it doesn't stop the job. Hence, why it doesn't stop the job.
start_date=>TO_TIMESTAMP_TZ('20-JUN-2017 12.00.00.000000000 AM AMERICA/NEW_YORK'
,'DD-MON-RRRR HH.MI.SSXFF AM TZR','NLS_DATE_LANGUAGE=english'), repeat_interval=
job_class=>'"DEFAULT_JOB_CLASS"', enabled=>FALSE, auto_drop=>FALSE,comments=>
and we said...
From the docs:"max_run_duration
This attribute specifies the maximum amount of time that the job should be allowed to run. Its datatype is INTERVAL DAY TO SECOND. If this attribute is set to a non-zero and non-NULL value, and job duration exceeds this value, the Scheduler raises an event of type JOB_OVER_MAX_DUR. It is then up to your event handler to decide whether or not to allow the job to continue."
So all we are doing is monitoring the job, and raising the job_over_max_dur event when it goes to long. You could create a job that responds to this event to take whatever action you'd like to do, eg
begin dbms_scheduler.add_event_queue_subscriber('myagent'); end;
job_action=>'...appropriate killing behaviour...',
'tab.user_data.object_name = ''GATHERSTATS_OSMCORE_SCHEMA'' and
tab.user_data.event_type = ''JOB_OVER_MAX_DUR''',
and you rated our response
Is this answer out of date? If it is, please let us know via a Review