I have a SSIS package that deletes older log files from a location. The logic is based on modified date. It works fine when it is executed manually but when it is scheduled via a SQL Server Agent job, it doesn't deletes the files at specified location.
The job terminates successfully and there are no errors displayed.
Any help in this regard would be very helpful.
You need to make sure that the account that SQL Server Agent is using has rights to be able to delete the files. When you execute manually it is using your credentials. When executed by SQL Server Agent it uses the service account of SQL Server Agent.
answered Jun 12, 2012 at 11:31 AM
One of the options As @Tim mentioned is grant the service account under which the agent is running appropriate rights to be able to delete those files.
The other option is to create a proxy account with appropriate rights and specify the proxy account in the job. So the Agent executes the SSIS under this specific proxy account with all the necessary rights for the delete operation.
answered Jun 12, 2012 at 11:54 AM