In my work I made backup of database and I receive file .bak. Now I would like restore this database in my machine. But I get the following error:
Cannot open backup device 'C:\Program Files...\MSSQL10_50.SQLEXPRESS...\file.bak'.
Operating system error 5(failed to retrieve text for this error. Reason: 15105).
RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3201)
Of course I searched the Internet, for example: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/805661f1-cf23-4230-ae31-d9cc16505359/cant-restore-backup-from-2005-to-2008r2?forum=sqlexpress
But all users have permissions to all folders so I'm really confused. What is the problem?
5 Answers 5
Sounds like a permissions error is being masked. You have to remember that the user that needs access to the folder where the backup resides (and where you restore the backup, if using WITH MOVE
explicitly) is the SQL Server service account, not regular users.
If the folder listed in the error message does not represent the same instance where you're trying to restore, it's unlikely the service has access to the folder. Try moving the .bak file to the current instance's data or log folder, where SQL Server will certainly have adequate permissions.
-
2Yep, it's definitely permissions, operating system error 5 is access denied, useful link for these error codes: msdn.microsoft.com/en-us/library/windows/desktop/…steoleary– steoleary2013年11月12日 09:41:59 +00:00Commented Nov 12, 2013 at 9:41
-
1this helped me stackoverflow.com/questions/3960257/…JonnyRaa– JonnyRaa2014年12月04日 10:57:32 +00:00Commented Dec 4, 2014 at 10:57
This is due to permission error i.e., SQL server doesn't have access to the backup file. It doesn't have anything to do with user permissions of backup file in Windows machines. This can be due to many reasons. For instance, if you copied the backup file from another computer, your computer may block the file due to security reasons. It can be fixed in windows 7 by selecting the property of the backup file and clicking the unblock button in it.
Definitely a location of the backup file problem, I've had the problem before and it was down to the fact I didn't have access to the file where the database backup was located, or where the database files were going to be restored to.
Here some procedures which helps you to resolve your problem please go through it
- Free the drive volume to enable expansion of SQL backup files.
- Run defragmentation process and analyze the level for all volumes to ensure that it is more than 15%.
- You can also follow the under mentioned workaround to rectify SQL Error 15105 issue:
- Go to the location on shared network where the original folder locates.
- Right click on the folder and select "Sharing and Security" option.
- In the "Sharing" tab, click on "Permissions"
- Next, assign "Full Access" privilege to target account for which backup is generated and if you are not concerned about security, you may assign "Full Access" to "EVERYONE" for a particular period of time. Once the backup process is completed, you can change\ modify the assigned permissions.
- Once you are done with applying permissions and privileges, click on ‘Apply’ and then ‘OK’.
- Afterwards, click on the "Security" tab and add the specified account to whom full access permissions are granted and assign appropriate privileges to the accounts.
- Click on ‘Apply’ and further select ‘OK’.
I has this error trying to restore a .bak file to a new server when I had forgotten to specify a name for the new database it was going to create
-
3Are you sure you got the exact same error?András Váczi– András Váczi2015年10月09日 10:43:52 +00:00Commented Oct 9, 2015 at 10:43
RESTORE
command you ran?RESTORE HEADERONLY
command, likeRESTORE HEADERONLY FROM DISK = 'C:\...\file.bak';
?