标签:
数据分流就是类似于数据流Path的Data Viewer,数据分流能够将数据导入一个file中,便于查看数据流中的数据。数据流分流必须通过代码来实现。
To add data taps, the instance of the execution must be in the created state (a value of 1 in the status column of the catalog.operations (SSISDB Database)view) . The state value changes once you run the execution.
Declare @execution_id bigint EXEC [SSISDB].[catalog].[create_execution] @package_name=N‘Package.dtsx‘, @execution_id=@execution_id OUTPUT, @folder_name=N‘Demo‘, @project_name=N‘ISStudy‘, @use32bitruntime=False, @reference_id=1 Select @execution_id DECLARE @var0 smallint = 1 EXEC [SSISDB].[catalog].[set_execution_parameter_value] @execution_id, @object_type=50, @parameter_name=N‘LOGGING_LEVEL‘, @parameter_value=@var0 exec SSISDB.catalog.add_data_tap @execution_id=@execution_id, @task_package_path=N‘\Package\Data Flow Task‘, @dataflow_path_id_string=N‘Paths[OLE DB Source.OLE DB Source Output]‘, @data_filename=N‘datatap.csv‘ EXEC [SSISDB].[catalog].[start_execution] @execution_id GO
@data_filename:是存储数据分流的文件名称,文件路径是固定的,不能更改,通常在SQL Server按照目录的Folder中创建数据分流文件
@task_package_path:是Data Flow Task的 PackagePath 属性值
@dataflow_path_id_string:是Data Flow Path的 IdentificationString 属性值
参考文档:
add_data_tap [ @execution_id = ] execution_id [ @task_package_path = ] task_package_path [ @dataflow_path_id_string = ] dataflow_path_id_string [ @data_filename = ] data_filename [ @max_rows = ] max_rows [ @data_tap_id = ] data_tap_id OUTPUT
[ @task_package_path = ] task_package_path
The package path for the data flow task. The PackagePath property for the data flow task specifies the path. The path is case-sensitive. To locate the package path, in SQL Server Data Tools right-click the Data Flow task, and then click Properties. The PackagePath property appears in the Properties window.
The task_package_path is a nvarchar(max).
[ @dataflow_path_id_string = ] dataflow_path_id_string
The identification string for the data flow path. A path connects two data flow components. The IdentificationString property for the path specifies the string.
To locate the identification string, in SQL Server Data Tools right-click the path between two data flow components and then click Properties. The IdentificationString property appears in the Properties window.
The dataflow_path_id_string is a nvarchar(4000).
[ @data_filename = ] data_filename
The name of the file that stores the tapped data. If the data flow task executes inside a Foreach Loop or a For Loop container, separate files store tapped data for each iteration of the loop. Each file is prefixed with a number that corresponds to an iteration.
By default, the file is stored in the <drive>:\Program Files\Microsoft SQL Server\110\DTS\DataDumps folder.
The data_filename is a nvarchar(4000).
Remarks
To add data taps, the instance of the execution must be in the created state (a value of 1 in the status column of the catalog.operations (SSISDB Database)view) . The state value changes once you run the execution. You can create an execution by calling catalog.create_execution (SSISDB Database).
The following are considerations for the add_data_tap stored procedure.
If an execution contains a parent package and one or more child packages, you need to add a data tap for each package that you want to tap data for.
If a package contains more than one data flow task with the same name, the task_package_path uniquely identifies the data flow task that contains the component output that is tapped.
When you add data tap, it is not validated before the package is run.
It is recommended that you limit the number of rows that are captured during the data tap, to avoid generating large data files. If the machine on which the stored procedure is executed, runs out of storage space for the data files, the package stops running and an error message is written to a log.
Running the add_data_tap stored procedure impacts the performance of the package. It is recommended that you run the stored procedure only to troubleshoot data issues.
To access the file that stores the tapped data, you must be an administrator on the machine on which the stored procedure is run. You must also be the user who started the execution that contains the package with the data tap.
标签:
原文地址:http://www.cnblogs.com/ljhdo/p/5493151.html