没有文件可下载时,如何避免 SSIS FTP 任务失败?

How to avoid SSIS FTP task from failing when there are no files to download?(没有文件可下载时,如何避免 SSIS FTP 任务失败?)
本文介绍了没有文件可下载时,如何避免 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!

这篇关于没有文件可下载时,如何避免 SSIS FTP 任务失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
SSIS: Model design issue causing duplications - can two fact tables be connected?(SSIS:模型设计问题导致重复-两个事实表可以连接吗?)
SQL Server Graph Database - shortest path using multiple edge types(SQL Server图形数据库-使用多种边类型的最短路径)
Invalid column name when using EF Core filtered includes(使用EF核心过滤包括时无效的列名)
How should make faster SQL Server filtering procedure with many parameters(如何让多参数的SQL Server过滤程序更快)
How can I generate an entity–relationship (ER) diagram of a database using Microsoft SQL Server Management Studio?(如何使用Microsoft SQL Server Management Studio生成数据库的实体关系(ER)图?)