本文介绍了SSIS 包属性“ForceExecutionResult"没有按预期工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 SSIS 包/任务设置方面遇到了一些问题.

I have some problem in SSIS package/task setting .

我有通过 Sql 服务器(SSIS 包)运行的每日计划任务.在工作任务中包含几个步骤.

I have daily schedule task running via Sql server (SSIS Package).In job task contain a few step.

问题是SendMail Task"有时失败.有一段时间邮件服务器关闭了.如果 SendMail 任务因为服务器宕机而出错.由于包返回失败,所有包将无法正常运行.

The problem is "SendMail Task" failed sometime.Some time mail server is down. If SendMail task error because server down.All package won't run correctly because package return failure.

这是我尝试测试的内容.

This is what I have try to test.

我创建了一个简单的包在 VS2008 中进行测试包中包含两个 SendMail 任务.第一个是完整的任务(正确配置每件事).第二个是失败任务(我设置了错误的接收电子邮件地址)

I create a simple package to test in VS2008In package contain two SendMail tasks.The 1st is a complete task (Config every thing correctly).The 2nd is a failure task (I set wrong receive email address)

在第二个任务中我设置了属性-MaxiMumErrorCount --> 从 1 --> 20-ForceExcutionResult --> 从无" --> 成功"

In the 2nd task i set property-MaxiMumErrorCount --> From 1 --> 20-ForceExcutionResult --> From "None" --> "Success"

当我从 VS2008 执行包时,看起来不错.一切还好.包返回成功结果.

When I execute package from VS2008 that's look fine. Every thing OK. Package return success result.

但是当我在 SQL Server 作业(代理)中创建作业计划任务时.并试运行包.包仍然返回失败.我对这个案子很困惑.而且我不想在包属性中将ForceExcutionResult"值设置为Success".我只希望即使电子邮件任务失败也可以运行包.我该怎么做才能解决这个问题?

But when i create job schedule task in SQL Server job (Agent).And test run package. Package still return failure. I'm so confuse for this case.And I don't want to set "ForceExcutionResult" value to be "Success" in package property.I just want package can be running even if Email task has failed.How can i do for solve this problem ?

Thanapat.s

推荐答案

我发现几个链接非常有帮助,并使用错误事件处理程序解决了它(因为在我的情况下,如果任务失败,但随后继续执行而没有包失败).

I found a couple of links very helpful and solved it with an on-error event handler (because in my case, I want to send an email if the task fails, but then continue execution without package failure).

所以,我创建了一个事件处理程序,并让它强制执行完成(你可以强制成功),但让它不失败的关键是:

So, I created an event handler, and have it force-execution to completion (you could force success) but the key to making it not fail is:

  1. 系统变量Propagate"在我的事件处理程序中设置为 false.
  2. MaximumErrorCount 在任务本身中设置为 0.这是不让程序包失败的关键.
  1. System variable "Propagate" is set to false in my event handler.
  2. MaximumErrorCount is set to 0 in the task itself. This was key to not having the package fail.

感谢:没有文件下载时如何避免 SSIS FTP 任务失败?

答案链接到:http://sqlblog.com/blogs/rushabh_mehta/archive/2008/04/24/gracefully-handing-task-error-in-ssis-package.aspx

这让我来到这里:http://agilebi.com/jwelch/2008/06/29/continuing-a-loop-after-an-error/#comment-57484

哪个有效!

这篇关于SSIS 包属性“ForceExecutionResult"没有按预期工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 10:53