SQL Server 代理作业超时
我刚刚有一个计划的 SQL Server 作业运行时间比正常情况要长,我真的可以通过设置超时来在一定时间长度后停止它。
我可能对此有点盲目,但我似乎找不到一种为作业设置超时的方法。有谁知道该怎么做?
谢谢
I have just had a scheduled SQL Server job run for longer than normal, and I could really have done with having set a timeout to stop it after a certain length of time.
I might be being a bit blind on this, but I can't seem to find a way of setting a timeout for a job. Does anyone know the way to do it?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们做了类似下面的代码作为夜间作业处理子系统的一部分 - 它比现实中的实际情况更复杂;例如,我们正在处理多个相互依赖的作业集,并从配置表中读取作业名称和超时值 - 但这捕获了这个想法:
We do something like the code below as part of a nightly job processing subsystem - it is more complicated than this actually in reality; for example we are processing multiple interdependent sets of jobs, and read in job names and timeout values from configuration tables - but this captures the idea:
这是一份什么样的工作?您可能需要考虑将整个作业放入 While 循环内的 TSQL 脚本中。要检查的条件显然是当前时间和作业开始时间之间的时间差。
拉吉
What kind of a job is this? You may want to consider putting the whole job in a TSQL script within a While loop. The condition to check would obviously be the time difference between current time and job start time.
Raj