SQL Server with Mr. Denny

May 30 2011   2:00PM GMT

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



Posted by: Denny Cherry
Tags:
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.

Denny

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: