How to use the WITH MOVE when you don’t know the logical database file names.

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.
[sql]
RESTORE FILELISTONLY FROM DISK=’D:PathToYourBackupFile.bak’[/sql]

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.

Denny

Share

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trust DCAC with your data

Your data systems may be treading water today, but are they prepared for the next phase of your business growth?