Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a database in SQL Server and I want to create backup from it to a shared folder.

just one of the network users has permissions to access to this folder.

I have written a code to log on this user at the middle of my program and then execute Backup command.

This code worked all ever I want to access to my folder. But now I receive this error:

"Cannot open backup device 'folder path with backup file name'.Operating system error5(failed to retrieve text for this error, Reason: 1815) BACKUP DATABASE is terminating abnormally"

1 solution

The problem is that the backup is trying to access the network folder with the credentials under which SQL Server is running. In other words the backup is made by SQL Server, not by the user who executes the backup command.

You can use (create a new) domain account for SQL Server service and give proper privileges to that account if you want to take the backup directly to network. Another option is that you take it locally and then using some script transfer the backup to network share.

One example article dicussing setting the privileges for the domain account:[^]

If the thing mentioned above is already correct, check the backup settings and the target folder. For example if the backup tries to write a new file (without overwriting the old) and there's an existing file with the same name in the folder, it would fail.
Share this answer
M_Mogharrabi 3-Sep-11 4:29am    
thanks, you were right.i have granted permission of access to my share folder to server computer and my problem resolved.
Wendelius 3-Sep-11 4:39am    
Glad it helped.

If you like, you can mark the answer as accepted.

Also if the vote of 1 came from you: 1 is bad and 5 is good, so if you wanted to vote the answer as helpful then I think giving 1 isn't the correct choice.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900