MSSQL Server 2005 Restore Database bak files to "Backup set database backup vs. existing XX database" workaround

Source: Internet
Author: User
Tags microsoft sql server mssql mssql server mssqlserver
MSSQL Server 2005 Restore Database Bak files, Web sites using Virtual host site will often encounter, in general, the host has an online management program, but sometimes not, you need to restore the local backup SQL database. In this case, MSSQL Server 2008 will also appear, sometimes the "backup set of database backup and the existing XX database is different" error prompts, this article also put the solution said.

In the first section, MSSQL Server 2005 (2008) Restores the database bak file.

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

Second, the right key after the new database, such as diagram operation.

Third, the point added, find Bak store path, file suffix is bak can be selected

Four, the red box in the picture must be checked

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

In the second part, MSSQL Server 2005 (2008) Restores the database Bak file to prompt for "database backup in the backup set is different from the existing XX database" error resolution.

An error occurred while restoring the database: The database backup in the backup set is different from the existing database SQLServer2005 or the Sqlserverexpress database failed at restore time. Error specific information: The backup set of the database backup and the existing "XXXX" database is different, in fact, the hint has explained the core of the problem. To resolve the following precautions.

SQL Server 2005/sql Server 2008/express method/step
1
First attempt: New database XXXX, database files in the D:\DB\XXXX directory, select the database right-task-restore-Files and filegroups, in the source device to find the backup file Xxxx.bak, the target database Select a, restore the path to find E:\DB\ XXXX directory database files (just built database a database file), choose to overwrite the original database, point restore after the 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 in the backup file in the same database name, select it, in the option to restore the database file, the restore path to their own needs of the D:\DB\XXXX, file name to retain the system itself, A successful restore after a point restore.
3
Summary: The reason for the first restore error may be that the new database file is Xxxx.mdf and Xxxx_log.ldf, and the restored database file is Xxxx_data.mdf and xxxx_ Log.ldf, the filename is different, causing the restore error, the second time because there is no database file, so use the restored database file name, so can restore success.

there is another way to resolve the problem of SQL Server 2008,sql Server 2005 "database backups in the backup set are different from the existing XX databases"
Because it is a backup of a database of the same name on another computer, restore with the normal method, the hint is not the same database, do not let restore, find the following method on the net to solve:

One, right click System Database master, new query

Execute the following SQL code:

RESTORE DATABASE XXX
From DISK = ' E:\DB\xxx.bak '--bak file path
With Replace,
Move ' xxx ' to ' D:\Program Files\Microsoft SQL Server\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
Copy Code
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 of successful implementation, only part of the table structure has been restored, and there is no data in the table, then you can use the system default method to restore the database with Xxx.bak file is done, you must select coverage Restore OH.

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.