SQL SERVER – FIX : Error 3154: The backup set holds a backup of a database other than the existing database

Our Jr. DBA ran to me with this error just a few days ago while restoring the database.

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

Solution is very simple and not as difficult as he was thinking. He was trying to restore the database on another existing active database.

Fix/WorkAround/Solution:

1) Use WITH REPLACE while using the RESTORE command. View Example

2) Delete the older database which is conflicting and restore again using RESTORE command.

I understand my solution is little different than BOL but I use it to fix my database issue successfully.

3) Sample Example :
RESTORE DATABASE AdventureWorks
FROM DISK = 'C:\BackupAdventureworks.bak'
WITH REPLACE

Reference : Pinal Dave (https://blog.sqlauthority.com)

SQL Backup and Restore, SQL Data Storage, SQL Error Messages, SQL Scripts
Previous Post
SQLAuthority News – Book Review – Programming SQL Server 2005 [ILLUSTRATED]
Next Post
SQL SERVER – Introduction and Example for DATEFORMAT Command

Related Posts

302 Comments. Leave new

  • Thanks… I restored the database correctly… Once again thanks…

    Reply
  • Thanks Alot!

    Really Greate and Wonderful

    Reply
  • Hi,
    For developing/testing purposes with original data I need to restore / copy data from one database to another with same database structure (tables, SPs, views, etc) but a different database name. from a backup file from original.
    What is the best approach for this? CAn I use the restore command for this?

    Reply
  • Jemson Sentillas
    April 11, 2009 3:42 pm

    Thanks for the article…
    Have a nice day.

    Reply
  • It worked!!
    Thanks

    Reply
  • U DA MAN

    Reply
  • Thanks Pinal. You have very good common sense in programming. Now let’s see what cool chakra graphic I get!

    Reply
  • Hi, I got a question…I backuped my database from an Win2003 Server English Edition and when I try to restore the database into my development enviorment (wich is an XP Professional Spanish Edition) it shows an error like this:
    Mens. 5133, Nivel 16, Estado 1, Línea 1
    Directory lookup for the file “C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\MyDataBase.mdf” failed with the operating system error 3(El sistema no puede hallar la ruta especificada.).
    Mens. 3156, Nivel 16, Estado 3, Línea 1

    Of course I dont Have “Program Files”, in spanish it is called “Archivos de Programa” I dont how I can change that..hope you can help me…Thanks..
    (by the way, El sistema no puede hallar la ruta especificada. = The system could not find the specified path.)

    Reply
  • hai,

    i tried many time to restore backup file through GUI restore.
    i wasn’t able to restore.
    i tried your query within second finished.

    Many Thanks,

    Bala

    Reply
  • Thank you so much, your solution worked for me!!

    Reply
  • thanks a lot, this was the my problem.
    this solved my problem..

    Reply
  • thank a lot

    Reply
  • Radhesham Shah
    June 18, 2009 9:46 pm

    Great!!! Works like a charm :)

    Reply
  • Sunny Khetarpal
    June 20, 2009 4:33 pm

    Sorry, it doesnt work for me please help…

    Reply
  • Thank you very much for your simple example. It works

    Reply
  • Another individual happy to have stumbled upon your post. Thanks for sharing.

    Reply
  • Thank you sir! I can go to bed now!!

    Reply
  • Thanks a lot. It work !!!!!!!!!!!

    Reply
  • Thanks a lot for this is very helpful

    Reply
  • You’re the king man, a great piece of code that helped me a lot. Thanks kindly

    Reply

Leave a Reply