Friday, March 23, 2012

Restore Database from file

Hello, I had backed up a database from SQL 2000, just before I format my computer. Now I have installed SQL 2005 and trying to restore that database to it, it doesn't work and I get the following error when doing that

===================================

Restore failed for Server 'localhost\SQLEXPRESS'. (Microsoft.SqlServer.Express.Smo)


For help, 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


Program Location:

at Microsoft.SqlServer.Management.Smo.Restore.SqlRestore(Server srv)
at Microsoft.SqlServer.Management.SqlManagerUI.SqlRestoreDatabaseOptions.RunRestore()

===================================

System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing '2for1' database. (Microsoft.SqlServer.Express.Smo)


For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&LinkId=20476


Program Location:

at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQueryWithMessage(StringCollection queries, ServerMessageEventHandler dbccMessageHandler, Boolean errorsAsMessages)
at Microsoft.SqlServer.Management.Smo.BackupRestoreBase.ExecuteSql(Server server, StringCollection queries)
at Microsoft.SqlServer.Management.Smo.Restore.SqlRestore(Server srv)

========================================================

any help is appreciated

Thanks,

COuld you please post the command you were issueing in your program ?

-Jens Suessmeyer.|||

Thank you for your kind reply.

I didn't use command to restore the database from file but I did it through SQL Server Management Studio Express CTP

|||

I've also tried the following command to restore from file

RESTORE DATABASE [2for1] FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\db' WITH FILE = 1, NOUNLOAD, STATS = 10

GO

|||

Hi,

I guess your are not the same as from the server your backup was originally taken from, right ? Then you have to use the WITH MOVE option. (From BOL)

[ [ , ] MOVE 'logical_file_name' TO 'operating_system_file_name' ]

This will help you to place them on a destination that exists on your system.

HTH, jens Suessmeyer.

No comments:

Post a Comment