On MS SQL server support often we come across two most common issues while restoring the database (usually ending in .bak format).
First error System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing ‘user_database‘ database. (Microsoft.SqlServer.Express.Smo)
Solution for First error
Connect to the database server
Go to the restore option and select Restore Database
On the Restore page that loads up, make sure that the Destination for restore has the database you want to restore and in the Source for Restore, choose From device: And browse by clicking [..] and Add the file location there, the location where your database backup resides. You may need to browse the backup. If you get permission denied, copy the bak in the MSSQL folder.
Restore it. Make sure that the Restore Checkbox is selected. And Click OK. And get ready for the error 🙂
Here comes the first errorSystem.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing ‘user_database’ database. (Microsoft.SqlServer.Express.Smo) And the solution is to go to Options -> Overwrite Existing Database . But if you aren’t so lucky, you will be welcomed by another error as seen below. where it’s solution is to edit the path from D:\ to C:\ or whichever Drive, where your MSSQL is installed.
System.Data.SqlClient.SqlError: Directory lookup for the file “D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\user_database.mdf” failed with the operating system error 3(The system cannot find the path specified.). (Microsoft.SqlServer.Express.Smo)
Both THE Solutions are in a single screen shot. The final screenshot 🙂
Just edit D:\ProgramFiles\Microsoft… to C:\ProgramFiles\Microsoft or whichever directory where you installed the MSSQL server. Don’t keep database server on your system drive C: though.
For more assistance on MSSQL server you can contact our MS SQL server support team Here with requirements
Category : IIS, Troubleshooting, Windows
George started his career in web hosting and Linux technical support in the year 2004 and is with SupportSages since 2009. He has keen interest in server optimizations, custom security solutions, hacked server recovery, cyber forensic and high availability fail over system design and implementation. George loves long drives and is passionate about art and literature.