SQL Server Restore Database from Backup

SQL Server restore a database from backup – how to do it? This is one of the crucial questions related to SQL Server. In this article, we are going to show you two ways how you can do it. The first and the easiest way to make the SQL Server database from a backup is to use SqlBak. And second – you can use standard T-SQL Commands to restore your SQL Server.

SQL Server Restore Database from Backup

The first and the easiest way to perform SQL Server restore database from a backup is to use SqlBak. This is a very simple tool that can create backups according to your schedule and send them to the selected destination place regularly. Also, you can simply restore your database from the backup.

SQL Server Restore Database from Backup Using SqlBak

Follow this simple tutorial and learn the way how to perform SQL Server restore database from backup with the help of SqlBak.

  1. Go to your SqlBak Dashboard and choose your backup job. On the next page, you can promptly restore the needed backup from the “Backup history & restore” section.
  2. In the “Restore Backup” window, you will find SQL Server database backup, which you are going to restore.
  3. To restore the SQL Server database from backup on your server, simply press “Restore”. If you prefer to restore the backup on a different server, choose the needed one at the “Restore to” failed, make all necessary settings, and press “Restore”.
  4. You will receive the following message after the restoration process completes.
SQL Server Restore Database from Backup Using T-SQL Commands

In this a portion of our review, we are going to show how to make SQL Server restore database from backup with the help of T-SQL Commands.

SQL Server Restore Database from a Full Backup

Apply the following T-SQL Command to restore the full backup of your SQL Server database. That backup will overwrite your database if such is exist or produce a new SQL Server database.

RESTORE DATABASE Adventureworks FROM DISK = ‘D:\Adventureworks_full.bak’

Once you have restored your full database backup, you can restore a differential or transaction log backups. If you need to do it, restore your full backup using NORECOVERY command. This particular command leaves a backup on the restoring state and assists you to restore extra differential or transaction log backups.

RESTORE DATABASE Adventureworks FROM DISK = ‘D:\Adventureworks_full.bak’

SQL Server Restore Database from a Differential Backup

The T-SQL command to restore the differential backup is similar to the Command to restore a full backup. All you have to do is don’t skip to add NORECOVERY command.

RESTORE DATABASE Adventureworks FROM DISK = ‘D:\Adventureworks_full.bak’ WITH NORECOVERY
GO
RESTORE DATABASE Adventureworks FROM DISK = ‘D:\AdventureWorks_diff.dif’
GO

SQL Server Restore Database from a Log Backup

If you need to restore a transaction log backup, please don’t forget that your SQL Server database should be restoring. This means that it is needed to restore a full backup and a differential backup, if needed, earlier.

RESTORE LOG Adventureworks FROM DISK = ‘D:\Adventureworks_log.trn’

SQL Server Restore Database from Multiple Transaction Log Files Using NORECOVERY Option

As we discussed just before you require to add NORECOVERY command to set the database in a restoring state. Under, you will find out the case how to restore your SQL Server database with the help of the next restore scenarios:

  1. Full backup
  2. Differential backup
  3. Transaction log backup 1
  4. Transaction Log backup 2

RESTORE DATABASE Adventureworks FROM DISK = ‘D:\Adventureworks_full.bak’ WITH NORECOVERY
GO
RESTORE DATABASE Adventureworks FROM DISK = ‘D:\Adventureworks_diff.dif’ WITH NORECOVERY
GO
RESTORE LOG Adventureworks FROM DISK = ‘D:\Adventureworks_log1.trn’ WITH NORECOVERY
GO
RESTORE LOG Adventureworks FROM DISK = ‘D:\Adventureworks_log2.trn’ WITH RECOVERY
GO

Leave a Comment