SQL error:3145 Solution (the database backup in the backup set is different from the existing database) _mssql2005

Source: Internet
Author: User
Tags microsoft sql server mssql sql error management studio microsoft sql server management studio sql server management sql server management studio
Error 3145 the database backup in the backup set is different from the existing database

Online solutions are many, testing down are half-baked, mistakes or exist

Groping in, resolved the

1. Create a new database with the same name as an existing database

2. Run the following statement in the query window:
Copy Code code as follows:

Use master
Restore Database AdventureWorks from disk = ' E:\databasebackup\AdventureWorks.bak '
With replace, move N ' adventureworks_data ' to n ' C:\Program Files\Microsoft SQL Server\mssql.5\mssql\data\ Adventureworks.mdf ', move N ' Adventureworks_log ' to n ' C:\Program Files\Microsoft SQL Server\mssql.5\mssql\data\ Adventureworks_log.ldf '

From the statement point of view, and in the graphical interface of the operation is the same, but the result is the success of the statement, the graphical interface how to pass.

Supplementary information:

Today, to restore the client's SQL 2005 database in the U.S. VPS, it was discovered that no matter how recovery would occur

Title: Microsoft SQL Server Management Studio
------------------------------

Restore failed for server "Micrsoft-db4bb0". (MICROSOFT.SQLSERVER.SMO)

For help information, click: Http://go.microsoft.com/fwlink?ProdName
=microsoft+sql+server&prodver=9.00.1399.00&evtsrc=microsoft.
SqlServer.Management.Smo.
Exceptiontemplates
. Failedoperationexceptiontext&evtid=
Restore +server&linkid=20476

------------------------------
Additional Information:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

Database backups in the backup set are different from the existing ' ssc123 ' databases.
The RESTORE DATABASE is terminating abnormally. (Microsoft SQL Server, error: 3154)

For help information, click: Http://go.microsoft.com/fwlink?ProdName
=microsoft+sql+server&prodver=09.00.1399&evtsrc=
mssqlserver&evtid=3154&linkid=20476

------------------------------
Button:

Are you sure
------------------------------

No way... Have to operate in command mode. My orders are as follows:


Use master
Restore Database ssc123 from disk = ' E:\1.bak '
With replace, move N ' Panydb '
To N ' E:\MSSQL.1\MSSQL\Data\ssc123.mdf ',
Move N ' Ssc123_log ' to n ' E:\MSSQL.1\MSSQL\Data\ssc123_log.ldf '

Please note: Panydb is the name of the database in your backup file. What is he, what do you fill in?
How do I query? You click to restore the database Select File He will show himself

You'll be prompted later.


The file ' Panydb_log ' was selected. The name of the file is ' Dataname_log ' at the time of backup. RESTORE
The renamed file will continue to operate.
808 pages have been processed for the database ' dataname ', file ' Panydb ' (located on file 1).
1 pages have been processed for the database ' dataname ', file ' Panydb_log ' (located on file 1).
Converting database ' Dataname ' from version 539 to current version 611.
The database ' Dataname ' is being upgraded from version 539 to version 551.
The database ' Dataname ' is being upgraded from version 551 to version 552.
The database ' Dataname ' is being upgraded from version 552 to version 553.
The database ' Dataname ' is being upgraded from version 553 to version 554.
The database ' Dataname ' is being upgraded from version 554 to version 589.
The database ' Dataname ' is being upgraded from version 589 to version 590.
The database ' Dataname ' is being upgraded from version 590 to version 593.
The database ' Dataname ' is being upgraded from version 593 to version 597.
The database ' Dataname ' is being upgraded from version 597 to version 604.
The database ' Dataname ' is being upgraded from version 604 to version 605.
The database ' Dataname ' is being upgraded from version 605 to version 606.
The database ' Dataname ' is being upgraded from version 606 to version 607.
The database ' Dataname ' is being upgraded from version 607 to version 608.
The database ' Dataname ' is being upgraded from version 608 to version 609.
The database ' Dataname ' is being upgraded from version 609 to version 610.
The database ' Dataname ' is being upgraded from version 610 to version 611.
The RESTORE DATABASE successfully processed 809 pages, costing 1.437 seconds (4.606 MB/s).

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.