Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 restore backup with move

Author  Topic 

AgaK
Yak Posting Veteran

86 Posts

Posted - 2009-12-29 : 18:42:40
Hi

Is there a way to restore a backup with a RESTORE BACKUP command with MOVE and refer the data and log files by id and not logical names?

I want to create a script that will restore few backups and move the data and log files to a folder.
Something like :
RESTORE DATABASE RestoreTest FROM DISK='F:\TestRestore\backup_200912281730.bak'
WITH MOVE 'Test' TO 'F:\testdb.mdf',
MOVE 'TestLog' TO 'F:\testdb.ldf'

but instead of Logical File Name the id?

Thank you

AK

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-12-29 : 19:04:41
u can easily get both by RESTORE WITH FILELISTONLY
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-29 : 19:06:47
This should help you: http://weblogs.sqlteam.com/tarad/archive/2005/11/08/8262.aspx

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -