Total Pageviews

Sunday, October 30, 2011

Error 3154: The backup set holds a backup of a database other than the existing database.


What is this below error
Error 3154: The backup set holds a backup of a database other than the existing database.

Connect to the SSMS >take the DB backup of AdventureWorksDW-


So I have taken to the C:Drive as shown below-

So when you are start restoring of this database Backup file to the active database I,e TestDB you will get the below error(see below).





So to resolve this issue you may required to use the below query-

RESTORE DATABASE [TestDB] FROM  DISK = N'C:\ADWK.BAK' WITH  FILE = 1,  MOVE N'AdventureWorksDW_Data' TO N'C:\t1.mdf',  MOVE N'AdventureWorksDW_Log' TO N'C:\t2.ldf',  NOUNLOAD,  REPLACE,  STATS = 10
GO

Output will be
10 percent processed.
20 percent processed.
30 percent processed.
40 percent processed.
50 percent processed.
60 percent processed.
70 percent processed.
80 percent processed.
90 percent processed.
100 percent processed.
Processed 8760 pages for database 'TestDB', file 'AdventureWorksDW_Data' on file 1.
Processed 2 pages for database 'TestDB', file 'AdventureWorksDW_Log' on file 1.
RESTORE DATABASE successfully processed 8762 pages in 2.047 seconds (35.065 MB/sec).

If didn’t works then you may required to drop and re-create with backup file.

1 comment:

Mark Willium said...

Hello Rama,

You can also fix SQL server error msg 3154 by "Deleting the older SQL server database which is conflicting and restoring again with RESTORE command".

Thanks,
Mark Willium,
Blog for SQL server recovery