How to restore a database backup in SQL Server
As a database developer or administrator it often happens that you need to investigate a bug and do tests on a previous versions of a database or just run a stored procedure that alters data on the wrong table and screw things up.
That’s why we keep backups. (.BAK files)
All good when you have one but how do we restore a database from a backup? Well pretty simple. Here’s how:
- In SQL Server Management Studio (SSMS) Right click on Databases –> Restore Database…
- As a source, select Device and then click on the 3 dots on the right …
- Click on Add on the new window that speared.
- Navigate to the folder where your backup is stored.
- Select it and then press OK then OK again.
Make sure that you give it an appropriate name. This is important when it comes to choosing a .BAK file from a list of tens or even more daily backups.
We will be using Adventureworks 2014 database in this example. Here’s how the final screen should look like.
- Finally click on OK and wait for the restore process to finish.
You can see the progress of this process in the down left corner called Progress.
This was it. Simple and easy.
If I missed something feel free to leave a comment below.
Have a great one!