Error 3154 while restoring a backup using WITH REPLACE
You should use WITH REPLACE
and in general avoid using the point-and-click thingies in Management Studio - they're inflexible and often have bugs.
This worked for me:
USE [master];
GO
CREATE DATABASE test;
GO
CREATE DATABASE test2;
GO
BACKUP DATABASE test TO DISK = 'c:\temp\test.bak' WITH INIT, COMPRESSION;
GO
RESTORE DATABASE test2
FROM DISK = 'c:\temp\test.bak'
WITH REPLACE,
MOVE 'test' TO 'c:\temp\test2.mdf',
MOVE 'test_log' TO 'c:\temp\test2.ldf';
Also you should make sure when you backup databases you use WITH INIT
and/or don't point the device at a file that already contains a backup (since it might not be the same database you're backing up now - especially if you reuse names like test
...).
You're restoring the wrong database. Don't think of it as "restoring test2
with a backup from test
", think "restore my backup of test
but rename it as test2
". You could choose the restore task from test
and put test2
in the "To database:" field.
As Aaron mentions, learn the script rather than relying on the wizard--it's clearer as to what's going where.
1) Use WITH REPLACE
while using the RESTORE
command.
2) DROP
the older database which is conflicting and restore again using RESTORE
command.
There is no problem with the SQL Server version. As Aaron pointed out, I am also able to restore the database from 2008 to 2012 and same versions as well.