SQL Agent Recurring Schedule End Event

  • What actually causes a SQL Agent job to run for the last time within the daily frequency settings?

    I ask this because I have a daily job that does not always start. It is scheduled to run daily starting at 3:30 PM, repeat every 6 hrs, ending at 10:00 AM. That was intended to cause four executions during an 18 hour period (3:30 PM, 9:30 PM, 3:30 AM and 9:30 AM). Start time of 3:30 PM was selected because it is before SOD at the most Eastern site.

    I have stopped that job and replaced it today with a similar job staring at 3:30 AM and ending at 10:00 PM, to see if midnight crossing is a problem. However, I have several other jobs that cross midnight without a problem and am wondering if the issue is interference between starting at, occurs every and ending at arguments.

    The one difference I see with the job that does not always start is the daily starting time and the first repetition past the ending time are the same. I am wondering if reoccurrences do not end until the first repetition time after the ending time.

    If I continue to experience missed starts, my next attempt will be to change the occurrence to ever 5 hrs and 45 minutes. That will provide a one hour gap between the first occurrence following ending time and the next start time.

  • AFAIK if the job is already running, it will not start again. If you need this behaviour you have to write a service on your own.

    Greetz
    Query Shepherd

  • Yes, I know a job won't start when it is already running. That is why I asked “when does a SQL Agent job with multiple occurrences end”.

    The single job I constructed should have worked, provided SQL Agent detected the fourth occurrence should be the last and ended the job at that point in time. My guess is that the job does not end until the first occurrence after the ending time.

    On 2/12, I replaced the original job with two jobs, one AM and one PM job. These jobs have worked so far and I think will solve the problem.

  • cant you just simply create 2 schedules, 1 for the PM hours and 2nd for the AM hours. each one of them can have its own occurs overy 'x' hours, starting and its time and ending at another time.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply