How to backup only specific days each month on SQL Server (I use both SQL Server 2005 and 2008) using a maintenance plan or Agent job. I mean by that to backup my databases from 28th of each month to 08th of the next month and so on?
This will be tough to do with the built-in schedule UI, unless you want to create 12 different schedules, but you can easily build this into your job step. Assuming it runs every night:
IF DAY(GETDATE()) <= 8 OR DAY(GETDATE()) >= 28 BEGIN -- do backups END
On other days (9th -> 27th), the job will still run, but everything inside the
IF conditional will not. So other than having an entry in
sysjobhistory, it will be as if it didn't run at all.
Another idea would be to have a different job that runs every morning, checks the date in a similar way, then enables / disables the backup job accordingly. Or similarly with two schedules (one on the 9th to disable, and one on the 28th to enable).