Restore a SQL Server 2008 R2 SP3 (10.50.6560) database to SQL Server 2019 (15.0.2000.5).

-- Database Backup File Info
RESTORE FILELISTONLY  
   FROM DISK = 'H:\MSSQL\Backup\MyDB01_backup.bak' 

/*
PRIMARY_DATA		X:\MSSQL\Data\MyDB01.mdf
MyDB01_DATA		X:\MSSQL\Data\MyDB01_1.NDF
MyDB01_INDEXES		Y:\MSSQL\INDEXES\MyDB01_2.NDF
MyDB01_LOG		L:\MSSQL\Logs\MyDB01_3.ldf
*/

RESTORE DATABASE [MyDB01_DEV] FROM DISK = 'H:\MSSQL\Backup\MyDB01_backup.bak' 
WITH FILE = 1, REPLACE, maxtransfersize = 4194302, buffercount = 96, stats = 5,
   MOVE 'PRIMARY_DATA' TO 'X:\MSSQL\Data\DEV\MyDB01.mdf',
   MOVE 'MyDB01_DATA' TO 'X:\MSSQL\Data\DEV\MyDB01_1.NDF',
   MOVE 'MyDB01_INDEXES' TO 'I:\MSSQL\INDEXES\DEV\MyDB01_2.NDF',
   MOVE 'MyDB01_LOG' TO 'L:\MSSQL\Logs\DEV\MyDB01_3.ldf'

Note: After restore, the database files are same size as original files.

Last modified: April 6, 2021

Author

Comments

Write a Reply or Comment