SQL Server Backup – What’s a Good Backup Schedule?

backupsql server

There seems to be a plethora of information regarding the process of setting up backup tasks, but not much information about the big-picture view of database backups. At least, it's hard to formulate a search engine query that gives you that information. I know there are three different types of backups:

  • Full Database Backups
  • Differential Database Backups
  • Transaction Log Backups

It seems I'm supposed to use all three of them. So, is this a schedule that makes sense?

  • 1st of each month — Do a full database backup.
  • Every day at midnight — Do a differential database backup.
  • Every 15 minutes — Do a transaction log backup.

This way, if my database fails on, say, the 12th, I'd just restore the full database backup from the 1st, do the 12 differential backups from the 1st to the 12th, and then finally restore the most recent transaction log (are the transaction logs differential?).

Finally, is a full database backup self-contained? i.e. Once I make a full database backup on February 1st, can I delete all the files from January? Of course, I'd keep a couple previous months' sets around just in case, but the question is conceptual.

Best Answer

As with all things in SQL Server, it depends.

First thing you need to do is make sure you understand what each type of backup does.

Books Online has all the gooey details, but here's my summary.

A FULL backup contains everything within the database. A DIFFERENTIAL backup is cumlative NOT incremental. In your example, if your database failed on the 12th, then you'd only need to restore the full backup from the 1st and then the most recent differential on the 12th, then followed by all the transaction log backups upto the failure. A TRANSACTION LOG backup is only needed for databases using the full or bulk-logged recovery model. If you're using the simple recovery model then transaction log backups are not needed.

Now that we've cleared that up...Designing a backup schedule really depends on how much data you need to recovery and how fast you need to recover it in the event of a diaster. I would recommend starting with a full backup each day. You can always reduce the frequency later. Remember the differential backup is cumlative since the last full, so depending on the amount change going on in your database the differential could be larger than the full backup after a few days. If you do a full backup each day, then you may not need to use differentials at all; however you could still do it once a day and schedule it at 12 noon. The transaction log backup only backs up the log. The frequency of the log backup will determine how much data you're willing to lose in the event of a failure. If you run your log backup every 15 minutes, then you would expect to lose up to the last 15 minutes of data that changed. 15 minutes is a good frequency, but every 30 minutes works perfectly for my environment.

As I said earlier, it all depends on your environment. After you've designed and setup your backup schedule, remember to test it on an alternate server. Practice restoring your full, diff, and log backups so that you know everything works like you designed it.

Books Online has some good info if you plan use Maintenance Plans, but if you really want flexibility then check out Ola Hallengren's backup scripts.