Operating system error 5: Access is denied
Many users have tried to backup SQL Server database to network share for better security or easier migration, but ended up receiving “Cannot open backup device. Operating system error 5 (Access is denied)”.
Why does this problem occur? As the prompt says, the backup terminates abnormally because it cannot open the backup device. This could be caused by 2 reasons:
1. The account you use to log in to SQL server does not have permission to read or write to the target share.
2. There is already a backup file with the same name in the target path, and it is read-only.
With this perception, it’s not difficult to solve the access denied problem.
How to solve SQL Server backup to network share access denied?
Almost all the backup methods support you to backup SQL database to network share - SSMS backup wizard, T-SQL or command line. But whichever way you use, you may find the SQL Server cannot access network share.
To avoid the Operating system error 5, you could refer to the following troubleshooting tutorial, or try an effective alternative directly.
1. Solutions for SQL Server cannot access network share
If the access to the specified network drive or share is denied, as mentioned earlier, you should first have a look at the target folder to see whether it contains a backup file of the same name.
If yes, right-click it and choose Properties to check its attribute. For a Read-only bak file, please uncheck its select box and hit Apply to confirm the change.
If not, then the access error should be caused by permissions issue. You could try following steps to fix it:
1. Press Win + R and type “services.msc” in the Run window. Press Enter to execute it.
2. Right-click “SQL Server (MSSQLSERVER)” in the Services interface, choose Properties > Log On to find (or copy) the full name of the account you use to log in the SQL Server.
3. Then, right-click the target network share and go to Properties > Security. If the account you just found is already listed in the “Group or user names”, please Edit it and Allow its Full Control.
Otherwise, you need to click Edit > Add to type the account name, click OK to search for it, select the correct one to add and give it full permissions.
4. Apply the changes and hit OK to exit. Then you can retry the SQL Server backup to see if the access denied problem has been solved.
2. Effective software to backup SQL database to network share without error
Apart from Operating system error 5 (Access is denied), there may be some other problems that arise when backing up SQL Server to network drive. If you are tired of troubleshooting or cannot complete the backup even after trying common solutions, maybe it’s time to try 3rd party software.
AOMEI Centralized Backupper Database is a centralized backup and management solution for all Windows PCs, servers and virtual machines within LAN. It contains a SQL Server Backup feature which supports SQL 2005-2019 and enables you to backup selected databases or instances to network share smoothly. Besides SQL databases, it also supports files, partitions, disks and OS backup.
Have a try on the 30-day free trial and get a up-to 60% off discount:
Install AOMEI Centralized Backupper Database on your computer as the central management console, and install the Agent package on all the client machines through the software. Then you can gain control over those computers you want to manage over network, and start to create a centralized backup task.
1. Go to Home tab and choose SQL Server Backup from the list.
2. In Step 1, click + Add Computers to detect the controlled computers with SQL database, then select one from the list.
3. Click on Step 2, hit + Add to detect SQL Server instances on the select computer. Then you can select the databases you want to backup.
4. Move to Step 3, click Add Storage to add a network share or NAS as destination. You need to enter its UNC path and corresponding authentication.
5. Click Schedule to set up SQL Server auto backup, or enable email notifications in Settings. Then click Start Backup to "Only create the task" or "Create and execute tasks".
As I tried, even when the SQL Server log-on account doesn’t have read & write permissions for the network share, the database backup can be fulfilled successfully. And the network share you’ve added once will be saved for quick use later. Easy peasy.
Final words
Why does SQL Server backup to network share access denied? This is usually because the account you log in SQL Server as doesn’t have the permissions to read and write to the target path. To solve it, you can either provide full control to the account, or use an effective alternative software to perform the backup.
AOMEI Centralized Backupper Database Edition is such a program that supports backing up multiple SQL databases or even instances to network share. With it, you won’t be bothered by the Operating system error 5 (Access is denied) or some other problems. Not only SQL Server, this software also applies to all the computer data of controlled PCs, servers and virtue machines. As an example, you can centrally backup multiple servers within LAN.