Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Restore Error - Urgent Reply Please!

Author  Topic 

mandriva
Starting Member

1 Post

Posted - 2011-10-07 : 12:24:48
Hi.

I have a database backup file (.bak) taken from SQL Server 2005 Express which was running on a 32-bit Windows XP. Now I have 64-bit windows 7 installed on my PC. i installed SQL Server 2005 Express and tried to restore the backup and got the following error. Then I removed Sql Express 2005 x64 and installed Sql Express 2008 x86. To see if the reason is version compatibility. But got the same error.

[CODE]
Restore failed for server "localhost". (Microsoft.SqlServer.Express.Smo)

Additional Information:
System.Data.SqlClient.SqlError: The operating system returned the error '5(failed to retrieve text for this error. Reason: 15100)' while attempting 'RestoreContainer:ValidateTargetForCreation' on 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\EMSDB.mdf'
[CODE]

I don't exactly remember but I think giving path in additional information of error was different with te error I got in Sql 2005.

The wonderful part is that the error shows that it was targeting to restore the database to root of sql server path not to DATA folder.

I MUST fix this error within next few hours.

Any Idea is highly appreciated.

WJHamel
Aged Yak Warrior

651 Posts

Posted - 2011-10-07 : 14:00:02
Were there any service packs or updates to the previous version of SQL which was on the XP machine at the time the backup was created?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-10-07 : 14:11:47
Have you tried using RESTORE DATABASE command and adding WITH MOVE for the correct file locations?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

paultech
Yak Posting Veteran

79 Posts

Posted - 2011-10-07 : 14:30:22
You can use RESTORE FILELISTONLY to return a result set containing a list of the database and log files contained in the backup set, and you need to use MOVE as sp_lock answered for every file that cannot use the original file path.

RESTORE FILELISTONLY FROM AdventureWorksBackups

If you suspect that the backup is corrupt you should use

RESTORE VERIFYONLY
FROM AdventureWorksBackups




Also,
Have you tried using the "move" parameter?

RESTORE DATABASE xxx
FROM DISK = 'd:\xxx_20091201.bak'
WITH RECOVERY,
MOVE 'xxx_data' TO 'w:\data\xxx.mdf',
MOVE 'xxx_Log' TO 'w:\data\xxx_log.ldf'

Go to Top of Page
   

- Advertisement -