SQL SERVER – FIX – ERROR : Msg 3201, Level 16 Cannot open backup device . Operating system error 5(Access is denied.)

Recently I formatted my computer and installed fresh SQL Server in it. I installed the AdventureWorks database in my database. Once done, I wanted to run few test scripts on my database. Just like every DBA, I decided to take backup of my database – this way I can restore it back to attain an original database state. As soon as I ran the backup command I ended up with the following error. This error is due to a permissions issue on the local disk and user account which is running SQL Server. In this blog post we will talk about the operating system error.


Msg 3201, Level 16, State 1, Line 1
Cannot open backup device ‘C:\AdventureWorks.bak’. Operating system error 5(Access is denied.).

Fix/Resolution/Workaround:

I checked which user accounts my SQL Server services are running.

SQL SERVER - FIX - ERROR : Msg 3201, Level 16 Cannot open backup device . Operating system error 5(Access is denied.) NetworkError1

I gave full permission to that account to get rid of the error.

SQL SERVER - FIX - ERROR : Msg 3201, Level 16 Cannot open backup device . Operating system error 5(Access is denied.) NetworkError2

NOTE: This whole experience was done on the my personal machine and not on the production server. Please check with your network administrator for permission on production server.

Let me know if you have ever faced such error and if you have, how did you fix the error. Please leave a comment with your answer. I hope you find this blog post helpful.

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL Backup and Restore, SQL Data Storage, SQL Error Messages, SQL Server
Previous Post
SQL SERVER – Query to Recent Query on Server with Execution Plan Function to Get SQL
Next Post
SQL SERVER – Transaction Log Impact Detection Using DMV – dm_tran_database_transactions

Related Posts

54 Comments. Leave new

  • Thanks Pinal..On installation the default login was set so that i can’t access to my other drives..on change the accout to network services i get the access privilege for my windows account..

    Reply
  • Thank you!

    Reply
  • I too had this issue and got it resolved by using the above solution , but i would like to know how did i loose cerdentials all of a sudden on my xp machine for Log On user NETWORK SERVICE

    Reply
  • Copy backup file to SQL 2012 backup folder works for me. Thanks.

    Reply
  • it did not work for me, still getting this error

    Reply
  • it opens for me, thanks

    Reply
  • Thank you very much ,this article was very helpful :)

    Reply
  • Hey,

    Thanks a lot for your post. This method worked for me!

    Reply
  • This information you provided is helpful, thank you very much

    Reply
  • Thank you. This really worked for me.

    Reply
  • Thanks, you save my life.

    Reply
  • astorskywalker
    May 3, 2018 2:48 am

    Where do you check “I checked which user accounts my SQL Server services are running.”

    Reply
  • The solution you suggest would work absolutely fine for me. The first rule of thumb is we need to know the basic fundamentals which is — Any backup run under the service account, the service account must have full permission on backup folder.

    Reply
    • mentisintortus
      June 19, 2021 6:55 am

      Nope. That doesn’t work. I’ve done this for the SQL Server program folder, db folder, backup folder, tempdb folder and pretty much every possible folder SQL is running on (SQL 2017), no joy. Same error. There must be a bug in Windows (2012R2) that presented itself after updating from (2008R2). The only solution I can think of is to give “God Mode” access to “Everyone”, but that’s a really really bad idea. It would be nice to find a real, tangible, working solution to this problem (650,000+ inquiries on Google – this is an MS problem!)

      Reply
  • mentisintortus
    June 19, 2021 7:28 am

    After spending 2 days on everything under the sun, I found out that the problem is NOT with SQL at all, nor security on any of the SQL folders. The issue is with the TEMP folder of the user running the app.
    C:\Users\Administrator\AppData\Local\Temp
    To fix, grant Everyone read/write permission to the Temp folder for the user account(s) affected. This solves many issues for MS applications that use MSSQL (any flavor)

    Reply
  • Does this need RDP access on target server where the folder is present.

    Reply

Leave a Reply