SSIS 2012:添加/删除脚本参数

时间:2017-04-17 14:12:50

标签: sql-server ssis ssis-2012

我们已成功部署了多个SSIS包的更改,但是这个特定的更改给我们带来了错误

  

组件metedata与已编译的脚本不同步。使用脚本组件编辑器重新编译脚本。

它在我的跳转主机上的调试器中运行正常。我该怎么办"重新编译脚本"?还是有更深层次的问题?

UPDATE 1:此特定脚本组件更像是目标,而且是异步的。它接受输入行,并且所有(或大多数)行都在脚本中使用(它通过Web服务更新外部数据),只有错误情况一直持续到输出。

我已将问题缩小到导致此错误的绝对最小更改:添加另一个输入列(或删除未使用的输入列)。确切地说,在我的跳转主机上打开Visual Studio 2012中的包之后,双击执行ETL 任务以打开数据流,然后双击 G9 Web服务脚本组件

Screenshot of Script Component properties

我切换到输入列 - 有16个勾选/列出 - 我取消了一个实际上没有在脚本中使用的。或者我勾选(添加)另一列(我想在脚本中使用)。

然后我换回脚本,点击编辑脚本,然后等待VstaProjects窗口出现。

我要么立即关闭这个VstaProjects窗口,要么对脚本进行非常小的更改(仅限评论),然后构建>构建ScriptComponent_5aa ... acb,然后按下软盘(保存)符号,然后退出Vsta。

然后我在调试器中运行(按绿色启动箭头)并按预期运行。我通过右键单击项目(G9)并选择 Build 来构建(在调试器中运行后,这可能是多余的)。

在Windows(文件)资源管理器中,我导航到G9/bin/Development文件夹,双击G9.ispac(步骤部署:项目开发文件; my-dev-svr; SSISDB> ACME-SSIS (提供SSISDB/ACME-SSIS/G9);部署!

问题:当我登录my-dev-svr时,深入了解Integration Services目录并运行该程序包,然后深入查看概述报告(执行此操作)>查看消息,我看到几个错误。最重要的是

  
      
  1. 执行ETL:错误:" G9 Web服务脚本组件"验证失败并返回验证状态" VS_ISBROKEN"。
  2.   
  3. 执行ETL:错误:组件metedata与编译的脚本不同步。使用脚本组件编辑器重新编译脚本。
  4.   

命令行

我并不完全相信这是相关的,但这里是:我已将G9.ispac复制到我的-dev-svr,然后登录并在命令行中执行DTEXEC。请记住,这是SSIS debugging does not work

所在的服务器
D:\ACME\Deploy\SSIS>dtexec /Project G9.ispac /Package ACMEPortal_ProjectProperties_G9.dtsx
Microsoft (R) SQL Server Execute Package Utility
Version 11.0.6020.0 for 64-bit
Copyright (C) Microsoft Corporation. All rights reserved.
Started:  10:51:21 PM
Warning: 2017-04-17 22:51:21.74
   Code: 0xC0016016
   Source:  SSIS:Property
   Description: Failed to decrypt an encrypted XML node. Verify that the project was created by the same user. Project load will attempt to continue without the encrypted information.
End Warning
Warning: 2017-04-17 22:51:21.74
   Code: 0x800190FF
   Source:
   Description: Failed to decrypt sensitive data in project with a user key. You may not be the user who encrypted this project, or you are not using the same machine that was used to save the project. If the sensitive data is a parameter value, the value may be required to run the package on the Integration Services server.
End Warning
Progress: 2017-04-17 22:51:25.61
   Source: Get ETL Configuration
   Executing query "etl_GetGenericETLConfigForACME".: 100% complete
End Progress
Progress: 2017-04-17 22:51:25.64
   Source: Get G9 Web Service Connection Config Details
   Executing query "etl_GetG9WSConfigSettings".: 100% complete
End Progress
Progress: 2017-04-17 22:51:25.65
   Source: Audit ETL Initiation
   Executing query "dbo.etl_AuditInitiation".: 100% complete
End Progress
Warning: 2017-04-17 22:51:25.68
   Code: 0x80019002
   Source: OnError
   Description: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED.  The Execution method succeeded, but the number of errors raised (6) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
End Warning
Error: 2017-04-17 22:51:25.68
   Code: 0xC0010026
   Source: Set Propogate Error to False
   Description: The task has failed to load. The contact information for this task is "".
End Error
Error: 2017-04-17 22:51:25.71
   Code: 0xC0024107
   Source: Set Propogate Error to False
   Description: There were errors during task validation.
End Error
Error: 2017-04-17 22:51:25.71
   Code: 0xC0010026
   Source: Set FilenamePart and Error Variables
   Description: The task has failed to load. The contact information for this task is "".
End Error
Warning: 2017-04-17 22:51:25.72
   Code: 0x80019002
   Source: OnError
   Description: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED.  The Execution method succeeded, but the number of errors raised (10) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
End Warning
Error: 2017-04-17 22:51:25.72
   Code: 0xC0010026
   Source: Set Propogate Error to False
   Description: The task has failed to load. The contact information for this task is "".
End Error
Error: 2017-04-17 22:51:25.73
   Code: 0xC0024107
   Source: Set Propogate Error to False
   Description: There were errors during task validation.
End Error
Error: 2017-04-17 22:51:25.73
   Code: 0xC0024107
   Source: Set FilenamePart and Error Variables
   Description: There were errors during task validation.
End Error
Warning: 2017-04-17 22:51:25.74
   Code: 0x80019002
   Source: ACMEPortal_ProjectProperties_G9
   Description: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED.  The Execution method succeeded, but the number of errors raised (8) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
End Warning
DTExec: The package execution returned DTSER_FAILURE (1).
Started:  10:51:21 PM
Finished: 10:51:25 PM
Elapsed:  4.344 seconds

更新2:脚本组件的摘录。

' Microsoft SQL Server Integration Services user script component
' This is your new script component in Microsoft Visual Basic .NET
' ScriptMain is the entrypoint class for script components

Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Imports ScriptComponentTaskUtility.ACME_ETLDataFlowScriptComponentTasks '-- custom toolkit
Imports ScriptComponentTaskUtility
Imports Microsoft.SqlServer.Dts
Imports System.Windows.Forms

<Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute> _
<CLSCompliant(False)> _
Public Class ScriptMain
    Inherits UserComponent

    Private _updateLimit As Integer

    Private _rowCount As Integer

    Public Overrides Sub PreExecute()
        MyBase.PreExecute()
        '  
        ' Our application code follows 
        _updateLimit = 2   '-- Intending to replace this hard-coding
        _rowCount = 0
    End Sub

    Public Overrides Sub G9ProjectInput_ProcessInputRow(ByVal Row As G9ProjectInputBuffer)

        Try
            ' We limit the updated records to X per run (X = 2, but want to make configurable).
            ' Next ETL run will pick up next X
            _rowCount += 1
            If (_updateLimit > 0 And _rowCount > _updateLimit) Then Exit Sub

            Dim taskComponent As G9Project = New G9Project(Me.UserID, Me.Password, Me.Config, Me.WSURL)
            Dim readResponse As Project_DoReadResponse
            ''MessageBox.Show(Me.WSURL)
            readResponse = taskComponent.ReadProject(Row.g9ProjectNumber, Row.Planet)


            If (readResponse.Errors.Items.Length > 0) Then
                CreateErrorRows(Row, readResponse.Errors.Items(0).ShortDescription)
                Exit Sub
            End If
            Dim g9Project As Project = readResponse.Project

            '**********************************
            'Change the property values here
            Try


                ' Who's in charge? The Manager or Owner?
                If Not (Row.acmeInChargeCode_IsNull) Then
                    g9Project.SelectionCodes(10).Value = Row.acmeInChargeCode.ToString
                End If

                ' ... other fields

            Catch ex As Exception
                Row.ErrorColumnName = "Web Service Error"
                CreateErrorRows(Row, ex.Message)
                Exit Sub
            End Try

            'End of change of property values
            '**********************************

            Dim updateResponse As ResponseBase
            updateResponse = taskComponent.UpdateProject(g9Project)
            If (updateResponse.Errors.Items.Length > 0) Then
                CreateErrorRows(Row, updateResponse.Errors.Items(0).ShortDescription)
                Exit Sub
            End If
        Catch ex As Exception
            CreateErrorRows(Row, ex.Message)
            Exit Sub
        End Try
    End Sub

' #Region ************************ NOTE: Copy & paste following code block *********************
' contains private member variables, etc, including CreateErrorRows()

End Class

2 个答案:

答案 0 :(得分:2)

必须记录脚本组件的所有详细信息/配置/代码,然后删除它并重新创建它。然后再次加入流程(输入和输出)。

在这种情况下,脚本是 Transformation 脚本,但从道德角度讲,它是一个目的地;只有错误情况才能通过输出。

还有第二个脚本组件也必须作为同一个bug修复的一部分进行更改。为输入添加额外的列也会触发错误,因此还需要对此进行相同的删除和重新创建。它也是一个 Transformation 脚本,但这是完全同步的(每个输入行都会通过输出,一些读写输入列被更改,一些其他只读输入列被复制/过滤到其他输出栏)。

重要的是要注意(在删除和重新创建之前),我总是可以在我的跳转主机上的Visual Studio 2012调试器中运行它,但是在我部署{之后发生了“不同步”错误{1}}文件到G9.ispac(并通过SSMS&gt; Integration Services目录&gt; ...包运行,或通过SQL Server代理&gt;作业活动监视器&gt;作业运行)。

另外一个观察,之后删除并重新创建,我现在可以自由地添加和删除脚本的输入列 - 导致错误先前的活动。完成输入列更改后,按编辑脚本... 就足够了,等待VstaProjects窗口出现,立即关闭,按脚本转换编辑器上的确定对话框,并确认没有出现红色X.

我猜这是SSIS相当于“你把它关掉并重新打开了吗?”

答案 1 :(得分:1)

由于您已经完成了脚本并确保脚本正常工作。那么它很有可能在你的destination中出现问题。您似乎使用Script component作为数据源,尝试从源的输出中检查Metadata(右键单击优先约束),检查它们是否与目标输入匹配更重要的是,如果您对源列进行了任何更改,则最好删除并创建新目标,有时可能会缓存不再存在的列。