Sql-server – Re-Run Backup Job in SQL Agent

sql-server-2008-r2

My question is regarding re-running backup jobs only for those databases for which the job initially when it ran failed due to some reasons, like server reboot, path not accessible, newly created databases, etc.
In our environment, windows patching happens every month. Due to server reboot at this time, backup job fails. Also, sometimes if user creates a new database then a scheduled differential backup job fails.
Is there any way to run the same job but for only those databases which were not backed up earlier?

Please provide your suggestions

Best Answer

While it depends on how many jobs and your backup methods, one of the simplest options is to have the job use retry attempts and intervals to re-run the job.

You can set the intervals at a high amount to account for a full system reboot and use these jobs specifically during reboot windows. Just go to Job Properties -> Steps -> Advanced

enter image description here

(Job pictured is from Ola Hallengren's scripts which contain great backup jobs)

Include a cleanup step first to remove any backups from recent history (say, 1 hour) that may no longer be valid/desirable and then perform a complete backup. I think this is preferable as it gives you a set of backups all from the same time frame and not staggered depending on when the shutdown occurred.

Really though, you should be able to reliably control and schedule your reboots and thus schedule key backup jobs around that time frame. We all update our boxes (I hope) and work around a set schedule for reboots so as to not have this issue. Stronger change control management might be the true solution if this server is important enough to stay on top of backups.