没有文件可下载时,如何避免 SSIS FTP 任务失败?
我正在使用 SQL Server 2005,并在 SSIS 中创建 ftp 任务.
I'm using SQL Server 2005, and creating ftp tasks within SSIS.
有时会有文件要 ftp 过来,有时没有.如果没有文件,我不希望任务或包失败.我已将 ftp 任务的箭头更改为完成"旁边的箭头,因此包运行.我已将允许的错误数更改为 4(因为有 4 个 ftp 任务,并且 4 个目录中的任何一个可能有也可能没有文件).
Sometimes there will be files to ftp over, sometimes not. If there are no files, I don't want the task nor the package to fail. I've changed the arrow going from the ftp task to the next to "completion", so the package runs through. I've changed the allowed number of errors to 4 (because there are 4 ftp tasks, and any of the 4 directories may or may not have files).
但是,当我从代理中的作业运行包时,它会将作业标记为失败.由于这将每 15 分钟运行一次,因此我不希望在我的工作历史记录中出现一堆红色 x,这将导致我们在问题确实发生时看不到问题.
But, when I run the package from a job in agent, it marks the job as failing. Since this will be running every 15 minutes, I don't want a bunch of red x's in my job history, which will cause us to not see a problem when it really does occur.
如何在 ftp 任务中设置属性,以便找不到文件到 ftp 不是失败?我正在使用的操作是发送文件".
How do I set the properties in the ftp task so that not finding files to ftp is not a failure? The operation I am using is "Send files".
这里有更多信息:这些文件位于我无法通过 ftp 访问的服务器上.而且,我不提前知道文件名.用户可以随心所欲地称呼他们.所以我不能检查特定的文件,我想,我也不能检查.除非通过使用 ftp 连接和基于该连接的任务.这些文件位于远程服务器上,我想将它们复制到我的服务器上,以便从该远程服务器获取它们.
Here is some more information: the files are on a server that I don't have any access through except ftp. And, I don't know the filenames ahead of time. The user can call them whatever they want. So I can't check for specific files, nor, I think, can I check at all. Except through using the ftp connection and tasks based upon that connection. The files are on a remote server, and I want to copy them over to my server, to get them from that remote server.
我可以在脚本任务中对命令级 ftp 进行 shell.也许这就是我需要使用的,而不是 ftp 任务.(我已更改为使用带有参数文件的 ftp 命令行,从脚本任务调用.当没有要获取的文件时,它不会出错.我认为这个解决方案对我有用.我正在创建参数文件是动态的,这意味着我不需要在纯文本文件中包含连接信息,而是可以存储在我的配置文件中,它位于更安全的位置.)
I can shell a command level ftp in a script task. Perhaps that is what I need to use instead of a ftp task. (I have changed to use the ftp command line, with a parameter file, called from a script task. It gives no errors when there are no files to get. I think this solution is going to work for me. I'm creating the parameter file dynamically, which means I don't need to have connection information in the plain text file, but rather can be stored in my configuration file, which is in a more secure location.)
推荐答案
检查这个 link 描述了如何优雅地处理 SSIS 包中的任务错误.
Check this link that describes about gracefully handling task error in SSIS Package.
我遇到了几乎相同的问题,但是在检索文件时.当在 FTP 服务器上找不到文件时,我希望包不会失败.上面的链接停止了错误冒泡并导致包失败;你会认为 FailPackageOnError=false 应该做的事情?:-S
I had almost the same problem but, with retrieving files. I wanted the package NOT to fail when no files were found on FTP server. The above link stops the error bubbling up and causing the package to fail; something you would have thought FailPackageOnError=false should have done? :-S
希望这也能为您解决问题!
Hope this solves it for you too!
相关文章