dtexec 公用程式dtexec Utility

dtexec命令提示字元公用程式用來設定及執行[SQL Server]SQL ServerIntegration ServicesIntegration Services封裝。The dtexec command prompt utility is used to configure and execute [SQL Server]SQL Server Integration ServicesIntegration Services packages. dtexec 公用程式可存取所有封裝組態及執行功能,例如參數、連接、屬性、變數、記錄與進度指標。The dtexec utility provides access to all the package configuration and execution features, such as parameters, connections, properties, variables, logging, and progress indicators. dtexec公用程式可讓您從這些來源載入封裝:Integration ServicesIntegration Services伺服器、.ispac 專案檔案, MicrosoftMicrosoft [SQL Server]SQL Server資料庫,SSISSSIS封裝存放區和檔案系統。The dtexec utility lets you load packages from these sources: the Integration ServicesIntegration Services server, an .ispac project file, a MicrosoftMicrosoft [SQL Server]SQL Server database, the SSISSSIS Package Store, and the file system.

注意

當您使用 SQL Server 2012 Integration Services (SSIS)SQL Server 2012 Integration Services (SSIS) 隨附的 dtexec 公用程式版本執行 SQL Server 2005 Integration Services (SSIS)SQL Server 2005 Integration Services (SSIS)SQL Server 2008 Integration Services (SSIS)SQL Server 2008 Integration Services (SSIS) 封裝時,Integration ServicesIntegration Services 會暫時將封裝升級為 SQL Server 2012 Integration Services (SSIS)SQL Server 2012 Integration Services (SSIS)When you use the version of the dtexec utility that comes with SQL Server 2012 Integration Services (SSIS)SQL Server 2012 Integration Services (SSIS) to run a SQL Server 2005 Integration Services (SSIS)SQL Server 2005 Integration Services (SSIS) or a SQL Server 2008 Integration Services (SSIS)SQL Server 2008 Integration Services (SSIS) package, Integration ServicesIntegration Services temporarily upgrades the package to SQL Server 2012 Integration Services (SSIS)SQL Server 2012 Integration Services (SSIS). 但您無法使用 dtexec 公用程式儲存這些升級的變更。However, you cannot use the dtexec utility to save these upgraded changes. 如需如何永久地將升級封裝的詳細資訊SQL Server 2012 Integration Services (SSIS)SQL Server 2012 Integration Services (SSIS),請參閱 < 升級 Integration Services 封裝For more information about how to permanently upgrade a package to SQL Server 2012 Integration Services (SSIS)SQL Server 2012 Integration Services (SSIS), see Upgrade Integration Services Packages.

本主題包含下列各節:This topic includes the following sections:

Integration Services 伺服器及專案檔案Integration Services Server and Project File

當您使用dtexec上執行封裝Integration ServicesIntegration Services伺服器dtexec呼叫catalog.create_execution (SSISDB 資料庫)catalog.set_execution_parameter_值(SSISDB 資料庫)catalog.start_execution (SSISDB 資料庫)預存程序,以建立執行、 設定參數值,並啟動執行。When you use dtexec to run packages on the Integration ServicesIntegration Services server, dtexec calls the catalog.create_execution (SSISDB Database), catalog.set_execution_parameter_value (SSISDB Database) and catalog.start_execution (SSISDB Database) stored procedures to create an execution, set parameter values and start the execution. 所有執行記錄都可以從伺服器的相關檢視中查看,或透過 SQL Server Management StudioSQL Server Management Studio中提供的標準報表查看。All execution logs can be seen from the server in the related views or by using standard reports available in SQL Server Management StudioSQL Server Management Studio. 如需報表的詳細資訊,請參閱 Integration Services 伺服器的報表For more information about the reports, see Reports for the Integration Services Server.

以下是執行 Integration ServicesIntegration Services 伺服器上的封裝範例。The following is an example of executing a package on the Integration ServicesIntegration Services server.

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  

當您使用 dtexec 從 .ispac 專案檔案行封裝時,相關的選項為:/Proj[ect] 和 /Pack[age],這些選項用來指定專案路徑及封裝資料流名稱。When you use dtexec to run a package from the .ispac project file, the related options are: /Proj[ect] and /Pack[age] that are used to specify the project path and package stream name. 當您從 執行 [Integration Services 專案轉換精靈] SQL Server Management StudioSQL Server Management Studio,以便將專案轉換至專案部署模型時,此精靈會產生一個 .ispac 專案檔案。When you convert a project to the project deployment model by running the Integration Services Project Conversion Wizard from SQL Server Management StudioSQL Server Management Studio, the wizard generates an .ispac projec file. 如需詳細資訊,請參閱將專案部署至 Integration Services 伺服器For more information, see Deploy Projects to Integration Services Server.

您可以使用dtexec搭配協力廠商排程工具來排程封裝部署到Integration ServicesIntegration Services伺服器。You can use dtexec with third-party scheduling tools to schedule packages that are deployed to the Integration ServicesIntegration Services server.

64 位元電腦上的安裝考量Installation Considerations on 64-bit Computers

在 64 位元電腦上,Integration ServicesIntegration Services 會安裝 64 位元版本的 dtexec 公用程式 (dtexec.exe)。On a 64-bit computer, Integration ServicesIntegration Services installs a 64-bit version of the dtexec utility (dtexec.exe). 如果您必須用 32 位元模式執行特定封裝,必須安裝 32 位元版本的 dtexec 公用程式。If you have to run certain packages in 32-bit mode, you will have to install the 32-bit version of the dtexec utility. 如果要安裝 32 位元版本的 dtexec 公用程式,必須在安裝期間選取用戶端工具或 SQL Server Data Tools (SSDT)SQL Server Data Tools (SSDT)To install the 32-bit version of the dtexec utility, you must select either Client Tools or SQL Server Data Tools (SSDT)SQL Server Data Tools (SSDT) during setup.

根據預設,同時安裝了 64 位元和 32 位元版之 Integration ServicesIntegration Services 命令提示字元公用程式的 64 位元電腦將會在命令提示字元上執行 32 位元版本。By default, a 64-bit computer that has both the 64-bit and 32-bit versions of an Integration ServicesIntegration Services command prompt utility installed will run the 32-bit version at the command prompt. 執行 32 位元版本是因為 32 位元版本的目錄路徑在 PATH 環境變數中會出現在 64 位元版本的目錄路徑前面The 32-bit version runs because the directory path for the 32-bit version appears in the PATH environment variable before the directory path for the 64-bit version. (一般來說,32 位元的目錄路徑是 <磁碟機> :\Program Files(x86)\Microsoft SQL Server\110\DTS\Binn,而 64 位元的目錄路徑是 <磁碟機> :\Program Files\Microsoft SQL Server\110\DTS\Binn)。(Typically, the 32-bit directory path is <drive>:\Program Files(x86)\Microsoft SQL Server\110\DTS\Binn, while the 64-bit directory path is <drive>:\Program Files\Microsoft SQL Server\110\DTS\Binn.)

注意

如果您使用 SQL Server Agent 執行此公用程式,SQL Server Agent 會自動使用 64 位元版的公用程式。If you use SQL Server Agent to run the utility, SQL Server Agent automatically uses the 64-bit version of the utility. SQL Server Agent 會使用此登錄 (而不是 PATH 環境變數) 來尋找此公用程式的正確可執行檔。SQL Server Agent uses the registry, not the PATH environment variable, to locate the correct executable for the utility.

若要確保您可在命令提示字元上執行 64 位元版的公用程式,您可以採取下列其中一個動作:To ensure that you run the 64-bit version of the utility at the command prompt, you can take one of the following actions:

  • 開啟 [命令提示字元] 視窗,然後將目錄切換到包含 64 位元版公用程式的目錄 (<磁碟機> :\Program Files\Microsoft SQL Server\110\DTS\Binn),再從該位置執行公用程式。Open a Command Prompt window, change to the directory that contains the 64-bit version of the utility (<drive>:\Program Files\Microsoft SQL Server\110\DTS\Binn), and then run the utility from that location.

  • 在命令提示字元上,輸入 64 位元版公用程式的完整路徑 (<磁碟機> :\Program Files\Microsoft SQL Server\110\DTS\Binn),以執行此公用程式。At the command prompt, run the utility by entering the full path (<drive>:\Program Files\Microsoft SQL Server\110\DTS\Binn) to the 64-bit version of the utility.

  • 在 PATH 環境變數中將 64 位元路徑 (<磁碟機> :\Program Files\Microsoft SQL Server\110\DTS\Binn) 置於 32 位元路徑 (<磁碟機> :\ Program Files(x86)\Microsoft SQL Server\110\DTS\Binn) 之前,可以永久變更該變數中的路徑順序。Permanently change the order of the paths in the PATH environment variable by placing the 64-bit path (<drive>:\Program Files\Microsoft SQL Server\110\DTS\Binn) before the 32-bit path (<drive>:\ Program Files(x86)\Microsoft SQL Server\110\DTS\Binn) in the variable.

擁有並存安裝之電腦的考量Considerations on Computers with Side-by-Side Installations

如果 SQL Server 2014 Integration Services (SSIS)SQL Server 2014 Integration Services (SSIS) 安裝在已安裝 SQL Server 2005 Integration Services (SSIS)SQL Server 2005 Integration Services (SSIS)SQL Server 2008 Integration Services (SSIS)SQL Server 2008 Integration Services (SSIS) 的電腦上,則會安裝多個版本的 dtexec 公用程式。When SQL Server 2014 Integration Services (SSIS)SQL Server 2014 Integration Services (SSIS) is installed on a machine that has SQL Server 2005 Integration Services (SSIS)SQL Server 2005 Integration Services (SSIS) or SQL Server 2008 Integration Services (SSIS)SQL Server 2008 Integration Services (SSIS) installed, multiple versions of the dtexec utility are installed.

為確保您執行正確的公用程式版本,請在命令提示字元中輸入完整路徑 (<磁碟機> :\Program Files\Microsoft SQL Server\<版本>\DTS\Binn) 來執行公用程式。To ensure that you run the correct version of the utility, at the command prompt run the utility by entering the full path (<drive>:\Program Files\Microsoft SQL Server\<version>\DTS\Binn).

執行階段Phases of Execution

這個公用程式有四個執行階段。The utility has four phases that it proceeds through as it executes. 執行階段如下所示:The phases are as follows:

  1. 命令來源階段:命令提示字元讀取已指定的選項及引數清單。Command sourcing phase: The command prompt reads the list of options and arguments that have been specified. 如果遇到了 /?All subsequent phases are skipped if a /? /HELP 選項,則會略過所有後續的階段。or /HELP option is encountered.

  2. 套件載入階段:所指定的封裝/SQL/file,或/DTS載入選項。Package load phase: The package specified by the /SQL, /FILE, or /DTS option is loaded.

  3. 設定階段:選項會依下列順序處理:Configuration phase: Options are processed in this order:

    • 設定封裝旗標、變數和屬性的選項。Options that set package flags, variables, and properties.

    • 確認封裝的版本和建置的選項。Options that verify the package version and build.

    • 設定公用程式之執行階段行為的選項,例如報告。Options that configure the run-time behavior of the utility, such as reporting.

  4. 驗證及執行階段:執行套件,如有指定 /VALIDATE 選項,則只會驗證套件而不會執行套件。Validation and execution phase: The package is run, or validated without running if the /VALIDATE option was specified.

傳回的結束碼Exit Codes Returned

從 dtexec 公用程式傳回的結束碼Exit codes returned from dtexec utility

封裝執行期間,dtexec 可能會傳回結束碼。When a package runs, dtexec can return an exit code. 結束碼可用來擴展 ERRORLEVEL 變數,讓您可以在批次檔內的條件陳述式或分支邏輯中測試此變數的值。The exit code is used to populate the ERRORLEVEL variable, the value of which can then be tested in conditional statements or branching logic within a batch file. 下表列出 dtexec 公用程式結束時所能設定的值。The following table lists the values that the dtexec utility can set when exiting.

Value 描述Description
00 順利執行封裝。The package executed successfully.
11 封裝失敗。The package failed.
33 使用者取消封裝。The package was canceled by the user.
44 公用程式找不到所要求的封裝。The utility was unable to locate the requested package. 找不到這個封裝。The package could not be found.
55 公用程式無法載入所要求的封裝。The utility was unable to load the requested package. 無法載入這個封裝。The package could not be loaded.
66 公用程式在命令列中發現內部語法錯誤或語意錯誤。The utility encountered an internal error of syntactic or semantic errors in the command line.

語法與規則Syntax Rules

公用程式語法規則Utility syntax rules

所有選項的開頭都必須是斜線 (/) 或減號 (-)。All options must start with a slash (/) or a minus sign (-). 此處顯示的選項的開頭為斜線 (/),但可以用減號 (-) 來替代。The options that are shown here start with a slash (/), but the minus sign (-) can be substituted.

如果引數中包含空格,則引數必須包含在引號內。An argument must be enclosed in quotation marks if it contains a space. 如果引數沒有用引號括住,則引數不能包含空格。If the argument is not enclosed in quotation marks, the argument cannot contain white space.

加上引號的字串內的雙引號代表逸出的單引號。Doubled quotation marks within quoted strings represent escaped single quotation marks.

除了密碼以外,選項和引數都沒有區分大小寫。Options and arguments are not case-sensitive, except for passwords.

使用 xp_cmdshell 的 dtexecUsing dtexec from the xp_cmdshell

使用 xp_cmdshell 的 dtexecUsing dtexec from the xp_cmdshell

您可以從 xp_cmdshell 提示處執行 dtexec。You can run dtexec from the xp_cmdshell prompt. 下列範例顯示如何執行名為 UpsertData.dtsx 的封裝,並忽略傳回碼:The following example shows how to run a package called UpsertData.dtsx and ignore the return code:

EXEC xp_cmdshell 'dtexec /f "C:\UpsertData.dtsx"'  

下列範例顯示如何執行同一個封裝,並擷取傳回碼:The following example shows how to run the same package and capture the return code:

DECLARE @returncode int  
EXEC @returncode = xp_cmdshell 'dtexec /f "C:\UpsertData.dtsx"'  

重要

MicrosoftMicrosoft[SQL Server]SQL Server中,新安裝的 xp_cmdshell 選項預設為停用。In MicrosoftMicrosoft[SQL Server]SQL Server, the xp_cmdshell option is disabled by default on new installations. 您可以執行 sp_configure 系統預存程序以啟用此選項。The option can be enabled by running the sp_configure system stored procedure. 如需詳細資訊,請參閱 xp_cmdshell 伺服器組態選項For more information, see xp_cmdshell Server Configuration Option.

語法Syntax

dtexec /option [value] [/option [value]]...  

參數Parameters

  • /?/? [option_name]:選擇性。 顯示命令提示字元選項,或顯示指定之 option_name 的說明,然後關閉公用程式。Displays the command prompt options, or displays help for the specified option_name and then closes the utility.

    如果您指定option_name引數dtexec啟動[SQL Server]SQL Server線上叢書 》,並顯示 dtexec 公用程式主題。If you specify an option_name argument, dtexec starts [SQL Server]SQL Server Books Online and displays the dtexec Utility topic.

  • /Ca[llerInfo]/Ca[llerInfo]:
    選擇性。Optional. 指定封裝執行的其他資訊。Specifies additional information for a package execution. 當您使用 SQL Server Agent 執行封裝時,代理程式會設定此引數以指示透過 SQL Server Agent 叫用封裝執行。When you run a package using SQL Server Agent, agent sets this argument to indicate that the package execution is invoked by SQL Server Agent. 從命令列執行 dtexec 公用程式時,會忽略此參數。This parameter is ignored when the dtexec utility is run from the command line.

  • /CheckF[ile] filespec/CheckF[ile] filespec:
    選擇性。Optional. 設定組CheckpointFileName路徑和檔案設封裝上的屬性filespecSets the CheckpointFileName property on the package to the path and file spemandcified in filespec. 當重新啟動封裝時,會使用這個檔案。This file is used when the package restarts. 如果指定這個選項時沒有使用檔案名稱值,就會將封裝的 CheckpointFileName 設為空字串。If this option is specified and no value is supplied for the file name, the CheckpointFileName for the package is set to an empty string. 如果沒有指定這個選項,就會保留封裝中的值。If this option is not specified, the values in the package are retained.

  • /Checkp [ointing] {on\off} :/CheckP[ointing] {on\off}:
    選擇性。Optional. 設定一個值來決定在執行封裝期間,封裝是否要使用檢查點。Sets a value that determines whether the package will use checkpoints during package execution. on 值可指定重新執行失敗的封裝。The value on specifies that a failed package is to be rerun. 當重新執行失敗的封裝時,執行階段引擎會使用檢查點,從失敗點重新啟動封裝。When the failed package is rerun, the run-time engine uses the checkpoint file to restart the package from the point of failure.

    如果宣告的選項不含任何值,則預設值是 on。The default value is on if the option is declared without a value. 如果此值設為 on,但找不到檢查點檔案,則封裝執行失敗。Package execution will fail if the value is set to on and the checkpoint file cannot be found. 如果沒有指定這個選項,就會保留封裝中所設定的值。If this option is not specified, the value set in the package is retained. 如需詳細資訊,請參閱 使用檢查點來重新啟動封裝For more information, see Restart Packages by Using Checkpoints.

    上的 /CheckPointing dtexec 選項相當於設定SaveCheckpoints為 True 時,封裝的屬性和CheckpointUsage屬性設為 Always。The /CheckPointing on option of dtexec is equivalent to setting the SaveCheckpoints property of the package to True, and the CheckpointUsage property to Always.

  • /Com[mandFile] filespec/Com[mandFile] filespec:
    (選擇性)。(Optional). 指定要與 dtexec 一起執行的命令選項。Specifies the command options that run with dtexec. filespec 中指定的檔案會開啟,並且讀取檔案中的選項,直到在檔案中找到 EOF 為止。The file specified in filespec is opened and options from the file are read until EOF is found in the file. filespec 是文字檔。filespec is a text file. filespec 引數會指定要與封裝的執行產生關聯之命令檔的檔名和路徑。The filespec argument specifies the file name and path of the command file to associate with the execution of the package.

  • /Conf[igFile] filespec:選擇性。/Conf[igFile] filespec: Optional. 指定要擷取值的來源組態檔。Specifies a configuration file to extract values from. 使用這個選項時,您可以設定一個執行階段組態,這個執行階段組態與封裝設計階段所指定的組態不同。Using this option, you can set a run-time configuration that differs from the configuration that was specified at design time for the package. 您可以將不同的組態設定儲存在 XML 組態檔中,然後在執行封裝之前,利用 /ConfigFile 選項載入設定。You can store different configuration settings in an XML configuration file and then load the settings before package execution by using the /ConfigFile option.

    您可以使用 /ConfigFile 選項在執行階段載入您未在設計階段指定的其他組態。You can use the /ConfigFile option to load additional configurations at run time that you did not specify at design time. 但您不可使用 /ConfigFile 選項取代您在設計階段指定過的設定值。However, you cannot use the /ConfigFile option to replace configured values that you also specified at design time. 如需了解封裝組態套用的方式,請參閱< Package Configurations>。To understand how package configurations are applied, see Package Configurations.

  • /Conn[ection] id_or_name;connection_string [[;id_or_name;connection_string]...]/Conn[ection] id_or_name;connection_string [[;id_or_name;connection_string]...]:
    選擇性。Optional. 指定具有指定名稱或 GUID 的連接管理員位於此封裝中,並指定連接字串。Specifies that the connection manager with the specified name or GUID is located in the package, and specifies a connection string.

    這個選項需要同時指定這兩個參數:在 id_or_name 引數中必須提供連接管理員名稱或 GUID,而且在 connection_string 引數中必須指定有效的連接字串。This option requires that both parameters be specified: the connection manager name or GUID must be provided in the id_or_name argument, and a valid connection string must be specified in the connection_string argument. 如需詳細資訊,請參閱 Integration Services (SSIS) 連接For more information, see Integration Services (SSIS) Connections.

    您可以在執行階段使用 /Connection 選項,從不同於設計時所指定的位置載入封裝組態。At run time, you can use the /Connection option to load package configurations from a location other than the location that you specified at design time. 然後這些組態的值會取代您原本指定的值。The values of these configurations then replace the values that were originally specified. /Connection 選項只可用於使用連接管理員的組態,例如 [SQL Server]SQL Server 組態。However you can use the /Connection option only for configurations, such as [SQL Server]SQL Server configurations, that use a connection manager. 若要了解如何套用封裝組態,請參閱封裝組態SQL Server 2014 中 Integration Services 功能的行為變更To understand how package configurations are applied, see Package Configurations and Behavior Changes to Integration Services Features in SQL Server 2014.

  • /Cons[oleLog] [[displayoptions];[list_options;src_name_or_guid]...]:選擇性。/Cons[oleLog] [[displayoptions];[list_options;src_name_or_guid]...]: Optional. 在執行封裝期間,於主控台中顯示指定的記錄項目。Displays specified log entries to the console during package execution. 如果省略了這個選項,主控台便不會顯示任何記錄項目。If this option is omitted, no log entries are shown in the console. 如果指定了這個選項,但未設定用來限制顯示的參數,就會顯示每個記錄項目。If the option is specified without parameters that limit the display, every log entry will display. 若要限制主控台顯示的項目,您可以使用 displayoptions 參數指定要顯示的資料行,以及使用 list_options 參數來限制記錄項目類型。To limit the entries that are displayed to the console, you can specify the columns to show by using the displayoptions parameter, and limit the log entry types by using the list_options parameter.

    注意

    當您執行封裝時Integration ServicesIntegration Services使用的伺服器/ISSERVER參數,主控台輸出會有所限制且大部分的 /cons [oleLog] 選項皆不適用。When you run a package on the Integration ServicesIntegration Services server by using the /ISSERVER parameter, console output is limited and most of the /Cons[oleLog] options are not applicable. 所有執行記錄都可以從伺服器的相關檢視中查看,或透過 SQL Server Management StudioSQL Server Management Studio中提供的標準報表查看。All execution logs can be seen from the server in the related views or by using standard reports available in SQL Server Management StudioSQL Server Management Studio. 如需報表的詳細資訊,請參閱 Integration Services 伺服器的報表 For more information about the reports, see Reports for the Integration Services Server.

    displayoptions 值如下:The displayoptions values are as follows:

    • N (名稱)N (Name)

    • C (電腦)C (Computer)

    • O (操作員)O (Operator)

    • S (來源名稱)S (Source Name)

    • G (來源 GUID)G (Source GUID)

    • X (執行 GUID)X (Execution GUID)

    • M (訊息)M (Message)

    • T (開始和結束時間)T (Time Start and End)

    list_options 值如下:The list_options values are as follows:

    • I - 指定包含清單。I - Specifies the inclusion list. 只記錄指定的來源名稱或 GUID。Only the source names or GUIDs that are specified are logged.

    • E - 指定排除清單。E - Specifies the exclusion list. 不記錄指定的來源名稱或 GUID。The source names or GUIDs that are specified are not logged.

    • 對包含或排除指定的 src_name_or_guid 參數為事件名稱、來源名稱或來源 GUID。The src_name_or_guid parameter specified for inclusion or exclusion is an event name, source name, or source GUID.

    您如在同一個命令提示字元處使用多個 /ConsoleLog 選項,這些選項的互動方式如下:If you use multiple /ConsoleLog options on the same command prompt, they interact as follows:

    • 顯示順序不受影響。Their order of appearance has no effect.

    • 如果命令列上沒有包含清單,則排除清單會套用至所有類型的記錄項目。If no inclusion lists are present on the command line, exclusion lists are applied against all kinds of log entries.

    • 如果命令列上出現任何包含清單,則排除清單會套用至所有包含清單的聯集。If any inclusion lists are present on the command line, exclusion lists are applied against the union of all inclusion lists.

    如需範例的 /ConsoleLog選項,請參閱備註一節。For examples of the /ConsoleLog option, see the Remarks section.

  • /D[ts] package_path/D[ts] package_path:
    選擇性。Optional. 從 SSIS 封裝存放區中載入封裝。Loads a package from the SSIS Package Store. 儲存在 SSIS 封裝存放區中的封裝是使用舊版封裝部署模型所部署。Packages that are stored in the SSIS Package Store, are deployed using the legacy package deployment model. 若要使用專案部署模型,執行部署到 Integration ServicesIntegration Services 伺服器的封裝,請使用 /ISServer 選項。To run packages that are deployed to the Integration ServicesIntegration Services server using the project deployment model, use the /ISServer option. 如需有關封裝和專案部署模型的詳細資訊,請參閱< Deployment of Projects and Packages>。For more information about the package and project deployment models, see Deployment of Projects and Packages.

    package_path 引數指定 SSISSSIS 封裝的相對路徑,從 SSIS 封裝存放區的根目錄開始,並包括 SSISSSIS 封裝的名稱。The package_path argument specifies the relative path of the SSISSSIS package, starting at the root of the SSIS Package Store, and includes the name of the SSISSSIS package. 如果 package_path 引數中指定的路徑或檔案名稱包含空格,必須將 package_path 引數括以引號。If the path or file name specified in the package_path argument contains a space, you must put quotation marks around the package_path argument.

    /DTS 選項不可與 /File/SQL 選項並用。The /DTS option cannot be used together with the /File or /SQL option. 如果指定多個選項,dtexec 將會失敗。If multiple options are specified, dtexec fails.

  • /De[crypt] password:選擇性。/De[crypt] password: Optional. 設定載入含密碼加密的封裝時,所用的解密密碼。Sets the decryption password that is used when you load a package with password encryption.

  • /Dump error code/Dump error code:
    選擇性建立偵錯傾印檔案.mdmp 和.tmp,當封裝執行時,就會發生一或多個指定的事件。Optional Creates the debug dump files, .mdmp and .tmp, when one or more specified events occur while the package is running. error code 引數會指定事件代碼的類型 (錯誤、警告或資訊),這些事件代碼將會觸發系統建立偵錯傾印檔案。The error code argument specifies the type of event code-error, warning, or information-that will trigger the system to create the debug dump files. 若要指定多個事件代碼,請用分號 (;) 隔開每一個「錯誤碼」 引數。To specify multiple event codes, separate each error code argument by a semi-colon (;). error code 引數中請勿包含引號。Do not include quotes with the error code argument.

    下列範例會在 DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER 錯誤發生時,產生偵錯傾印檔案。The following example generates the debug dump files when the DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER error occurs.

    /Dump 0xC020801C  
    

    根據預設,Integration ServicesIntegration Services 會將偵錯傾印檔案儲存在 <磁碟機> :\Program Files\Microsoft SQL Server\110\Shared\ErrorDumps 資料夾中。By default, Integration ServicesIntegration Services stores the debug dump files in the folder, <drive>:\Program Files\Microsoft SQL Server\110\Shared\ErrorDumps.

    注意

    偵錯傾印檔案可能會包含敏感性資訊。Debug dump files may contain sensitive information. 您可以使用存取控制清單 (ACL) 來限制這些檔案的存取權,或將這些檔案複製到具有限制性存取權的資料夾。Use an access control list (ACL) to restrict access to the files, or copy the files to a folder with restricted access. 例如,在您將偵錯檔案傳送給 Microsoft 支援服務之前,我們建議您先移除任何敏感性或機密資訊。For example, before you send your debug files to Microsoft support services, we recommended that you remove any sensitive or confidential information.

    若要將此選項套用到所有封裝dtexec公用程式執行時,加入DumpOnCodes REG_SZ 值加入 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\110\SSIS\Setup\DtsPath 登錄機碼。To apply this option to all packages that the dtexec utility runs, add a DumpOnCodes REG_SZ value to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\110\SSIS\Setup\DtsPath registry key. DumpOnCodes 的資料值會指定觸發系統建立偵錯傾印檔案的錯誤碼。The data value in DumpOnCodes specifies the error code or codes that will trigger the system to create debug dump files. 多個錯誤碼必須以分號 (;) 隔開。Multiple error codes must be separated by a semi-colon (;).

    若您將 DumpOnCodes 值加入此登錄機碼中,並使用 /Dump 選項,系統將會建立以這兩個設定為根據的偵錯傾印檔案。If you add a DumpOnCodes value to the registry key, and use the /Dump option, the system will create debug dump files that are based on both settings.

    如需有關偵錯傾印檔案的詳細資訊,請參閱< Generating Dump Files for Package Execution>。For more information about debug dump files, see Generating Dump Files for Package Execution.

  • /DumpOnError/DumpOnError:
    選擇性。Optional. 當封裝執行時,就會發生任何錯誤時,會建立偵錯傾印檔案.mdmp 和.tmp。Creates the debug dump files, .mdmp and .tmp, when any error occurs while the package is running.

    根據預設,Integration ServicesIntegration Services 會將偵錯傾印檔案儲存至 <磁碟機> :\Program Files\Microsoft SQL Server\110\Shared\ErrorDumps 資料夾。By default, Integration ServicesIntegration Services stores the debug dump files in the folder, <drive>:\Program Files\Microsoft SQL Server\110\Shared\ErrorDumps folder.

    注意

    偵錯傾印檔案可能會包含敏感性資訊。Debug dump files may contain sensitive information. 您可以使用存取控制清單 (ACL) 來限制這些檔案的存取權,或將這些檔案複製到具有限制性存取權的資料夾。Use an access control list (ACL) to restrict access to the files, or copy the files to a folder with restricted access. 例如,在您將偵錯檔案傳送給 Microsoft 支援服務之前,我們建議您先移除任何敏感性或機密資訊。For example, before you send your debug files to Microsoft support services, we recommended that you remove any sensitive or confidential information.

    若要將此選項套用到所有封裝dtexec公用程式執行時,加入DumpOnError REG_DWORD 值加入 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\110\SSIS\Setup\DtsPath 登錄機碼。To apply this option to all packages that the dtexec utility runs, add a DumpOnError REG_DWORD value to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\110\SSIS\Setup\DtsPath registry key. DumpOnError REG_DWORD 值可指定是否 /DumpOnError選項必須搭配dtexec公用程式:The value of the DumpOnError REG_DWORD value determines whether the /DumpOnError option needs to be used with the dtexec utility:

    • 非零的資料值表示發生任何錯誤,不論您是使用時,系統會建立偵錯傾印檔案 /DumpOnError選項與dtexec公用程式。A non-zero data value indicates that the system will create debug dump files when any error occurs, regardless of whether you use the /DumpOnError option with the dtexec utility.

    • 零的資料值表示系統將不會建立偵錯傾印檔案除非您使用 /DumpOnError選項與dtexec公用程式。A zero data value indicates that the system will not create the debug dump files unless you use the /DumpOnError option with the dtexec utility.

    如需有關偵錯傾印檔案的詳細資訊,請參閱< Generating Dump Files for Package Execution>。For more information about debug dump files, see Generating Dump Files for Package Execution

  • /Env[Reference] 環境參考識別碼:/Env[Reference] environment reference ID:
    選擇性。Optional. 針對部署到 Integration ServicesIntegration Services 伺服器的封裝,指定封裝執行所使用的環境參考 (ID)。Specifies the environment reference (ID) that is used by the package execution, for a package that is deployed to the Integration ServicesIntegration Services server. 設定為繫結至變數的參數將使用環境中包含之變數的值。The parameters configured to bind to variables will use the values of the variables that are contained in the environment.

    您可以將 /Env[Reference] 選項與 /ISServer/Server 選項並用。You use /Env[Reference] option together with the /ISServer and the /Server options.

    此參數是由 SQL Server Agent 所使用。This parameter is used by SQL Server Agent.

  • /F[ile] filespec:/F[ile] filespec:
    選擇性。Optional. 載入儲存在檔案系統中的封裝。Loads a package that is saved in the file system. 儲存在檔案系統中的封裝是使用舊版封裝部署模型所部署。Packages that are saved in the file system, are deployed using the legacy package deployment model. 若要使用專案部署模型,執行部署到 Integration ServicesIntegration Services 伺服器的封裝,請使用 /ISServer 選項。To run packages that are deployed to the Integration ServicesIntegration Services server using the project deployment model, use the /ISServer option. 如需封裝和專案部署模型的詳細資訊,請參閱< Deployment of Projects and Packages>。For more information about the package and project deployment models, see Deployment of Projects and Packages

    filespec 引數指定封裝的路徑和檔案名稱。The filespec argument specifies the path and file name of the package. 您可以指定路徑為通用命名慣例 (UNC) 路徑或本機路徑。You can specify the path as either a Universal Naming Convention (UNC) path or a local path. 如果 filespec 引數中指定的路徑或檔案名稱包含空格,必須將 filespec 引數括以引號。If the path or file name specified in the filespec argument contains a space, you must put quotation marks around the filespec argument.

    /File 選項不可與 /DTS/SQL 選項並用。The /File option cannot be used together with the /DTS or /SQL option. 如果指定多個選項,dtexec 將會失敗。If multiple options are specified, dtexec fails.

  • /H[elp] [option_name]:選擇性。/H[elp] [option_name]: Optional. 顯示選項的說明,或顯示指定之 option_name 的說明,並關閉公用程式。Displays help for the options, or displays help for the specified option_name and closes the utility.

    如果您指定option_name引數dtexec啟動[SQL Server]SQL Server線上叢書 》,並顯示 dtexec 公用程式主題。If you specify an option_name argument, dtexec starts [SQL Server]SQL Server Books Online and displays the dtexec Utility topic.

  • /ISServer packagepath:/ISServer packagepath:
    選擇性。Optional. 執行部署到 Integration ServicesIntegration Services 伺服器的封裝。Runs a package that is deployed to the Integration ServicesIntegration Services server. PackagePath 引數會指定部署到 Integration ServicesIntegration Services 伺服器之封裝的完整路徑和檔案名稱。The PackagePath argument specifies the full path and file name of the package deployed to the Integration ServicesIntegration Services server. 如果 PackagePath 引數中指定的路徑或檔案名稱包含空格,必須將 PackagePath 引數括以引號。If the path or file name specified in the PackagePath argument contains a space, you must put quotation marks around the PackagePath argument.

    封裝格式如下所示:The package format is as follows:

    \<catalog name>\<folder name>\<project name>\package file name  
    

    您可以將 /Server 選項與 /ISSERVER 選項並用。You use /Server option together with the /ISSERVER option. 只有 Windows 驗證可以執行 SSIS 伺服器上的封裝。Only Windows Authentication can execute a package on the SSIS Server. 目前的 Windows 使用者用來存取封裝。The current Windows user is used to access the package. 如果省略 /Server 選項,將假設使用 [SQL Server]SQL Server 的預設本機執行個體。If the /Server option is omitted, the default local instance of [SQL Server]SQL Server is assumed.

    /ISSERVER 選項無法與 /DTS, /SQL/File 選項並用。The /ISSERVER option cannot be used together with the /DTS, /SQL or /File option. 如果指定了多個選項,dtexec 便會失敗。If multiple options are specified, dtexec fails.

    此參數是由 SQL Server Agent 所使用。This parameter is used by SQL Server Agent.

  • /L[ogger] classid_orprogid;configstring/L[ogger] classid_orprogid;configstring:
    選擇性。Optional. 建立一或多個記錄提供者與 SSISSSIS 封裝執行作業的關聯性。Associates one or more log providers with the execution of an SSISSSIS package. classid_orprogid 參數指定記錄提供者,並可指定為類別 GUID。The classid_orprogid parameter specifies the log provider, and can be specified as a class GUID. configstring 是用來設定記錄提供者的字串。The configstring is the string that is used to configure the log provider.

    下列清單顯示可用的記錄提供者:The following list shows the available log providers:

    • 文字檔:Text file:

      • ProgID:DTS.LogProviderTextFile.1ProgID: DTS.LogProviderTextFile.1

      • ClassID: {59B2C6A5-663F-4C20-8863-C83F9B72E2EB}ClassID: {59B2C6A5-663F-4C20-8863-C83F9B72E2EB}

    • SQL Server ProfilerSQL Server Profiler::

      • ProgID:DTS.LogProviderSQLProfiler.1ProgID: DTS.LogProviderSQLProfiler.1

      • ClassID: {5C0B8D21-E9AA-462E-BA34-30FF5F7A42A1}ClassID: {5C0B8D21-E9AA-462E-BA34-30FF5F7A42A1}

    • [SQL Server]SQL Server::

      • ProgID:DTS.LogProviderSQLServer.1ProgID: DTS.LogProviderSQLServer.1

      • ClassID: {6AA833A1-E4B2-4431-831B-DE695049DC61}ClassID: {6AA833A1-E4B2-4431-831B-DE695049DC61}

    • Windows 事件記錄:Windows Event Log:

      • ProgID:DTS.LogProviderEventLog.1ProgID: DTS.LogProviderEventLog.1

      • ClassID: {97634F75-1DC7-4F1F-8A4C-DAF0E13AAA22}ClassID: {97634F75-1DC7-4F1F-8A4C-DAF0E13AAA22}

    • XML 檔案:XML File:

      • ProgID:DTS.LogProviderXMLFile.1ProgID: DTS.LogProviderXMLFile.1

      • ClassID: {AFED6884-619C-484F-9A09-F42D56E1A7EA}ClassID: {AFED6884-619C-484F-9A09-F42D56E1A7EA}

  • /M[axConcurrent] concurrent_executables/M[axConcurrent] concurrent_executables:
    選擇性。Optional. 指定封裝可以同時執行的可執行檔數量。Specifies the number of executable files that the package can run concurrently. 指定的值必須是非負數的整數或 -1。The value specified must be either a non-negative integer, or -1. -1 值表示 SSISSSIS 允許同時執行的最大可執行檔數量,等於執行封裝之電腦上的處理器總數再加 2。A value of -1 means that SSISSSIS will allow a maximum number of concurrently running executables that is equal to the total number of processors on the computer executing the package, plus two.

  • /Pack[age] PackageName/Pack[age] PackageName:
    選擇性。Optional. 指定所執行的封裝。Specifies the package that is executed. 當您從 Visual StudioVisual Studio執行封裝時,主要會使用這個參數。This parameter is used primarily when you execute the package from Visual StudioVisual Studio.

  • /P[assword] 密碼/P[assword] password:
    選擇性。Optional. 允許擷取 [SQL Server]SQL Server 驗證所保護的封裝。Allows the retrieval of a package that is protected by [SQL Server]SQL Server Authentication. 此選項會與 /User 選項一起使用。This option is used together with the /User option. 若省略 /Password 選項而使用 /User 選項,將會使用空白密碼。If the /Password option is omitted and the /User option is used, a blank password is used. password 值可括以引號。The password value may be quoted.

    重要

    儘可能使用 Windows 驗證。When possible, use Windows authentication.

  • /Par[ameter] [$Package:: | $Project:: | $ServerOption::] parameter_name [(data_type)]; literal_value:選擇性。/Par[ameter] [$Package:: | $Project:: | $ServerOption::] parameter_name [(data_type)]; literal_value: Optional. 指定參數值。Specifies parameter values. 可以指定多個 /Parameter 選項。Multiple /Parameter options can be specified. 資料類型為當做字串的 CLR TypeCodes。The data types are CLR TypeCodes as strings. 若是非字串的參數,則會在括號中指定資料類型,後面接著參數名稱。For a non-string parameter, the data type is specified in parenthesis, following the parameter name.

    /Parameter可用選項只能搭配/ISServer選項。The /Parameter option can be used only with the /ISServer option.

    您可以使用 $Package、$Project 和 $ServerOption 前置詞個別表示封裝參數、專案參數,以及伺服器選項參數。You use the $Package, $Project, and $ServerOption prefixes to indicate a package parameter, project parameter, and a server option parameter, respectively. 預設參數類型為封裝。The default parameter type is package.

    以下範例會執行封裝,以及為專案參數 (myparam) 提供 myvalue,並為封裝參數 (anotherparam) 提供整數值 12。The following is an example of executing a package and providing myvalue for the project parameter (myparam) and the integer value 12 for the package parameter (anotherparam).

    Dtexec /isserver "SSISDB\MyFolder\MyProject\MyPackage.dtsx" /server "." /parameter $Project::myparam;myvalue /parameter anotherparam(int32);12

    您也可以使用參數設定連接管理員屬性。You can also set connection manager properties by using parameters. 使用 CM 前置詞代表連接管理員參數。You use the CM prefix to denote a connection manager parameter.

    在以下的範例中,SourceServer 連接管理員的 InitialCatalog 屬性設定為 ssisdbIn the following example, InitialCatalog property of the SourceServer connection manager is set to ssisdb.

    /parameter CM.SourceServer.InitialCatalog;ssisdb  
    

    在下列範例中,SourceServer 連接管理員的 ServerName 屬性設定為句號 (.),表示本機伺服器。In the following example, ServerName property of the SourceServer connection manager is set to a period (.) to indicate the local server.

    /parameter CM.SourceServer.ServerName;.  
    
  • /Proj[ect] ProjectFile/Proj[ect] ProjectFile:
    選擇性。Optional. 指定要從中擷取所執行之封裝的專案。Specifies the project from which to retrieve the package that is executed. ProjectFile 引數會指定 .ispac 檔案名稱。The ProjectFile argument specifies the .ispac file name. 當您從 Visual StudioVisual Studio執行封裝時,主要會使用這個參數。This parameter is used primarily when you execute the package from Visual StudioVisual Studio.

  • /Rem 註解/Rem comment:
    選擇性。Optional. 在命令提示字元或命令檔中加入註解。Includes comments on the command prompt or in command files. 引數是選擇性的。The argument is optional. comment 的值是一個字串,它必須以引號括住,或不包含空格。The value of comment is a string that must be enclosed in quotation marks, or contain no white space. 如果未指定引數,將會插入空白行。If no argument is specified, a blank line is inserted. 命令取得階段將會捨棄comment 值。comment values are discarded during the command sourcing phase.

  • /Rep[orting] 層級 [ ;event_guid_or_name[ ;event_guid_or_name[...]]:選擇性。/Rep[orting] level [;event_guid_or_name[;event_guid_or_name[...]]: Optional. 指定要報告的訊息類型。Specifies what types of messages to report. level 可用的報告選項如下:The available reporting options for level are as follows:

    N ...無報告。N No reporting.

    E 會報告錯誤。E Errors are reported.

    W ...報告警告。W Warnings are reported.

    I 報告資訊訊息。I Informational messages are reported.

    C ...報告自訂事件。C Custom events are reported.

    D ...報告資料流程工作事件。D Data Flow task events are reported.

    P ...報告進度。P Progress is reported.

    V ...詳細資訊報告。V Verbose reporting.

    V 和 N 引數與所有其他引數互斥;這兩個引數必須單獨指定。The arguments of V and N are mutually exclusive to all other arguments; they must be specified alone. 如果 /Reporting ,預設層級為未指定選項E(錯誤)、 W (警告) 及P (進度)。If the /Reporting option is not specified then the default level is E (errors), W (warnings), and P (progress).

    所有事件前面都加上 "YY/MM/DD HH:MM:SS" 格式的時間戳記,如果有 GUID 或易記名稱,也會加上它們。All events are preceded with a timestamp in the format "YY/MM/DD HH:MM:SS", and a GUID or friendly name if available.

    選擇性參數 event_guid_or_name 記錄提供者的例外狀況清單。The optional parameter event_guid_or_name is a list of exceptions to the log providers. 例外狀況會指出不要記錄但可能已記錄的事件。The exception specifies the events that are not logged that otherwise might have been logged.

    您不需要排除通常預設為不要記錄的事件。You do not have to exclude an event if the event is not ordinarily logged by default

  • /Res[tart] {deny | force | ifPossible}:選擇性。/Res[tart] {deny | force | ifPossible}: Optional. 為這個封裝中的 CheckpointUsage 屬性指定新值。Specifies a new value for the CheckpointUsage property on the package. 這些參數的意義如下:The meaning of the parameters are as follows:

    DenyCheckpointUsage 屬性設為 DTSCU_NEVERDeny Sets CheckpointUsage property to DTSCU_NEVER.

    ForceCheckpointUsage 屬性設為 DTSCU_ALWAYSForce Sets CheckpointUsage property to DTSCU_ALWAYS.

    ifPossibleCheckpointUsage 屬性設為 DTSCU_IFEXISTSifPossible Sets CheckpointUsage property to DTSCU_IFEXISTS.

    若未指定任何值,將會使用預設值 forceThe default value of force is used if no value is specified.

  • /Set [$Sensitive::]propertyPath;value:選擇性。/Set [$Sensitive::]propertyPath;value: Optional. 覆寫封裝內的參數、變數、屬性、容器、記錄提供者、Foreach 列舉值或連接的組態。Overrides the configuration of a parameter, variable, property, container, log provider, Foreach enumerator, or connection within a package. 使用此選項時, /Set 會將 propertyPath 引數變更為指定的值。When this option is used, /Set changes the propertyPath argument to the value specified. 可以指定多個 /Set 選項。Multiple /Set options can be specified.

    除了使用 /set選項搭配 /F [ile] 選項,您也可以使用 /set選項與/ISServer選項或/Project選項。In addition to using the /Set option with the /F[ile] option, you can also use the /Set option with the /ISServer option or the /Project option. 當您使用 /set具有/Project/set設定參數值。When you use /Set with /Project, /Set sets parameter values. 當您使用 /set具有/ISServer/set設定屬性覆寫。When you use /Set with /ISServer, /Set sets property overrides. 此外,當您使用 /set具有/ISServer,您可以使用選擇性 $Sensitive 前置詞來表示,此屬性應該視為機密上Integration ServicesIntegration Services伺服器。In addition, when you use /Set with /ISServer, you can use the optional $Sensitive prefix to indicate that the property should be treated as sensitive on the Integration ServicesIntegration Services server.

    您可以執行 [封裝組態精靈] 來決定 propertyPath 的值。You can determine the value of propertyPath by running the Package Configuration Wizard. 您選取項目的路徑會顯示在最後的 [正在完成精靈] 頁面上,並可複製及貼上。The paths for items that you select are displayed on the final Completing the Wizard page, and can be copied and pasted. 如果您只是為了這個目的而使用精靈,可以在複製路徑之後取消精靈。If you have used the wizard only for this purpose, you can cancel the wizard after you copy the paths.

    下列範例會執行儲存在檔案系統中的封裝並提供變數的新值:The following is an example of executing a package that is saved in the file system and providing a new value for a variable:

    dtexec /f mypackage.dtsx /set \package.variables[myvariable].Value;myvalue

    下列範例會從 .ispac 專案檔案執行封裝,並設定封裝與專案參數。The following example of running a package from the .ispac project file and setting package and project parameters.

    /Project c:\project.ispac /Package Package1.dtsx /SET \Package.Variables[$Package::Parameter];1 /SET \Package.Variables[$Project::Parameter];1

    您可以使用 /Set 選項變更載入封裝組態的來源位置。You can use the /Set option to change the location from which package configurations are loaded. 但您不可使用 /Set 選項覆寫先前在設計階段由組態所指定的值。However, you cannot use the /Set option to override a value that was specified by a configuration at design time. 若要了解如何套用封裝組態,請參閱封裝組態SQL Server 2014 中 Integration Services 功能的行為變更To understand how package configurations are applied, see Package Configurations and Behavior Changes to Integration Services Features in SQL Server 2014.

  • /Ser[ver] 伺服器:/Ser[ver] server:
    選擇性。Optional. 指定 /SQL/DTS 選項時,此選項會指定要擷取封裝的來源伺服器名稱。When the /SQL or /DTS option is specified, this option specifies the name of the server from which to retrieve the package. 如果省略 /Server 選項而指定了 /SQL/DTS 選項,將會嘗試對本機伺服器執行封裝作業。If you omit the /Server option and the /SQL or /DTS option is specified, package execution is tried against the local server. server_instance 值可能會加上引號。The server_instance value may be quoted.

    指定 /Ser[ver] 選項時,需要 /ISServer 選項。The /Ser[ver] option is required when the /ISServer option is specified.

  • /SQ[L] package_path/SQ[L] package_path:
    載入儲存在 [SQL Server]SQL Servermsdb 資料庫中的封裝。Loads a package that is stored in [SQL Server]SQL Server, in msdb database. 儲存在 msdb 資料庫中的封裝是使用封裝部署模型所部署。Packages that are stored in the msdb database, are deployed using the package deployment model. 若要使用專案部署模型,執行部署到 Integration ServicesIntegration Services 伺服器的封裝,請使用 /ISServer 選項。To run packages that are deployed to the Integration ServicesIntegration Services server using the project deployment model, use the /ISServer option. 如需有關封裝和專案部署模型的詳細資訊,請參閱< Deployment of Projects and Packages>。For more information about the package and project deployment models, see Deployment of Projects and Packages.

    package_path 引數指定要擷取的封裝名稱。The package_path argument specifies the name of the package to retrieve. 如果路徑包含資料夾,則其結尾應為反斜線 ("\")。If folders are included in the path, they are terminated with backslashes ("\"). Package_path 值可以加上引號。The package_path value can be quoted. 如果 package_path 引數中指定的路徑或檔案名稱包含空格,必須將 package_path 引數括以引號。If the path or file name specified in the package_path argument contains a space, you must put quotation marks around the package_path argument.

    您可以使用 /User/Password,並/Server選項並搭配/SQL選項。You can use the /User, /Password, and /Server options together with the /SQL option.

    若省略 /User 選項,將會使用 Windows 驗證存取封裝。If you omit the /User option, Windows Authentication is used to access the package. 若使用 /User 選項,指定的 /User 登入名稱將會與 [SQL Server]SQL Server 驗證建立關聯。If you use the /User option, the /User login name specified is associated with [SQL Server]SQL Server Authentication.

    /Password 選項只能與 /User 選項一起使用。The /Password option is used only together with the /User option. 若使用 /Password 選項,將會使用所提供的使用者名稱與密碼資訊存取封裝。If you use the /Password option, the package is accessed with the user name and password information provided. 若省略 /Password 選項,將會使用空白密碼。If you omit the /Password option, a blank password is used.

    重要

    儘可能使用 Windows 驗證。When possible, use Windows authentication.

    如果省略 /Server 選項,將會假設使用 [SQL Server]SQL Server 的預設本機執行個體。If the /Server option is omitted, the default local instance of [SQL Server]SQL Server is assumed.

    /SQL 選項不可與 /DTS/File 選項並用。The /SQL option cannot be used together with the /DTS or /File option. 如果指定多個選項,dtexec 將會失敗。If multiple options are specified, dtexec fails.

  • /Su[m] :選擇性。/Su[m]: Optional. 顯示包含下一個元件將接收之列數的累加計數器。Shows an incremental counter that contains the number of rows that will be received by the next component.

  • /U[ser] user_name/U[ser] user_name:
    選擇性。Optional. 允許擷取 [SQL Server]SQL Server 驗證所保護的封裝。Allows the retrieval of a package that is protected by [SQL Server]SQL Server Authentication. 只有在指定 /SQL 選項時,才會使用此選項。This option is used only when the /SQL option is specified. user_name 值可以引號括住。The user_name value can be quoted.

    重要

    儘可能使用 Windows 驗證。When possible, use Windows authentication.

  • /Va[lidate]/Va[lidate]:
    選擇性。Optional. 在驗證階段之後,停止執行封裝 (並不會實際執行封裝)。Stops the execution of the package after the validatation phase, without actually running the package. 在驗證期間使用的 /WarnAsError選項會使dtexec將警告視為錯誤,因此封裝會失敗驗證期間發生警告。During validation, use of the /WarnAsError option causes dtexec to treat a warning as an error; therefore the package fails if a warning occurs during validation.

  • /VerifyB[uild] major[ ;minor[ ;build]]:選擇性。/VerifyB[uild] major[;minor[;build]]: Optional. 根據驗證階段期間在 majorminorbuild 引數指定的組建編號,來驗證封裝的組建編號。Verifies the build number of a package against the build numbers that were specified during the verification phase in the major, minor, and build arguments. 如果發生不符的情形,將不會執行封裝。If a mismatch occurs, the package will not execute.

    這些值是 Long 整數。The values are long integers. 此引數可以是下列這三種格式的其中一種,而且 major 的值永遠是必要的:The argument can have one of three forms, with a value for major always required:

    • majormajor

    • major;minormajor;minor

    • major; minor; buildmajor; minor; build

  • /VerifyP[ackageID] packageID/VerifyP[ackageID] packageID:
    選擇性。Optional. 將封裝 GUID 與 package_id 引數所指定的值進行比較,藉此驗證要執行之封裝的 GUID。Verifies the GUID of the package to be executed by comparing it to the value specified in the package_id argument.

  • /VerifyS[igned]/VerifyS[igned]:
    選擇性。Optional. 使 Integration ServicesIntegration Services 檢查封裝的數位簽章。Causes Integration ServicesIntegration Services to check the digital signature of the package. 如果此封裝未簽署或是簽章無效,此封裝就會失敗。If the package is not signed or the signature is not valid, the package fails. 如需詳細資訊,請參閱使用數位簽章來識別封裝的來源For more information, see Identify the Source of Packages with Digital Signatures.

    重要

    Integration ServicesIntegration Services 設定為檢查封裝的簽章時,將只會檢查數位簽章是否存在、是否有效,以及是否來自信任的來源。When configured to check the signature of the package, Integration ServicesIntegration Services only checks whether the digital signature is present, is valid, and is from a trusted source. Integration ServicesIntegration Services 不會檢查封裝是否經過變更。does not check whether the package has been changed.

    注意

    選擇性BlockedSignatureStates登錄值可指定的設定中設定的數位簽章選項更具限制性SQL Server Data Tools (SSDT)SQL Server Data Tools (SSDT)或在dtexec命令列。The optional BlockedSignatureStates registry value can specify a setting that is more restrictive than the digital signature option set in SQL Server Data Tools (SSDT)SQL Server Data Tools (SSDT) or at the dtexec command line. 在此情況下,更具限制性的登錄設定會覆寫其他設定。In this situation, the more restrictive registry setting overrides the other settings.

  • /VerifyV[ersionID] versionID:選擇性。/VerifyV[ersionID] versionID: Optional. 在封裝驗證階段期間,將封裝的版本 GUID 與 version_id 引數所指定的值進行比較,藉此驗證要執行之封裝的版本 GUID。Verifies the version GUID of a package to be executed by comparing it to the value specified in the version_id argument during package Validation Phase.

  • /VLog [Filespec] :選擇性。/VLog [Filespec]: Optional. 將所有 Integration Services 封裝事件寫入設計封裝時啟用的記錄提供者。Writes all Integration Services package events to the log providers that were enabled when the package was designed. 若要讓 Integration Services 啟用文字檔的記錄提供者,並將記錄事件寫入指定的文字檔,請以 Filespec 參數的形式包含路徑和檔案名稱。To have Integration Services enable a log provider for text files and write log events to a specified text file, include a path and file name as the Filespec parameter.

    如果您未包含 Filespec 參數,Integration Services 將不會啟用文字檔的記錄提供者。If you do not include the Filespec parameter, Integration Services will not enable a log provider for text files. Integration Services 只會將記錄事件寫入設計封裝時啟用的記錄提供者。Integration Services will only write log events to the log providers that were enabled when the package was designed.

  • /W[arnAsError]/W[arnAsError]:
    選擇性。Optional. 使封裝將警告視為錯誤,因此,當驗證期間發生警告時,封裝便會失敗。Causes the package to consider a warning as an error; therefore, the package will fail if a warning occurs during validation. 若驗證期間未發生警告,亦未指定 /Validate 選項,即會執行封裝。If no warnings occur during validation and the /Validate option is not specified, the package is executed.

  • /X86:選擇性。/X86: Optional. 使 [SQL Server]SQL Server Agent 在 64 位元電腦上以 32 位元模式執行封裝。Causes [SQL Server]SQL Server Agent to run the package in 32-bit mode on a 64-bit computer. 當下列條件都成立時, [SQL Server]SQL Server Agent 就會設定這個選項:This option is set by [SQL Server]SQL Server Agent when the following conditions are true:

    • 作業步驟類型是 [SQL Server Integration Services 封裝]The job step type is SQL Server Integration Services package.

    • 已經在 [新增作業步驟] 對話方塊的 [執行選項] 索引標籤上選取 [使用 32 位元執行階段] 選項。The Use 32 bit runtime option on the Execution options tab of the New Job Step dialog box is selected.

    您也可以針對 [SQL Server]SQL Server Agent 作業步驟設定此選項,方法是使用預存程序或 SQL Server 管理物件 (SMO),以程式設計方式建立作業。You can also set this option for a [SQL Server]SQL Server Agent job step by using stored procedures or SQL Server Management Objects (SMO) to programmatically create the job.

    這個選項只能由 [SQL Server]SQL Server Agent 使用。This option is only used by [SQL Server]SQL Server Agent. 如果在命令提示字元處執行 dtexec 公用程式,系統將會忽略此選項。This option is ignored if you run the dtexec utility at the command prompt.

備註Remarks

命令選項的指定順序可能會影響封裝的執行方式:The order in which you specify command options can influence the way in which the package executes:

  • 依照在命令列中發現選項的順序來處理選項。Options are processed in the order they are encountered on the command line. 在命令列上發現命令檔案時便會加以讀取,Command files are read in as they are encountered on the command line. 命令檔案中的命令也就會依照發現的順序來處理。The commands in the command file are also processed in the order they are encountered.

  • 如果相同選項、參數或變數在同一個命令列陳述式中重複出現,以選項的最後一個執行個體優先。If the same option, parameter, or variable appears in the same command line statement more than one time, the last instance of the option takes precedence.

  • /Set/ConfigFile 選項會依據發現的順序進行處理。/Set and /ConfigFile options are processed in the order they are encountered.

範例Examples

下列範例示範如何使用dtexec若要設定及執行的命令提示字元公用程式[SQL Server]SQL ServerIntegration ServicesIntegration Services封裝。The following examples demonstrate how to use the dtexec command prompt utility to configure and execute [SQL Server]SQL Server Integration ServicesIntegration Services packages.

[Running Packages]Running Packages

若要利用 Windows 驗證來執行儲存至 SSISSSIS[SQL Server]SQL Server 封裝,請使用下列程式碼:To execute an SSISSSIS package saved to [SQL Server]SQL Server using Windows Authentication, use the following code:

dtexec /sq pkgOne /ser productionServer  

若要執行儲存到 SSIS 封裝存放區中檔案系統資料夾的 SSISSSIS 封裝,請使用下列程式碼:To execute an SSISSSIS package saved to the File System folder in the SSIS Package Store, use the following code:

dtexec /dts "\File System\MyPackage"  

若要在不執行封裝的情況下,驗證使用 Windows 驗證且儲存在 [SQL Server]SQL Server 中的封裝,請使用下列程式碼:To validate a package that uses Windows Authentication and is saved in [SQL Server]SQL Server without executing the package, use the following code:

dtexec /sq pkgOne /ser productionServer /va  

若要執行儲存在檔案系統中的 SSISSSIS 封裝,請使用下列程式碼:To execute an SSISSSIS package that is saved in the file system, use the following code:

dtexec /f "c:\pkgOne.dtsx"   

若要執行儲存在檔案系統中的 SSISSSIS 封裝,且要指定記錄選項,請使用下列程式碼:To execute an SSISSSIS package that is saved in the file system, and specify logging options, use the following code:

dtexec /f "c:\pkgOne.dtsx" /l "DTS.LogProviderTextFile;c:\log.txt"  

若要執行使用 Windows 驗證、儲存在 [SQL Server]SQL Server的預設本機執行個體,且會在執行之前確認版本的封裝,請使用下列程式碼:To execute a package that uses Windows Authentication and is saved to the default local instance of [SQL Server]SQL Server, and verify the version before it is executed, use the following code:

dtexec /sq pkgOne /verifyv {c200e360-38c5-11c5-11ce-ae62-08002b2b79ef}  

若要執行儲存在檔案系統中且在外部進行設定的 SSISSSIS 封裝,請使用下列程式碼:To execute an SSISSSIS package that is saved in the file system and configured externally, use the following code:

dtexec /f "c:\pkgOne.dtsx" /conf "c:\pkgOneConfig.cfg"  

注意

如果路徑或檔案名稱中包含空格,就必須將 /SQL、/DTS 或 /FILE 選項的 package_pathfilespec 引數包含在引號中。The package_path or filespec arguments of the /SQL, /DTS, or /FILE options must be enclosed in quotation marks if the path or file name contains a space. 如果引數沒有用引號括住,則引數不能包含空格。If the argument is not enclosed in quotation marks, the argument cannot contain white space.

記錄選項Logging Option

若有三個記錄項目類型 A、B 和 C,下列不含參數的 ConsoleLog 選項會顯示這三個記錄類型及其所有欄位:If there are three log entry types of A, B, and C, the following ConsoleLog option without a parameter displays all three log types with all fields:

/CONSOLELOG  

下列選項會顯示所有記錄類型,但只會顯示 [名稱] 和 [訊息] 資料行:The following option displays all log types, but with the Name and Message columns only:

/CONSOLELOG NM  

下列選項只會顯示記錄項目類型 A 的所有資料行:The following option displays all columns, but only for log entry type A:

/CONSOLELOG I;LogEntryTypeA  

下列選項只會顯示記錄項目類型 A 及其 [名稱] 和 [訊息] 資料行:The following option displays only log entry type A, with Name and Message columns:

/CONSOLELOG NM;I;LogEntryTypeA  

下列選項會顯示記錄項目類型 A 和 B 的記錄項目:The following option displays log entries for log entry types A and B:

/CONSOLELOG I;LogEntryTypeA;LogEntryTypeB  

您可以利用多個 ConsoleLog 選項來達到相同結果:You can achieve the same results by using multiple ConsoleLog options:

/CONSOLELOG I;LogEntryTypeA /CONSOLELOG I;LogEntryTypeB  

若使用 ConsoleLog 選項時不含參數,則會顯示所有欄位。If the ConsoleLog option is used without parameters, all fields are displayed. 若包含 list_options 參數會使下列命令只顯示記錄項目 A 及其所有欄位:The inclusion of a list_options parameter causes the following to displays only log entry type A, with all fields:

/CONSOLELOG NM;I;LogEntryTypeA /CONSOLELOG  

下列項目會顯示記錄項目類型 A 以外的所有記錄項目;也就是說,它只會顯示記錄項目類型 B 和 C:The following displays all log entries except log entry type A: that is, it displays log entry types B and C:

/CONSOLELOG E;LogEntryTypeA  

下列範例會利用多個 ConsoleLog 選項和單一排除項來達到相同結果:The following example achieves the same results by using multiple ConsoleLog options and a single exclusion:

/CONSOLELOG E;LogEntryTypeA /CONSOLELOG  
/CONSOLELOG E;LogEntryTypeA /CONSOLELOG E;LogEntryTypeA  
/CONSOLELOG E;LogEntryTypeA;LogEntryTypeA  

下列範例不會顯示任何記錄訊息,因為當記錄檔類型同時在包含和排除的清單中找到時,就會將它排除。The following example displays no log messages, because when a log file type is found in both the included and excluded lists, it will be excluded.

/CONSOLELOG E;LogEntryTypeA /CONSOLELOG I;LogEntryTypeA  

SET 選項SET Option

以下顯示如何使用 /SET 選項在從命令列啟動封裝時,變更任何封裝屬性或變數的值。The following example shows how to use the /SET option, which lets you change the value of any package property or variable when you start the package from the command line.

/SET \package\DataFlowTask.Variables[User::MyVariable].Value;newValue  

專案選項Project Option

下列範例顯示如何使用 /Project/Package 選項。The following example shows how to use the /Project and the /Package option.

/Project c:\project.ispac /Package Package1.dtsx  

下列範例顯示如何使用 /Project/Package 選項,以及設定封裝和專案參數。The following example shows how to use the /Project and /Package options, and set package and project parameters.

/Project c:\project.ispac /Package Package1.dtsx /SET \Package.Variables[$Package::Parameter];1 /SET \Package.Variables[$Project::Parameter];1  
  

ISServer 選項ISServer Option

下列範例顯示如何使用 /ISServer 選項。The following example shows how to use the /ISServer option.

dtexec /isserver "\SSISDB\MyFolder\MyProject\MyPackage.dtsx" /server "."  

下列範例顯示如何使用 /ISServer 選項,以及設定專案和連接管理員參數。The following example shows how to use the /ISServer option and set project and connection manager parameters.

/Server localhost /ISServer "\SSISDB\MyFolder\Integration Services Project1\Package.dtsx" /Par "$Project::ProjectParameter(Int32)";1 /Par "CM.SourceServer.InitialCatalog";SourceDB  
  

在 SQL Server Data Tools 中執行套件Run a Package in SQL Server Data Tools

www.mattmasson.com 上的部落格文章: 結束碼、DTEXEC 和 SSIS 目錄Blog entry, Exit Codes, DTEXEC, and SSIS Catalog, on www.mattmasson.com.