How to restore database in SQL server 2022?

This Video have step by step process of

How to restore database in SQL server 2022?

How to Restore database on SQL Server from Backup?

There are 2 ways to restore database.

Option 1 : Restore database using SSMS

Option 2 : We can restore database using T-SQL

Script : 

Restore database [WideWorldImportersDWNew] from disk = 'C:\Omkar\backups\WideWorldImportersDW\WideWorldImportersDW_backup_2023_04_11_100002_5398348.bak' with stats = 10

Point in time Restore : Sometime we need to restore database with FULL,DIFFRENTIAL and T log backup

Below steps guides

How to restore database in SQL server 2022?

For this we need to perform 3 steps

Step 1 : Restore full backup

Step 2 : Restore DIFFRENTIAL backup

Step3 : Restore T log backup

Sample Script :

–Step 1 : Restore full backup. we need to restore database with NORECOVERY to apply more backups.

Script : 

Restore database [WideWorldImportersDW] from disk = 'C:\Omkar\backups\backup\Backup\WideWorldImportersDW_FULL.bak' with norecovery,stats =10

–Step 2 : Restore DIFFRENTIAL backup. We need to use no recovery here as well to apply log backup.

Script : 

Restore database [WideWorldImportersDW] from disk = 'C:\Omkar\backups\backup\Backup\WideWorldImportersDW_DIFF.bak' with norecovery,stats =10

–Step3 : Restore T log backup

Script : 

Restore log [WideWorldImportersDW] from disk = 'C:\Omkar\backups\backup\Backup\WideWorldImportersDW_TLOG.trn' with norecovery,stats =10 Restore database [WideWorldImportersDW] with recovery

–Step4 : Put database in recovery and online.

Script : 

Restore database [WideWorldImportersDW] with recovery

This is how we can successfully restored database and recover data.

Leave a Comment