I wanted to have a discussion on an issue that came up with Minion Backup the other day and share the solution with you.
The question came in last week about how to recover from mirrored backups that fail. When the user was taking mirrored backups, sometimes the network that goes to the mirrored location fails, and that kills the backup. First though, let’s have a small talk about what mirrored backups are and when they’re best used.
By mirroring backups, you’re saying that you want to backup to 2 locations simultaneously. So let’s say you have the need to backup your DBs to a local SAN drive, but also you need to send them to another data center in case something happens to your local SAN. The way to do that in SQL is with mirrored backups and the syntax looks like this:
BACKUP DATABASE MyDB TO DISK = ‘G:\MyDB.trn’ MIRROR TO DISK = ‘\\DC1\MyDB.trn’
So above you can see that SQL will write both of these files at once, and give you a good amount of redundancy for your DB backups. However, this can go wrong when your network isn’t stable or when the link to the other data center is slow. So you should only mirror backups when you can pretty much guarantee that it won’t fail or lag. And as you can guess that’s a heavy burden to put on most networks. In the situation last week that spawned this blog, the network went down for something like 9 hrs and caused the DB’s log to not be backed up that entire time, and hence the log grew and grew. Now you’re in danger of bringing prod down and that’s clearly not what your backup strategy should do.
So the original question was, how can I fix this with Minion Backup? Well, MB was specifically designed to help you get around limitations in native SQL backup, and this being one of them. The simple solution is to just not take a mirror backup. Instead, take a regular backup and set MB to copy the files to the other data center after. This way even if the network to the data center goes down for a few hours, you’re still taking your local backups so there’s no danger to prod. The feature itself isn’t called ‘Copy’ though, it’s called ‘File Actions’. The reason is because it does more than just copy. It can also move files if you prefer… or copy and then move. And who knows, maybe there’ll be public outcry for something else and the feature will get expanded. But this is why we called it File Actions instead of simply Copy.
And the next question is, how hard is it to setup MB to copy backups and do I need to create a separate job? The answer is of course, it’s extremely easy, and no you don’t need any extra jobs. Configuring backup copies in MB just takes a couple table entries and it’s very flexible. Here are some of the copy features available:
- Configure with no extra jobs.
- Copy or Move, or Copy and Move.
- Copy to as many locations you like.
- Specify the order of the locations that you copy to.
- Use a different copy utility for each drive if you like.
- Use different copy parameters for each drive if you like.
- Maintain custody chain. That means that MB will still delete the copied files on your schedule.
- Each drive can have its own delete schedule.
- Copy files right after the DB backup finishes or after all DBs on the server are processed.
- Each DB and backup type can have its own location, and still no extra jobs.
Ok, you can see how rich the copy feature in MB is. Now that you know, you can stop mirroring and easily protect yourself with this rich feature. And because I care, you can watch this video tutorial on using the copy feature in Minion Backup. http://midnightdba.itbookworm.com/Video/Watch?VideoId=424
But if you prefer to read it instead, you can go to the docs and just search for File Actions. Or you can go to SSMS on a server that has MB installed and use the built-in docs by running the sp with these parameters: Minion.Help ‘Backup‘, ‘How to: Copy files after backup (single and multiple locations)‘
And to see what other help topics are available, simply call the help sp with just one parameter: Minion.Help ‘Backup‘