如何调试并找到卡住 SSIS 包的原因?

How can I debug and find the reason for stuck SSIS packages?

我有一个 SSIS 包,它已经 运行 很久了。当我检查服务器中所有执行报告中的所有消息时,我看到它处于执行阶段开始。请检查以下屏幕截图。

请指导我如何调试它。提前致谢。

警告消息是:

The lookup ... encountered duplicate reference key values when caching reference data. This error occurs in Full Cache mode only. Either remove the duplicate key values, or change the cache mode to PARTIAL or NO_CACHE."

请验证您在连接输入和引用的列上没有重复值 table。

如果您在查找 table 中连接 col1,则 运行 查询以检查是否存在重复项,例如:

SELECT col1,Count(*) FROM LookupTable
GROUP BY col1
HAVING COUNT(*)>1

类似问题

检查查找键上的重复项(而不是其各个列成员上的重复项)。以下查询可用于识别重复记录并识别完美的查找键:

select row_number() over(partition by /*LookUp Key*/ [Column1], [Column2], ..., [ColumnN]
                     order by /*LookUp Key*/ [Column1], [Column2], ..., [ColumnN]
                     ) row_
    ,*
from [Database].schema.[Reference Table]
--where 1=1 

当"row_"列大于1时,表示您的Lookup Key引用了重复的记录。为了解决这个问题,您可以尝试使用另一个 Look Up Key 来获取参考数据,或者您可以在上面的 Lookup Key 的 SSIS Look Up Task 中使用以下代码获得唯一的 Reference Data 记录:

--Reference data without Lookup key duplicates
with reference_data as (
select   [Column1]
        ,[Column2]
        ,...
        ,[ColumnN]

        ,row_number() over(partition by /*LookUp Key*/partition by /*LookUp Key*/ [Column1], [Column2], ..., [ColumnN]
                     order by [Reference Data Unique Key] desc
                     ) row_
from [Database].schema.[Reference Table]
)
select [Column1]
    ,[Column2]
    ,...
    ,[ColumnX]
from reference_data
where row_ = 1

一般来说,查找键(不是组成它的列)必须是唯一的,这样就不会提示此错误。