When I run the following statement in a SQL 2005 Agent Job:
backup Database [dbMain] TO DISK = N'C:\DBMainBU' WITH INIT, NOUNLOAD, NAME = N'dbMainBU.bak', NOSKIP, STATS=10,NOFORMAT
I get the following result:
Executed as user: Mainoffice\administrator. Cannot open backup device 'C:\DBMainBU'. Operating system error 5(Access is denied.). [SQLSTATE 42000] (Error 3201) BACKUP DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step failed.
The SQL DB and SQL Agent are both running under the local system account. I have tried running them both under the administrator account to no avail. I am able to run a manual backup from SSMS sucessfully, but not from SQL Agent.
This should be a simple backup job with no problems. I have created other jobs in the same manner on other servers that run flawlessly. What could be wrong? Why is the agent not able to write to the file system?