March 20, 2014 at 12:25 pm
I backed up file from db1.
Now I want to restore it to db2. With first attempt I got a message that this is backup from another database.
I renamed db2 to db1. I get still the same message. Apparently, it checks something else besides just a database name. So is there a work around this problem?
Thanks
March 20, 2014 at 12:50 pm
Just to make sure I understand. You're trying to restore a backup to a DB on a different server? I'm assuming this is the same DB and is used for DR or reports or test/staging correct?
March 20, 2014 at 1:26 pm
No, server is the same. Databases are different. It is not related to DR.
I backed up a file from a database A and want to restore it to database B (it is empty database) on the same server.
March 20, 2014 at 2:26 pm
Can you provide the exact and full message?
March 20, 2014 at 4:21 pm
Yeah, it also checks the file locations.
You need to do this:
RESTORE DATABASE MyNewDatabase
FROM DISK = 'x:\mybackupfile.bak'
WITH MOVE 'MyLogicalFileName' = 'd:\data\MyNewDatabase.mdf',
MOVE 'MyLogicalLogFileName' = 'e:\logs\MyNewDatabase.ldf';
You need to put in your appropriate paths and logical names, of course. If you have more than one data file X.ndf, x2.ndf, just keep adding MOVE statements, comma separated, until you get them all. There are a couple of examples on how to do this in the Books Online section on the RESTORE statement.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply