SQL Agent’s 5 Second Rule

Ewald Cress uncovers a change in the way the SQL Agent scheduler works in SQL Server 2016 compared to prior versions:

Upon completion of a job, the next run time is calculated based on the last scheduled time plus the schedule interval. However, allowance is made for the edge cases where the completed invocation overruns into the next start time. In such a situation, there isn’t a “catch-up” run; instead, the schedule is advanced iteratively until it reaches a future point in time.

However, 2016 introduces a new twist. When applying the “is the proposed next schedule time after Now()?” check, it adds five seconds to Now(). In other words, the question becomes “Is the proposed next schedule time more than five seconds in the future?”

Ewald jumps into the debugger to understand this better, so click through for that.

Related Posts

Replacing SQL Agent In Azure

Bob Rubocki has some Q&A regarding automating in Azure the types of things you’d normally run SQL Agent jobs for: Q: Is there any way to handle the execution of SSIS packages stored locally? A: Azure Automation works on Azure resources.  It cannot be used for executing local SSIS packages. In some cases, you may still […]

Read More

Connecting To Linux SQL Agent Using Powershell

Slava Murygin shows how to connect to a SQL Agent running on Linux using the SqlServer Powershell module: From this point we will work directly with SQL Server. In order to establish connection you have to run following script. The most important are 2nd and third lines: – In second line you have to provide […]

Read More

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories

April 2017
MTWTFSS
« Mar  
 12
3456789
10111213141516
17181920212223
24252627282930