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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 backup and restore to different DB

Author  Topic 

boarderstu
Starting Member

1 Post

Posted - 2007-01-10 : 02:38:49
im trying to create a backup and restore script which backs up DB 1 and DB2 then then restores db1 over db2,

I have had this working but sometimes i get the error message:

[CODE]Logical file 'DB1_01112006_Data' is not part of database 'DB2_01112006temp'. Use RESTORE FILELISTONLY to list the logical file names.[/CODE]
i dont want to enter the file name manually in my script as its calculated thru data enter in the SP params.
however it also has worked before and seems tempermental
any ideas around this?

cheers!

nr
SQLTeam MVY

12543 Posts

Posted - 2007-01-10 : 04:05:01
Have a look at
http://www.nigelrivett.net/SQLAdmin/s_TestRestore.html
It restores a database with move of the files - you can probably use something similar to fix your problem.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-01-10 : 04:42:38
if you are not familiar with RESTORE FILELISTONLY and/or you want to double check the sytax of your RESTORE this may help:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=RESTORE%20syntax%20/%20example

Kristen
Go to Top of Page
   

- Advertisement -