SQL Server : Restore Database using multiple backup files

Here is an example script to restore a database from multiple backup files and the destination database has several data files.


USE [master]
RESTORE DATABASE [TestDB]
FROM  DISK = N'G:\Temp\TestDB_20141031_033500_00.bak',
DISK = N'G:\Temp\TestDB_20141031_033500_01.bak',
DISK = N'G:\Temp\TestDB_20141031_033500_02.bak'
WITH  FILE = 1,
MOVE N'TestDB_Data' TO N'E:\SQLData\TestDB_Data.mdf',
MOVE N'TestDB_1_Data' TO N'E:\SQLData\TestDB_1_Data.ndf',
MOVE N'TestDB_2_Data' TO N'E:\SQLData\TestDB_2_Data.ndf',
MOVE N'TestDB_3_Data' TO N'E:\SQLData\TestDB_3_Data.ndf',
MOVE N'TestDB_Log' TO N'H:\SQLLog\TestDB_Log.ldf',
REPLACE, RECOVERY

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s