当前位置:Gxlcms > 数据库问题 > SSISDB5:Parameter

SSISDB5:Parameter

时间:2021-07-01 10:21:17 帮助过:4人阅读

object_type : 20 (project parameter), 30 (package parameter) --value_type: V (parameter_value is a literal value),R(referencing an environment variable) --value_set:1(the parameter value has been assigned), 0 (the parameter value has not been assigned) select op.project_id,p.name as ProjectName, op.object_type, op.object_name,op.parameter_name,op.data_type, op.required,op.sensitive, op.design_default_value,op.default_value, op.value_type,op.referenced_variable_name, op.value_set from [catalog].[object_parameters] op with(NOLOCK) inner join catalog.projects p with(nolock) on op.project_id=p.project_id where object_type in(20,30)

二,通过TSQL 来使用参数

declare @Execution_ID bigint
exec catalog.create_execution @package_name=NTest.dtsx,
    @Execution_ID=@Execution_ID output,
    @folder_name=NMyProjectFloder,
    @project_name=NMyProject,
    @use32bitruntime=FALSE,
    @reference_id=null

declare @var0 sql_variant=NPackage_Parameter_value;
exec catalog.set_execution_parameter_value 
    @Execution_ID=@Execution_ID,
    @object_type=30,        --Package
    @parameter_name=NPackage_Parameter_Name,
    @parameter_value=@var0

exec catalog.start_execution @Execution_ID=@Execution_ID

 

三,特殊参数

SSISDB的特殊参数,用于控制Package执行时的特殊行为,这些参数的值,通过 catalog.set_execution_parameter_value 来设置。

  • LOGGING_LEVEL

  • CUSTOMIZED_LOGGING_LEVEL

  • DUMP_ON_ERROR

  • DUMP_ON_EVENT

  • DUMP_EVENT_CODE

  • CALLER_INFO

  • SYNCHRONIZED

 LOGGING_LEVEL – Integer – 0 | 1* | 2 | 3 – Sets the logging level for this execution.  The values represent no logging, basic, performance, and verbose levels respectively.

SYNCHRONIZED - Boolean - 0 synchronous | 1 asynchronous

 

参考文档:《SSIS Parent-Child Architecture in Catalog Deployment Mode》

First of all, by default when executing a package using T-SQL, the package is started asynchronously.  This means that when you call the stored procedure [SSISDB].[catalog].[start_execution], the T-SQL command will return immediately (assuming you passed in a valid package name and parameters), giving no indication of either success or failure.  That’s why, on this example, I’m setting the execution parameter named SYNCHRONIZED to force the T-SQL command to wait until the package has completed execution before returning.  (Note: For additional information about execution parameters, check out this post by Phil Brammer).  Second, regardless of whether you set the SYNCHRONIZED parameter, the T-SQL command will not return an error even if the package fails. 

DECLARE @execution_id BIGINT

EXEC [SSISDB].[catalog].[create_execution] @package_name = NChildPkgRemote.dtsx
    ,@execution_id = @execution_id OUTPUT
    ,@folder_name = NSSIS Parent-Child
    ,@project_name = NSSIS Parent-Child Catalog Deployment - Child
    ,@use32bitruntime = False
    ,@reference_id = NULL

-- Set user parameter value for filename
DECLARE @filename SQL_VARIANT = NE:\Dropbox\Presentations\_sampleData\USA_small1.txt

EXEC [SSISDB].[catalog].[set_execution_parameter_value] @execution_id
    ,@object_type = 30
    ,@parameter_name = NpSourceFileName
    ,@parameter_value = @filename

-- Set execution parameter for logging level
DECLARE @loggingLevel SMALLINT = 1

EXEC [SSISDB].[catalog].[set_execution_parameter_value] @execution_id
    ,@object_type = 50
    ,@parameter_name = NLOGGING_LEVEL
    ,@parameter_value = @loggingLevel

-- Set execution parameter for synchronized
DECLARE @synchronous SMALLINT = 1

EXEC [SSISDB].[catalog].[set_execution_parameter_value] @execution_id
    ,@object_type = 50
    ,@parameter_name = NSYNCHRONIZED
    ,@parameter_value = @synchronous

-- Now execute the package
EXEC [SSISDB].[catalog].[start_execution] @execution_id

-- Show status
SELECT [status] AS [execution_status]
FROM SSISDB.CATALOG.executions
WHERE execution_id = @execution_id

 

参考文档:

catalog.object_parameters (SSISDB Database)

catalog.set_execution_parameter_value (SSISDB Database)

Quick Tip – Run SSIS 2012 packages synchronously and other execution parameters

 

SSISDB5:Parameter

标签:

人气教程排行