SQL Server Restore Script

Source: Internet
Author: User
Tags mssql mssqlserver

The backup set holds a backup of a database other than the existing ' xxdb ' database.time 2014-04-25 11:03:39 csdn blog Similar article ( 0) original http://blog.csdn.net/wzhiu/article/ details/24459511

One:

He backup set holds a backup of a database other than the existing ' xxdb ' database

Sometime when you try to restore the backup file on an existing database and receive the following error message:

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 ' xxdbe ' dat Abase. (MICROSOFT.SQLSERVER.SMO)

Above error message indicates that is going to restore a database on another database which is not the same database . For example, you had backup A database and try to restore the backup to B database, the error would occur.

You can use the overwrite the existing database option while you're restoring to solve the problem.

On Restore Database , select Options tab on the left menu. Then, check Overwrite the existing database on the Restore options.

Now Restore the database. and problem is solved.

You can also delete the database and again restore.

Both:

Use the SQL to solve this issue.

Use master

RESTORE DATABASE ReportServer

From DISK = ' C:\Program Files\Microsoft SQL Server\mssql11. Mssqlserver\mssql\backup\reportserver.bak '

With MOVE ' reportserver_db ' to ' C:\Program Files\Microsoft SQL Server\mssql11. Mssqlserver\mssql\backup\reportserver.mdf ',

MOVE ' Reportserver_log ' to ' C:\Program Files\Microsoft SQL Server\mssql11. Mssqlserver\mssql\backup\reportserver_log.ldf ',

STATS = ten, REPLACE

GO

SQL Server Restore Script

Related Article

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.