我想在ADFv2中执行SSIS包。
我创建了一个管道并使用了存储过程,如此处所述
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
但这只适用于将数据库凭据保存在包中的情况。有没有办法使用我在Integration Service Catalog的Environments属性中配置的数据库凭据来触发包?在此先感谢您的帮助!!
答案 0 :(得分: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,但应该才能正常工作。让我知道其他情况,我会看看是否可以查看有关扩展方案的一些文档