Wednesday, March 28, 2012

Problem Restoring Database

I have a backup of a database from SQL Server. I try to restore that backup file to SQL Server Express and get the following error:

Cannot open backup device 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\TEST.BAK'. Operating system error 5(Access is denied.).
RESTORE HEADERONLY is terminating abnormally. (.Net SqlClient Data Provider)

When restoring other files, I would get this same error message, copy it to another folder and it would work. With this particular one, no matter what folder I copy it to I get the same error message. From what I can find online is that its a permission thing, but I cant find anywhere to change the permissions.

Any help is appreciated.

That can be based on serveral problems which either depends on the way you authenticate to the database server (you did not mention that) and the service account (running SQL Server authentication) or you own account (running Windows authenticaiton) does not have the appropiate rights to access the folder or you are running Vista, which needs elevated rights to access the special folder opn your system.

Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||I connect using mixed authentication. I am running windows XP.|||

I have hit this issue, detaching a database then copying the .mdf file then attempting to attach on another server.

The 'copied-to' server in my case is running on Vista. I eventually bludgeoned it into working by opening up all the permissions on the containing folder and the .mdf file itself; so I guess this tends to confirm it's a permissions issue, but 'just give everyone access to everything' isn't really a satisfactory answer! Can anyone point us in the direction of more detail on how permissions and SQL Express interact - I gather it's particularly tricky with Vista and UAC etc. Jens - could you expand on the bit about Vista and the 'special folder' - I take it you mean the folder containing the .mdf?

TIA

pg

|||What I ended up doing was setting the mssql folder proprty to full access and took read only off and it worked. Thanks.|||There's some more about this issue here: http://msdn2.microsoft.com/en-us/library/ms189128.aspx

pg

No comments:

Post a Comment