[SQL Server] Error 3201 - Cannot open backup device - Operating system error 5(Access is denied.)

BLOG

7/1/20241 min lire

You likely encounter this error when attempting to back up your SQL Server database.

Msg 3201, Level 16, State 1, Line 12

Cannot open backup device 'C:\AdventureWorks2022_2.bak'. Operating system error 5(Access is denied.).

Msg 3013, Level 16, State 1, Line 12

BACKUP DATABASE is terminating abnormally.

Solution :

To resolve the issue, here are two suggestions:

  • The first thing is to ensure that the SQL Server service account has the correct permissions (full control) on the folder where you want to save the backup to.

  • The second, if you want to save the backup directly to the root directory (like C:, for example), you can't!

    • You need to create a subfolder beforehand to avoid the error

      • You won’t encounter this kind of problem during restoration—it’s possible to restore a backup located in the root directory.

If you create a folder named Backup under C: and then restart the backup: