Click here to Skip to main content
15,894,410 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
anybody can tell me how to do that in correct way
Posted
Updated 5-Oct-18 8:33am
Comments
Mehdi Gholam 1-Sep-14 4:55am    
You restore them one by one.

You can restore your .bak files using SQL Query. So If you want to restore multiple .bak files you can write multiple batches. You will find how to restore databases from SQL Here.
 
Share this answer
 
I was trying to find the script I found several months ago on how to restore a backup composed of several BAK files. To me it looks like this is the question posed by the OP. I do not that the answer provided above answers that question. Sure didn't help me.
Now, this is an old thread, but someone may stumble across this while trying to figure it out like I did. I was lucky in that I was using SQL Server 2014, and was able to use the GUI to do the restore, and which then generated the script it used after completion. Otherwise it would have taken several more hours to find this.
SQL
USE [master]
RESTORE DATABASE [ABC] 
FROM  DISK = N'C:\_D\DB_Backups\ABC1_20170731.bak',  
	  DISK = N'C:\_D\DB_Backups\ABC2_20170731.bak',  
	  DISK = N'C:\_D\DB_Backups\ABC3_20170731.bak',  
	  DISK = N'C:\_D\DB_Backups\ABC4_20170731.bak',  
	  DISK = N'C:\_D\DB_Backups\ABC5_20170731.bak' 
WITH  FILE = 1,  
MOVE N'ABC_Data' TO N'C:\Program Files\Microsoft SQL Server\MSSQL12.[instancename]\MSSQL\DATA\ABC.MDF',  
MOVE N'ABC_Log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL12.[instancename]\MSSQL\DATA\ABC.LDF',  

NOUNLOAD,  
STATS = 5

GO
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900