question

gopalchauhanji avatar image
gopalchauhanji asked

sql server job should rerun automatically because of deadlock reason.

I want sql server job should run max three times if job failed because of deadlock reason. Is there any conditional setting for retry option? what is the best approach to do the same? Thanks, Gopal
sql-server 2014
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
WRBI avatar image
WRBI answered
Hi Gopal, I'm prepared to be corrected, however, I don't know of any way through the GUI to set a re-run conditionally on a deadlock error. It just re-runs on any error - is that a bad thing for you? You could implement a custom retry solution. I.e create a SPROC and put it in another agent job, it could then be set to run after the first job has finished. The sproc could check for run failures and you specify exactly what error your looking for, if it finds that error it can call the job to re-run. It's an option - however - I'd just have my jobs set to re-try all the the time and alert me if there is an issue. However, an even better solution is to work out why that job keeps deadlocking and try to fix that issue! Have a good day!
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.