2013-07-18 76 views
4

當指向遠程SSIS包時,有沒有辦法讓dtexec工具不能退出,直到包完成運行?使用dtexec執行遠程ssis包

我的軟件包成功運行,但dtexec報告的運行時間比SQL Server上「所有執行」報告中報告的實際持續時間短得多。 它打印消息:

To view the details for the execution, right-click on the Integration Services Catalog, and open the [All Executions] report 

我的目標是揭開序幕DTEXEC在命令行上,然後運行依賴於包裝完成其他代碼。理想情況下,我希望dtexec在包完成運行之前不會退出。

這可能嗎?

回答

4

您正在尋找SYNCHRONIZED參數

爲了讓我的鏈接只能回答到鏈接和代碼只能回答,這裏是菲爾的代碼做withing TSQL

DECLARE @execution_id BIGINT = 0; 

-- Create a package execution 
EXEC [SSISDB].[catalog].[create_execution] 
     @package_name=N'Package.dtsx', 
     @[email protected]_id OUTPUT, 
     @folder_name=N'PhilsTest', 
     @project_name=N'Demo', 
     @use32bitruntime=False; 

EXEC [SSISDB].[catalog].[set_execution_parameter_value] 
     @execution_id, 
     @object_type=50, 
     @parameter_name=N'SYNCHRONIZED', 
     @parameter_value=1; -- true 


-- Start the package 
EXEC [SSISDB].[catalog].[start_execution] 
     @execution_id; 

要得到相同的行爲dtexec,你會指定參數,如

DTExec 
/ISSERVER "\SSISDB\folderB\Integration Services Project17\Package.dtsx" 
/SERVER "." /Envreference 2 
/Par "$Project::ProjectParameter(Int32)";1 /Par "Parameter(Int32)";21 
/Par "CM.sqlcldb2.SSIS_repro.InitialCatalog";ssisdb 
/Par "$ServerOption::SYNCHRONIZED(Boolean)";True 
+0

這樣做的伎倆。謝謝! – TGH