Wednesday, January 7, 2015

Partial Database Restore In SQL Server..

In previous blog, I have explained how to take partial database backup in sql server. If you want to visit that page then please click on below link:

How to take Partial Backup Of Database in SQL Server?

Now, We'll be using previous backup files to show How to restore  those backups. First I will be Restoring a Full Partial Backup, Then Partial backup which is the base of Differential Partial Backup.

USE [MASTER]
GO
RESTORE DATABASE [PARTIALBACKUP]
FROM DISK = N'C:\DATA\PARTIALBACKUP_FULL.BAK'
WITH NORECOVERY
GO


Now we will restore actual partial backups which will include Read-Write File Groups.

Use master
GO
RESTORE DATABASE [PartialBackup]
FROM DISK =N'C:\Data\PartialBackup_PARTIAL_KA_Diff.bak'
WITH NORECOVERY
GO

OOppssss!!! Error. As we supplied the wrong backup file. This backup file was of differential partial backup that is why we got this error. Correct the backup file path and execute it. It will be restored successfully.

use master
Go
RESTORE DATABASE [PartialBackup]
FROM DISK =
N'C:\Data\PartialBackup_PARTIAL_KA_Full.bak'
WITH NORECOVERY
GO

Restoring a Differential Partial Backup:
Now we will see how to restore a Differential Partial Backup. We will use below script for same:
Use master
GO
RESTORE DATABASE [PartialBackup]
FROM DISK =N'C:\Data\PartialBackup_PARTIAL_KA_Diff.bak'
WITH RECOVERY
GO

So, This is how you can partially restore your database.

Thanks For Reading This Blog!!!

No comments:

Post a Comment