SSIS 包在部署 SQL Server 2012 后出错 [英] SSIS package gives error after deployment SQL Server 2012

查看:23
本文介绍了SSIS 包在部署 SQL Server 2012 后出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Studio 2015 中创建了一个包.它运行良好.

I created a package in Visual Studio 2015. It works fine.

基本上我正在使用一个脚本任务来生成 Excel 电子表格并将其发送给不同的用户.

Basically I am using a script task that generates Excel spreadsheet and sends it to different users.

在我将包部署到 SQL Server 2012 并尝试从那里执行之后 - 我收到一个没有任何进一步细节的错误.

After I deploy the package to SQL Server 2012 and then try to execute it from there - I get an error without any further details.

我还从 SSISDB 运行 select * from internal.packages 以确保 package_format_version 为 6,这应该是 SQL Server 2012 的值.

I also run select * from internal.packages from SSISDB to make sure package_format_version is 6, which is what should be for SQL Server 2012.

可能是什么问题?

推荐答案

这不一定是关于如何解决问题的答案,而是关于如何修改脚本任务以获得更好的错误消息的答案脚本任务失败:已抛出异常..."

This necessarily isn't an answer on how to fix the issue, but it's an answer on how you can modify your script task to get a better error message then "Script Task Failure: Exception has been thrown..."

我们总是将我们的脚本任务包装在一个 try-catch 中,然后将异常消息从脚本任务中抛出:

We'll always wrap our script tasks in a try-catch and then raise the exception message back out of the script task:

    public void Main()
    {
        try
        {

            //Your code here

            Dts.TaskResult = (int)ScriptResults.Success;
        }
        catch (Exception ex)
        {
            Dts.Events.FireError(-1, "", ex.Message, String.Empty, 0);
            Dts.TaskResult = (int)ScriptResults.Failure;
        }
    }

这始终是一个挑战,尤其是对于已部署的 SSIS 包,当它在脚本任务上出错时,您不一定能清楚地了解它失败的原因,并且您会收到一条神秘的错误消息.上面的代码将捕获抛出异常的内容并将其返回给集成服务.

It's always a challenge, especially with a deployed SSIS package, when it errors on a scrip task you don't necessarily get a clear indication as to why it's failing and you get a cryptic error message. The above code will capture what threw the exception and bubble back out to integration services what that was.

这篇关于SSIS 包在部署 SQL Server 2012 后出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆