Skip to main content

Posts

Showing posts with the label restore sql

Restore SQL Server database from multiple backup files

To restore a SQL server database from multiple files we can use the RESTORE DATABASE T-SQL command. Before we do the restore process it is good to know the name of the “.mdf” and “.ldf” files in the backup set. To find this out we can run the RESTORE FILELISTONLY command in the following syntax: RESTORE FILELISTONLY FROM DISK = 'E:\Db_Backups\FILE1_FULL.BAK', DISK = 'E:\Db_Backups\FILE2_FULL.BAK', DISK = 'E:\Db_Backups\FILE3_FULL.BAK' In the above example I assume the full backup consists of 3 files, “FILE1_FULL.BAK”, “FILE2_FULL.BAK”, and “FILE3_FULL.BAK”. The files in this case files are locate in E drive “Db_Backups” folder. The above command will output the name of the “.mdf” and “.ldf” files contained in the backup set. Once we get those we can run the actual restore command in the following way: RESTORE DATABASE My_DB FROM DISK = 'E:\Db_Backups\FILE1_FULL.BAK', DISK = 'E:\Db_Backups\FILE2_FULL.BAK', DISK = 'E:\Db_Backups\FILE3_FULL.BAK...