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.
I gave full permission to that account to get rid of the error.
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)