SQL SERVER -Fix Error – Cannot open backup device. Operating system error 5(Access is denied.)

This has to be the most popular error in taking database backups. There are many reasons for this error and there are different ways to resolve it. I recently faced this error and for a while I was taking backup and found a very interesting solution to the problem. The error was as mentioned below:

Msg 3201, Level 16, State 1, Line 1
Cannot open backup device ‘d:\Log\aw.bak’. Operating system error 5(Access is denied.).
Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally.

SQL SERVER -Fix Error - Cannot open backup device. Operating system error 5(Access is denied.) error5-1

Personally, I know this error happens when

  1. There is no directory with Log
  2. There is not enough space on drive d:\
  3. There is not enough permissions on d:\Log drive

In my case all of the above were not the reason for above error. The error was there because of the file was read only. There was already another backup file which existed in the folder with the name aw.bak and it was marked as read only. Due to the same reason, my backup was failing. Once I removed the checkbox for reading only, the backup was successful.

SQL SERVER -Fix Error - Cannot open backup device. Operating system error 5(Access is denied.) error5-2

SQL SERVER -Fix Error - Cannot open backup device. Operating system error 5(Access is denied.) error5-3

Here are few other blog posts related to this error, which I have written earlier.

Reference: Pinal Dave (https://darkslategrey-bat-805937.hostingersite.com)

SQL Error Messages, SQL Server
Previous Post
SQL SERVER – Finding if Current Week is Odd or Even – Script
Next Post
SQL SERVER – List the Name of the Months Between Date Ranges

Related Posts

Leave a Reply