Posted by: Denny Cherry
Restore Database, SQL Server
When doing a database restore and you want to move the physical database files from one disk to another, or from one folder to another you need to know the logical file names. But if you can’t restore the database how do you get these logical file names? By using the RESTORE FILELISTONLY syntax of the restore command.
The syntax is very simple for this statement.
RESTORE FILELISTONLY FROM DISK=’D:\Path\To\Your\Backup\File.bak’
The record set which will be returned will give you the logical names, as well as the physical names of the database files which you can then use within the RESTORE DATABASE command.