Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
We have all these great features of SQL Server to keep our data fast and clean. We've got constraints for integrity, transactions, indexes, but at the end of the day all these databases are being stored on files on a hard drive and hard drives break. So even if you've created your database files on a nice RAID 10 unit, you still need to be it backing up and backing up regularly. Or we can do this using SQL Server Management Studio or even just SQL commands. We can get this going.
We backup one database at a time. So open up the databases, select the one you're interested in, not that it really matters, and come down to tasks where you'll find an entry for backup. I select that. The reason why I say it doesn't matter which database you right-click on is because the first question you get in the backup window is which database you're interested in backing up. Most of the time for a straightforward situation, you're going to keep the default values. Really the only choice you're interested in here is this backup type. Is it full or is it deferential? And in fact the first time through the only option you'll be able to do is a full backup.
After you've done one full backup, you can select to do a differential one, which will be smaller in size, because it's essentially the changes between your last full backup and the state of the database right now. The reason that SQL Server is able to do this is because it keeps track of the different backups that you've done. It likes to understand when you did your full backups, when you did your differentials, and one of the impacts of that, I mean that if you're selecting a full backup, you also have this option here to do what's called a Copy Only Backup, which really detaches from the main chain of backups, creating a self-contained one.
You'll notice that you're not able to do a copy only backup when it's differential, because you haven't got anything to make a difference on. So we're going to do a full backup. It's not a copy only, And backing up the database. We can give it a name. I'll accept the default here. There is an expiration option here that the backup set will expire after certain amount of days. If it's zero that just means it won't expire at all. Now this section down here, the destination, this can trick people and trip people up. I've known several people that have been bitten by this.
This is the default location that your backups will go to. It's actually just the path that SQL Server is installed at and we've got a Backup\AdventureWorksLT. bak file. Okay, that's fine. But people see this button. They can click Add and it gives them the ability to add a new path or add a new destination on disk. That looks all right. Here's the issue. If you do this and you can add multiple locations in here to back out to, but it does not copy the backup and duplicate it from place-to-place.
What it will do is almost like a basic RAID pan that will split up the backup across multiple files. Now that means it can be faster, which is a good thing, but it means if you have multiple locations and you have a need to do a restore, you have to get the backup files from every location. So this is not a redundancy option. It's just a speed one. I'm going to click over here on the left to the Options page. Now I've already done a couple of backups, both full and differential, and it's asking me here, do I want to back up to the existing backup set? And yes I do. I'm continuing it but I do have the options where I could say back up to a new media set or overwrite all the old ones.
I do have some options here to verify the backup when finished. Yup, I think I'll do that. Click back to the General page and I'm just going to go for it. Click OK. This is a fairly small database. So it's a pretty quick job, but obviously if you have lots of rows it's going to take a little while to work. That's how you'd get your first backup started. Now your organization may have and hopefully does have a more strategic backup strategy that should include SQL Server. You may have third-party tools that you're dealing with, because backup and restore should really be an enterprise-wide idea.
But if you're going to be involved even in basic administration of SQL Server you certainly want to be comfortable with doing a casual backup.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 91069 Viewers
80 Video lessons · 138146 Viewers
59 Video lessons · 56954 Viewers
52 Video lessons · 70583 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.