How do I restore a SQL Server backup to a different drive or folder?
Resolved SQL
MJ
Miles Jacobs
November 6, 2026
2 replies
1,237 views
Reviewed by moderators
2 participants

I want to restore a backup from the production server on a test server, but the drive letters are different. The restore fails because the path does not exist. What do I do?

Accepted answer
Marked as the solution to this question

Use RESTORE with MOVE to place each file where you want.

First list the logical file names stored in the backup:

RESTORE FILELISTONLY FROM DISK = 'D:\Backups\Sales.bak';

Then restore:

RESTORE DATABASE SalesTest FROM DISK = 'D:\Backups\Sales.bak' WITH MOVE 'Sales' TO 'E:\Data\SalesTest.mdf', MOVE 'Sales_log' TO 'F:\Logs\SalesTest_log.ldf', RECOVERY;

The names in quotes after MOVE are the logical names from FILELISTONLY. The new database name can differ from the original, which is handy for a test copy. In SSMS you can do the same in the Restore Database window under Files, with Relocate all files to folder.

Restore worked on the test server with MOVE. Thanks.