SSIS 2012:add/remove 脚本参数后元数据不同步

SSIS 2012: Metadata out of sync after add/remove script parameter

我们已经成功地部署了对 SSIS 包的几个更改,但是这个特定的更改给了我们一个错误

The component metedata is out of sync with the compiled script. Recompile the script using the Script Component Editor.

在我的跳转主机上的调试器中运行没问题。 "recompile the script" 我该怎么办?还是有更深层次的问题?

更新 1: 这个特定的脚本组件更像是一个目的地,并且是异步的。它接受输入行,所有(或大部分)输入行都在脚本中使用(它通过 Web 服务更新外部数据),只有错误情况会继续输出。

我已将问题缩小到导致此错误的绝对最小变化:添加另一个输入列(或删除 一个未使用的输入列)。准确的说,在我的跳转主机上打开Visual Studio2012的包后,双击Perform ETL任务打开Data Flow,然后双击G9 Web 服务脚本组件

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

然后我换回 Script,点击 Edit Script,等待 VstaProjects window 出现.

我要么立即关闭这个 VstaProjects window,要么我对脚本做一个非常小的改动(仅供评论),然后构建 > 构建 ScriptComponent_5aa...acb,然后按软盘(保存)符号,然后退出 Vsta。

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

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

问题: 当我登录到 my-dev-svr 时,深入 Integration Services Catalogs 和 运行 包,然后深入到 Overview Report(对于此执行)> 查看消息,我看到几个错误。最重要的是

  1. Perform ETL:Error: "G9 Web Service Script Component" failed validation and returned validation status "VS_ISBROKEN".
  2. Perform ETL:Error: The component metedata is out of sync with the compiled script. Recompile the script using the Script Component Editor.

命令行

我不完全相信这是相关的,但它是:我已经将 G9.ispac 复制到 my-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

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

必须记录脚本组件的所有details/configuration/code,然后将其删除并重新创建。然后再次加入流(用于输入和输出)。

在这种情况下,脚本是转换脚本,但在道德方面,它是一个目的地;只有错误案例才会输出。

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

重要的是要注意(在删除和重新创建之前),我总是可以在我的跳转主机上的 Visual Studio 2012 调试器中 运行 它,但是 "out of sync" 在我将 G9.ispac 文件部署到 my-dev-svr 之后发生错误(并且 运行ning 通过 SSMS > Integration Services Catalog > ... 包,或通过 SQL 服务器代理> 作业 Activity 监控 > 作业)。

另一个观察结果是, 删除和重新创建之后,我现在可以自由地向脚本添加和删除输入列 - 正是 activity之前的错误。输入列更改后,按 Edit Script... 即可,等待 VstaProjects window 出现,立即关闭它,按 [= 上的确定24=]Script Transformation Editor 对话框,并确认没有出现红色 X。

我想这是 "Have you turned it off and turned it on again?"

的 SSIS 等价物