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

  • What happened between 'This code worked…' and 'But now…'? – Andriy M Aug 15 '11 at 7:21
  • Check the SQL Server error logs through Management Studio and see what is there. There will be more information regarding your backup failure. – m4rty Aug 15 '11 at 15:21

The user account that the SQL Server is running as must have permissions to the backup location. The user account running the script is irrelevant in this situation, since it's the SQL Server process performing the file operations.

If the SQL Server is running as NETWORK SERVICE or SYSTEM, then in a domain environment you can grant the DOMAIN\COMPUTERNAME$ account access to the file share. Otherwise, this would be the user listed under SQL Server Configuation Manager → SQL Server Services → Properties for "SQL Server" → Log On tab.

  • thanks, for your answer.yes my SQL Server is installed on server and i access to it from clients.but i can not understand completely what did you mean by DOMAIN\COMPUTERNAME$ ? – M_Mogharrabi Aug 16 '11 at 7:45
  • If you are running a Windows domain, then not only do users have domain accounts but also every computer which is joined to the domain has an account called COMPUTERNAME$ (substitute the actual name of the computer, of course). If your domain name is DOMAIN, then the account name of the computer is DOMAIN\COMPUTERNAME$, and any service running as NETWORK SERVICE accesses the network using this account. – Stephen Jennings Aug 16 '11 at 14:21
  • thanx, i got it exactly. but another question is which computer should i grant to access to shared folder? server or client? Excuse me for my beginner questions. – M_Mogharrabi Aug 17 '11 at 7:38
  • To create the backup, the server needs access to the file share. That's the computer that will be writing the backup file. – Stephen Jennings Aug 17 '11 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.