Monday, March 7, 2011

Cannot open backup device 'filename'. Operating system error 5/3

This Error kept me occupied for the most of the day yesterday, as i was trying to create a job Manager which automatically backs up SQL server db(s) on a given server with SMO objects. (well yeah. :o) its not the only thing it does).

Anyways As the message says the backup operation failed. First i was getting the Message with Operating system ERROR 5. I was running the C# program with a windows account, with Full privileges to run backup jobs on the SQL server, but still the back up JOb failed. The reason behind this is that no matter what the account that i use to run the code. It uses the system account under which the SQL server service runs to perform the backup operations.

Two things, you can either give permissions to the system account to perform backup operations and full access to the backup location, or can make the service hosted under a account with sufficient backup privileges and permissions to the backup locations.
But my problems were still there and was getting the same annoying ERROR over and over, it took me almost half an hour to notice that this time the number has changed from OS error 5 to 3.

Then it was a matter of seconds for google to get me difference between codes 3 and 5. 3 was to say that it "cannot find the path specified", and 5 meant "Access Denied". There was a spelling mistake in the path given, and after fixing that it was all good. Why can they include that little piece of information in the ERROR message ??

No comments:

Post a Comment