SQL Server Restore Database from Backup

SQL Server restore 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 SQL Server database from backup is to use SqlBak. And the 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 backup is to use SqlBak. This is the very simple tool which can create backups according to your schedule and send them to selected destination place on a regular basis. 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. Here you can promptly restore the last database backup or select the needed one. If you prefer to restore the last backup press “Restore” button.SQL Server Restore Database from Backup Using SqlBak If it is necessary to select another database backup press at the backup job and select the backup you are going to restore.SQL Server Restore Database from Backup Using SqlBak
  2. In the “Restore” window you will find SQL Server database backup which you are going to restore. Here you can select where you want to restore your backup on your computer or you can select another computer. SQL Server Restore Database from Backup Using SqlBak
  3. To make SQL Server restore database from backup on your computer simply press “Restore”. If you prefer to restore the backup on different server click “on another computer” link, make all necessary settings and press “Restore”.SQL Server Restore Database from Backup Using SqlBak
  4. You will receive the following message after the restore process will complete. SQL Server Restore Database from Backup Using SqlBak
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 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 as 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 in the restoring state. Which means that it is needed to restore a full backup and a differential backup, if it 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 Reply

Your email address will not be published. Required fields are marked *