Skip navigation

Understanding Schedules and Long-Running Jobs

What happens when a scheduled job runs longer than the scheduled interval time period? For example, if a job is scheduled to execute every 10 minutes and takes 35 minutes to complete, does the job execute again while it's still running?

On the SQL Server Most Valuable Professional (MVP) newsgroup, a private forum for SQL Server MVPs, Microsoft published two design facts about the SQL Server Agent that can help answer this question. First, the SQL Server Agent runs only one instance of a job at a time. Second, the SQL Server Agent calculates the Next Run Date at the end of the job. So, if a job execution takes longer than its scheduled interval, the job will rerun at the next recurrence point. For example, imagine that Job A is scheduled with a 1-minute recurrence interval. Job A starts at 1:25 p.m. and runs for 1 minute 45 seconds. Job A is still running at 1:26, when the next scheduled recurrence should happen, and the SQL Server Agent will run only one instance of a job at a time—so nothing happens at 1:26 p.m. When Job A ends at 1:26:45 p.m., the SQL Server Agent resets the Next Run Date. Based on the specified 1-minute recurrence interval, the next time the job will run is 1:27 p.m.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish