How to avoid SSIS FTP task from failing when there are no files to download?(没有要下载的文件时,如何避免 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.
我可以在脚本任务中 shell 命令级别的 ftp.也许这就是我需要使用的而不是 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!
这篇关于没有要下载的文件时,如何避免 SSIS FTP 任务失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:没有要下载的文件时,如何避免 SSIS FTP 任务失败?
- 导入具有可变标题的 Excel 文件 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- SQL 临时表问题 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01