1

我想在 ADFv2 中执行一个 SSIS 包。

我创建了一个管道并为它使用了一个存储过程,如此处所述

https://docs.microsoft.com/en-us/azure/data-factory/how-to-invoke-ssis-package-stored-procedure-activity

DECLARE @return_value INT, @exe_id BIGINT, @err_msg NVARCHAR(150)    
EXEC @return_value=[SSISDB].[catalog].[create_execution] 
@folder_name=N'xxx', 
@project_name=N'xxx', 
@package_name=N'xxx.dtsx', 
@use32bitruntime=0, @runinscaleout=1, @useanyworker=1, @execution_id=@exe_id OUTPUT    

EXEC [SSISDB].[catalog].[set_execution_parameter_value] @exe_id, @object_type=50, @parameter_name=N'SYNCHRONIZED', @parameter_value=1    
EXEC [SSISDB].[catalog].[start_execution] @execution_id=@exe_id, @retry_count=0    

IF(SELECT [status] FROM [SSISDB].[catalog].[executions] WHERE execution_id=@exe_id)<>7 
BEGIN 
SET @err_msg=N'Your package execution did not succeed for execution ID: ' 
+ CAST(@exe_id AS NVARCHAR(20)) RAISERROR(@err_msg,15,1) 
END

但这仅在数据库凭据保存在包中时才有效。有没有办法使用我在集成服务目录的环境属性中配置的数据库凭据触发包?提前感谢您的帮助!! 

4

1 回答 1

0

在非 ADF 场景中,create_execution调用接受的参数为@reference_id

您可以通过查询 SSISDB 来判断该值

SELECT ER.reference_id
FROM SSISDB.catalog.folders AS F
INNER JOIN SSISDB.catalog.environments AS E
ON E.folder_id = F.folder_id
INNER JOIN SSISDB.catalog.projects AS P
ON P.folder_id = F.folder_id
INNER JOIN SSISDB.catalog.environment_references AS ER
ON ER.project_id = P.project_id
WHERE F.name = 'MyFolder' AND E.name = 'EnvDemo' AND P.name = 'MyIspac'

把它们放在一起,你的脚本可能看起来像

DECLARE @return_value INT, @exe_id BIGINT, @err_msg NVARCHAR(150), @refid bigint;

SELECT @refid = ER.reference_id
FROM SSISDB.catalog.folders AS F
INNER JOIN SSISDB.catalog.environments AS E
ON E.folder_id = F.folder_id
INNER JOIN SSISDB.catalog.projects AS P
ON P.folder_id = F.folder_id
INNER JOIN SSISDB.catalog.environment_references AS ER
ON ER.project_id = P.project_id
WHERE F.name = 'MyFolder' AND E.name = 'EnvDemo' AND P.name = 'MyIspac';

EXEC @return_value=[SSISDB].[catalog].[create_execution] 
@folder_name=N'xxx', 
@project_name=N'xxx', 
@package_name=N'xxx.dtsx', 
@reference_id = @refid
@use32bitruntime=0, @runinscaleout=1, @useanyworker=1, @execution_id=@exe_id OUTPUT

未经 ADF 测试,但它应该可以工作。否则让我知道,我会看看我是否可以吓到一些关于横向扩展方案的文档

于 2018-02-14T17:01:00.090 回答