[Solved] System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing ‘dbName’ database

You have backup a database on SQL Server 2005. Then, you try to restore the backup file on an existing database and receive the error message below:

Restore failed for Server ‘SQL Server name‘. (Microsoft.SqlServer.Smo)
Additional information:
System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing ‘dbName‘ database. (Microsoft.SqlServer.Smo)
The backup set holds a backup of a database other than the existing

This error message indicates that you are going to restore a database on another database which are not the same database. For example, you have backup Northwind database and try to restore the backup to AdventureWorks database, the error will occur.

Solution

To solve the problem, you can use the overwrite the existing database option while you’re restoring.

  1. On Restore Database, select Options tab on the left menu. Then, check Overwrite the existing database on Restore options.
    Note: This option will overwrite any existing data on the targeted database.
    Restore Database Option
  2. Try to restore the database, the problem should be gone now.
    Restore Database Successful

Note: you can also delete the targeted database before perform restore a database. This way also gives the result as same as the solution above.

139 Responses to “[Solved] System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing ‘dbName’ database”

  1. JAaronAndersondotcom

    This would work if an existing database did NOT use the same .mdf file of another database that is currently driving the LIVE IIS webpages… how to I work with this situation?

  2. Sam

    JAaronAndersonDotcom…I had the same problem…try using the “Restore Database…” option under the “Databases” folder in the Microsoft SQL Server Management Studio IDE. Select the backup file in the “From Device…” option and type in the database name you want it to create. Also, make sure under the “Options” section that the “Restore As” file paths under the “Restore the database file as:” section are valid paths, otherwise, it will fail. You can also select the “Overwrite the existing database” option as well but I don’t think it is necessary. Hope this helps!

  3. Dee

    I have tried all instructions but still gives the same error for database set,

    Please assist asap, i am very desperate

  4. jeet

    No dude this answer dint work for me i got another error saying operating system error 5 !!!

  5. linglom

    Hi, Jeet
    Operating system error 5 is about permission issue. Check if you have enough permission.

  6. Roshani Panchal

    Thanx for the solution..Just marking Overwrite checkbox solved my problem..thanx for the screen shot

  7. Venkat919

    Hello Dude…

    Thanks for your article
    I solved my problem with the help of your article.

    Thanks & Regards
    Venkat

  8. Karthik

    Hello,

    Thanks for your post. Looks like Im missing out some settings/permissions. I am facing operating system error 3 as below. Any suggestions is well appreciated.

    ” System.Data.SqlClient.SqlError: The operating system returned the error ‘3(error not found)’ while attempting ‘CreateFile’ on ‘C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\” ..

    Cheers,
    Karthik

  9. Ralph

    Thank you ALL for the posting. This information has lead me in the right direction and I finally got my database where it needs to be.

  10. Poetry

    Magnificent web site. Plenty of useful information here. I am sending it to some friends ans additionally sharing in delicious. And naturally, thanks to your effort!

  11. Abhi

    still having issues, solved my problem once, but when i again tried this with my new database, problem persists. Help me asap.

  12. jon

    Still failed. appears error: ‘system.data.sqlclient.sqlerror:the backup set holds a backup ofn a database other than the existing ‘name_database’ database.(microsoft.sqlserver.smo)’
    Restore from .bak sql server 2000 to 2005.

  13. Fero

    thanks a lot. it works and saved a lots of time… Keep up the good work…. You kind of geeks are always needed by us…

  14. Raquel

    Bom dia a todos.
    Eu já tinha realizado todos esses procedimentos. De substituir e a mensagem continua.
    Sei que esta utilizando algum arquivo que nao esta me permitindo mas como resolver isso? Já parei todos os serviços q poderia estar utilizando o bando de dados que quero copiar e mesmo assim nada.
    Alguém tem alguma outra sugestão?
    Obrigada.

  15. Ahmad Hassan

    hello everyone, I get a strange error it says system.data.sqlclient.sqlerror: The media set has two media families but only 1 are provided. All members must be provided. (Microsoft.SqlServer.Smo).
    Can anyone please help me out with that????

  16. Raghav

    When im restoring ..at 90% i got below error.
    The file on device — is not a valid Microsoft Tape Format backup set.

Comments are now closed for this article. If you still have issue and would like to discuss, you can post in the forum or send me a message.