I am running a SQL Server Agent job which zips up my database backups. The application I run is a C# Windows Application which takes in the path of the database as an argument. When I run the application form a command prompt all works well. However when I run it from within a sql server job using the Operating System (CmdExec) as the type I get the following error.
“The system cannot find the file specified”
Within the job I have the following as the command:
D:\DatabaseBackups\DatabaseBackupManager.exe D:\DatabaseBackups\SubDit\Database.bak
I have tried setting specific directory permissions for the SQL Server Agent account on the DatabaseBackups folder but still get the same error.
Can anybody throw any light onto this one as Google did not throw up anything that worked and is starting to drive me a crazy.
Thanks
The D: drive has to exist as a local drive, not a mapped drive. (Unless there's some way to force that to be mapped for other users who aren't logged on of which I am unaware)
Also, as far as permissions, it could be just about anything related to the account that the agent is running under.
You might need to put some logging into your C# process assuming it's starting your process at all. If it's not starting your process, it could be some permissions on that account related to the directory or even the .NET framework settings.
Also, you can use Windows to audit the failures to see which file it's attempting to open.
If you add the agent account temporarily to the administrators group and it works, then this points to permissions being the source of the not terribly helpful “The system cannot find the file specified” error.