MSSQL Server 2005 Restore Database Bak file differs from "Database backup in Backup set to existing XX database" workaround

Source: Internet
Author: User
Tags mssql mssql server mssqlserver name database

MSSQL Server 2005 Restore the database Bak file, Web site using virtual Host station will often encounter, in general, the host has an online management program, but sometimes not, you need to restore the backup SQL database locally. In this case, MSSQL Server 2008 will also appear, sometimes "backup set of database backup and the existing XX database" error, this article also said the solution.

The first part, MSSQL Server 2005 (2008) Restores the database bak file.

First, connect the database, right-click the database, select New Database, enter the name of the database you want to restore.

Second, to determine the right-click New database, operation.

Third, click Add, find Bak storage path, file suffix is bak to select

Four, the red box in the picture must be checked

Five, click OK to restore, success will prompt restore success, hope can help you

The second part, MSSQL Server 2005 (2008) Restore the database Bak file prompt "The database backup in the backup set is different from the existing XX database" error resolution method.

Error when restoring database: The database backup in the backup set is different from the existing database SQLServer2005 or the Sqlserverexpress database is in error when restoring. Error specific information: The backup set of the database backup and the existing "XXXX" database, in fact, the hint has explained the core of the problem. The following precautions are addressed.

SQL Server 2005/sql Server 2008/express methods/steps
1
First attempt: Create a new database XXXX, the database file is placed in the D:\DB\XXXX directory, select the database right-task-restore-Files and filegroups, found in the source device backup file Xxxx.bak, the target database selected A, the Restore path found E:\DB\ XXXX directory under the database file (database a just built database file), select overwrite the original database, point after restore error: The backup set of the database backup and the existing "XXXX" database is different
2
Second attempt: Delete Database A, right-click the database directly on the root node-restore the database, Out of the dialog box to find the backup file Xxxx.bak, the target Database drop-down box automatically appears with the database name in the backup file, select it, in the option to restore the database file as in, the restore path to the required D:\DB\XXXX, file name retention system comes with, After the point is restored, the restore succeeds.
3
Summary: The first restore error could be due to the new database file Xxxx.mdf and Xxxx_log.ldf, and the restored database file as Xxxx_data.mdf and Xxxx_ Log.ldf, the file name is different, resulting in a restore error, the second time because there is no database files, so the restored database file name, so it can be restored successfully.

There is another way to do this, the SQL Server 2008,sql Server 2005 backup set has a different database backup from the existing XX database "workaround

Because it is in another computer to the same name database backup, using the usual method to restore, prompt is not the same database, do not let restore, find the following method on the Internet to solve:

First, right-click the system database master, new query

Execute the following SQL code:

RESTORE DATABASE xxxfrom DISK = ' E:\DB\xxx.bak '   --bak file path with replace,move ' xxx ' to ' D:\Program Files\Microsoft SQL Se Rver\mssql10_50.mssqlserver\mssql\data\xxx.mdf ',   --mdf file path move ' xxx_log ' to ' D:\Program Files\Microsoft SQL Server\mssql10_50.mssqlserver\mssql\data\xxx.ldf '   --ldf file path

Note: XXX is the name of the database you need to restore, Xxx.bak is the backup file you need to restore.

Second, the above method after successful execution, only some of the table structure has been restored, and there is no data in the table, then you can use the system default method and then use the Xxx.bak file to restore the database once you are done, you must select the overwrite restore OH.

MSSQL Server 2005 Restore Database Bak file differs from "Database backup in Backup set to existing XX database" workaround

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.