如果 SQLServer 作业已经在运行,它是否会跳过计划运行?

如果您安排一个 SQLServer 作业每隔 X 分钟运行一次,并且它没有在 # of minutes 到期之前完成上一次调用,那么它是会跳过运行,因为它已经在运行了,还是会运行该作业的两个实例执行相同的步骤?

30649 次浏览

I'm pretty sure it will skip it if it is running.

The SQL Server agent checks whether the job is already running before starting a new iteration. If you have long running job and its schedule comes up, it would be skipped until the next interval.

You can try this for yourself. If you try to start a job that's already running, you will get an error to that effect.

Which version of SQL Server are you using? This seems like a pretty easy thing to test. Set up a job with a WAITFOR in it that inserts a single row into a table and set up the job to run twice in quick succession (shorter than the WAITFOR DELAY).

When running such a test in SQL Server 2005 it skipped the run that was overlapped.