Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error - Restore data in SQLExpress 2005

Status
Not open for further replies.

raccess

Programmer
Dec 31, 2002
91
US
Hi,

I have backup data from SQL Server 7.0 and now when i'm trying to restore it into SQL Express 2005, I'm getting following error......

--------------------
Msg 3154, Level 16, State 2, Line 1
The backup set holds a backup of a database other than the existing 'GOSLDW' database.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
--------------------

Here is SQL i'm using to restore database,

RESTORE DATABASE GOSLDW
FROM DISK = 'C:\sqlserverData\GOSLDW'
WITH MOVE 'GOSLDW' TO 'C:\sqlserverData\GOSLDW.mdf',
MOVE 'GOSLDW' TO 'C:\sqlserverData\GOSLDW.ldf'
GO


Why i'm getting this error? Am i missing anything here?

Thanks in advance for your HELP.

- R
 
You need to include the REPLACE flag.

It's a saftly feature of SQL 2005 to prevent you from accidently restoring over a production database. If you include the REPLACE flag the restore will work fine.

Code:
RESTORE DATABASE GOSLDW
   FROM DISK = 'C:\sqlserverData\GOSLDW'
   WITH MOVE 'GOSLDW' TO 'C:\sqlserverData\GOSLDW.mdf',
   MOVE 'GOSLDW' TO 'C:\sqlserverData\GOSLDW.ldf'[red],
   REPLACE[/red]
GO

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Thanks a lot 'Replace' did the trick!!!!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top