SSIS package - Script task does not get executed when triggered through SQL Job Agent

為{幸葍}努か 提交于 2019-12-23 22:32:54

问题


I have an SSIS package that creates 2 text files using a data flow component. It connects to an SQL database and if the query returns data, the 2 files are created. After that, a script task loops through the folder where the 2 files are written into, determines the oldest file and moves it to another folder. Everything moves smoothly when I execute the package on the server. No errors and all functions are executed. Perfect. However, when I schedule the SSIS package in a job, the said script task only gets executed when the SQL query (data flow component) returns no results and therefore no files are created. The script then moves the 2nd file from the last run to the other folder. If the data flow does create 2 new files, the script task does not do anything. Any ideas how to change this behavior? Again, this only happens when executed through a job, not when run locally.

Thanks, Daniel


回答1:


When SSIS packages are executed from SQL Server they access file system using the SQL Server Service Account NT SERVICE\MSSQL$<Instance Name> (Where <Instance Name> should be replaced by the installed instance name). You have to Grant this account to access the selected directories or run the SQL job using a proxy account:

SQL Server Service account Permissions:

  • Configure File System Permissions for Database Engine Access

Setting proxy account:

  • Running a SSIS Package from SQL Server Agent Using a Proxy Account
  • Create a SQL Server Agent Proxy



回答2:


The package is running using a proxy account. All the other package are running and saved in the same folder. In this one the file saved in this folder has to move to a different one which saves to differnt application which uses third party dll. I am calling the library using reflection. But the dll is not registered in sql. Will that be a issue?



来源:https://stackoverflow.com/questions/57793655/ssis-package-script-task-does-not-get-executed-when-triggered-through-sql-job

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!