Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
5.5k views
in SQL Server by 24 25 33

In SQL Server Management Studio,I got "SQL Server Operating system error 5 Access is denied" when trying to backup a log database file to another drive

Msg 3201, Level 16, State 1, Line 1
Cannot open backup device 'F:\DBLogBackup'. Operating system error 5(Access is denied.).
Msg 3013, Level 16, State 1, Line 1
BACKUP LOG is terminating abnormally.

SQL Server Operating system error 5 Access is denied

How can Fix this error?


1 Answer

1 like 0 dislike
by 163 206 413
selected by
 
Best answer

Solving: "Cannot open backup device Operating system Access is denied"

The error message "Cannot open backup device. Operating system Access is denied" typically occurs when there is a permission issue preventing the operating system from accessing or opening the specified backup device.

So to solve this error "Cannot open backup device. Operating system Access is denied", you have to check the following:

1) Make sure that the Backup Path URL is correct

I have noticed that you just typed the backup path "F:\DBLogBackup" without adding the file name "filename.bak", so try to run the backup command with correct backup path as stated below:

BACKUP LOG WSS_Content_PWA TO DISK='F:\DBLogBackup\log.bak'

2) Verify the permissions

Ensure that the user account or SQL service account attempting to access the backup device has the necessary permissions.

  • Open Services > Search for "SQL Server".
  • Double click to open the properties > and at the Log on tab check the service account

Ensure that the account is properly configured with the necessary privileges to perform backup operations.

Ensure that the user account or SQL service account attempting to access the backup file and folder

  • Right-click on the folder or file, go to "Properties," and navigate to the "Security" tab.
  • Click on "Edit" or "Advanced" and then "Add." Enter the account name,
  • Click "Check Names" to verify, and then click "OK."
  • Finally, select the appropriate permissions (e.g., Full Control, Modify, Read & Execute) for the account and click "Apply" and "OK."

Note: Check both the source and destination locations involved in the backup process.

3) Open SQL Management Studio as Administrator.

Try to run the SQL Management Studio as Administrator as shown below

Run SQL as admin

4) Change the backup path to the default SQL backup path

Try using the default backup location which has all the necessary permissions.

C:\Program Files\Microsoft SQL Server\[Instance Name]\MSSQL\Backup

default sql backup path

Change the drive and Instance name based on your version


See Also

by 24 25 33
1 0
Thanks Mohamed for your detailed answer, My problem was I was simply putting in the Folder path and not the File path as you mentioned!
by 163 206 413
0 0
Glad to hear you have solved your issue
If you don’t ask, the answer is always NO!
...