dtexec 实用工具dtexec Utility

适用对象:是SQL Server,包含 Linux 版 是Azure SQL 数据库 是Azure Synapse Analytics (SQL DW) 否并行数据仓库 APPLIES TO: yesSQL Server, including on Linux yesAzure SQL Database yesAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

dtexec 命令提示实用工具用于配置和执行 SQL ServerSQL Server Integration ServicesIntegration Services 包。The dtexec command prompt utility is used to configure and execute SQL ServerSQL 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 ServerSQL Server 数据库、 SSISSSIS 包存储区和文件系统。The dtexec utility lets you load packages from these sources: the Integration ServicesIntegration Services server, an .ispac project file, a MicrosoftMicrosoft SQL ServerSQL Server database, the SSISSSIS Package Store, and the file system.

注意: 使用当前版本的 dtexec 实用工具来运行使用旧版 Integration ServicesIntegration Services创建的包时,该实用工具会临时将包升级到当前的包格式。NOTE: When you use the current version of the dtexec utility to run a package created by an earlier version of Integration ServicesIntegration Services, the utility temporarily upgrades the package to the current package format. 不过,你不能使用 dtexec 实用工具保存升级的包。However, you cannot use the dtexec utility to save the upgraded package. 有关如何将包永久地升级到当前版本的详细信息,请参阅 Upgrade Integration Services PackagesFor more information about how to permanently upgrade a package to the current version, see Upgrade Integration Services Packages.

本主题包含以下各节:This topic includes the following sections:

Integration Services 服务器和项目文件Integration Services Server and Project File

当你使用 dtexecIntegration ServicesIntegration Services 服务器上运行包时,dtexec 会调用 catalog.create_execution(SSISDB 数据库)catalog.set_execution_parameter_value(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 (SSIS) 项目和包For more information, see Deploy Integration Services (SSIS) Projects and Packages.

你可以使用 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 位版本的原因是:在 PATH 环境变量中,32 位版本的目录路径显示在 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 位目录路径是 <drive>:\Program Files(x86)\Microsoft SQL Server\110\DTS\Binn,而 64 位目录路径是<drive>:\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 代理来运行此实用工具,则 SQL Server 代理会自动使用 64 位版本的实用工具。NOTE: If you use SQL Server Agent to run the utility, SQL Server Agent automatically uses the 64-bit version of the utility. SQL Server 代理使用注册表(而非 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 位版本的实用工具的目录 (<drive>:\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 位版本的实用工具的完整路径 (<drive>:\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.

  • 通过将 64 位路径 (<drive>:\Program Files\Microsoft SQL Server\110\DTS\Binn) 置于 32 位路径 (<drive>:\ Program Files(x86)\Microsoft SQL Server\110\DTS\Binn) 之前,可永久更改 PATH 环境变量中路径的顺序 。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 2017 Integration Services (SSIS)SQL Server 2017 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 2017 Integration Services (SSIS)SQL Server 2017 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.

若要确保运行正确的实用工具版本,请在命令提示符处,通过输入完整路径 (<drive>:\Program Files\Microsoft SQL Server\<version>\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.

ReplTest1Value 描述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"'  

重要说明!!IMPORTANT!! MicrosoftMicrosoftSQL ServerSQL Server中,新安装中将默认禁用 xp_cmdshell 选项。In MicrosoftMicrosoftSQL ServerSQL 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.

从 Bash 中使用 dtexecUsing dtexec from Bash

Bash shell 是适用于 Linux 的常用 shell。The Bash shell is a popular shell for Linux. 它还可在 Windows 上使用。It can also be used on Windows. 可以从 Bash 提示符下运行 dtexec。You can run dtexec from the Bash prompt. 请注意,分号 (;) 在 Bash 中是一个命令分隔符运算符。Notice that a semicolon (;) is a command delimiter operator in Bash. 使用 /Conn[ection]/Par[arameter]/Set 选项将值传递到包时,这一点尤其重要,因为它们使用分号来分隔提供的项的名称和值。This is particularly important when passing in values to the package using the /Conn[ection] or /Par[arameter] or '/Set options since they use the semicolon to separate the name and the value of the item provided. 下面的示例演示了使用 Bash 将值传入包时正确转义分号和其他项的方法:The following example shows how to properly escape the semicolon and other items when using Bash and passing in values to a package:

dtexec /F MyPackage.dtsx /CONN "MyConnection"\;"\"MyConnectionString\""

语法Syntax

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

ParametersParameters

  • /?/? [option_name] :(可选)。[option_name]: (Optional). 显示命令提示符选项,或显示指定的 option_name 的帮助,然后关闭实用工具。Displays the command prompt options, or displays help for the specified option_name and then closes the utility.

    如果指定 option_name 参数,则 dtexec 将启动 SQL ServerSQL Server 联机丛书并显示 dtexec 实用工具主题。If you specify an option_name argument, dtexec starts SQL ServerSQL Server Books Online and displays the dtexec Utility topic.

  • /Ca[llerInfo] :(可选)。/Ca[llerInfo]: (Optional). 指定有关包执行的其他信息。Specifies additional information for a package execution. 使用 SQL Server 代理运行包时,代理设置此参数以指示包执行由 SQL Server 代理调用。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 属性设置为 filespec中指定的路径和文件。Sets 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. 有关详细信息,请参阅 Restart Packages by Using CheckpointsFor more information, see Restart Packages by Using Checkpoints.

    dtexec 的 /CheckPointing on 选项等效于将包的 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 ConfigurationsTo 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 ServerSQL Server 配置。However you can use the /Connection option only for configurations, such as SQL ServerSQL Server configurations, that use a connection manager. 若要了解如何应用包配置,请参阅 包配置SQL Server 2016 中 Integration Services 功能的行为更改To understand how package configurations are applied, see Package Configurations and Behavior Changes to Integration Services Features in SQL Server 2016.

  • /Cons[oleLog] [[displayoptions];[list_optionssrc_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] 选项不适用。NOTE: 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 several 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 PackagesFor 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.

  • (可选)在包运行期间发生一个或多个指定事件时,创建调试转储文件 .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. 若要指定多个事件代码,请用分号 (;) 分隔每个 error code 参数。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  
    

    /Dump error code :默认情况下,Integration ServicesIntegration Services 将调试转储文件存储在 <drive>:\Program Files\Microsoft SQL Server\110\Shared\ErrorDumps 文件夹中 。/Dump error code: By default, Integration ServicesIntegration Services stores the debug dump files in the folder, <drive>:\Program Files\Microsoft SQL Server\110\Shared\ErrorDumps.

    注意: 调试转储文件可能包含敏感信息。NOTE: 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 ExecutionFor more information about debug dump files, see Generating Dump Files for Package Execution.

  • /DumpOnError:(可选)在包运行期间发生任何错误时,创建调试转储文件 .mdmp 和 .tmp。/DumpOnError: (Optional) Creates the debug dump files, .mdmp and .tmp, when any error occurs while the package is running.

    默认情况下,Integration ServicesIntegration Services 将调试转储文件存储在 <drive>:\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.

    注意: 调试转储文件可能包含敏感信息。NOTE: 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 ExecutionFor more information about debug dump files, see Generating Dump Files for Package Execution

  • /Env[Reference] environment reference ID :(可选)。/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 代理使用。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 PackagesFor 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.

 <span data-ttu-id="20e32-324">**/File** 选项不能与 **/DTS** 或 **/SQL** 选项一起使用。</span><span class="sxs-lookup"><span data-stu-id="20e32-324">The **/File** option cannot be used together with the **/DTS** or **/SQL** option.</span></span> <span data-ttu-id="20e32-325">如果指定多个选项, **dtexec** 将失败。</span><span class="sxs-lookup"><span data-stu-id="20e32-325">If multiple options are specified, **dtexec** fails.</span></span>  
  • /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 ServerSQL Server 联机丛书并显示 dtexec 实用工具主题。If you specify an option_name argument, dtexec starts SQL ServerSQL 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 ServerSQL Server 的默认本地实例。If the /Server option is omitted, the default local instance of SQL ServerSQL 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 代理使用。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 ServerSQL 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 所允许的最大并发运行可执行文件数等于执行包的计算机上的处理器总数加二。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] password :(可选)。/P[assword] password: (Optional). 允许检索受 SQL ServerSQL Server 身份验证保护的包。Allows the retrieval of a package that is protected by SQL ServerSQL 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.

    重要说明!!IMPORTANT!! 请尽可能使用 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 comment :(可选)。/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] level [;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 2016 中 Integration Services 功能的行为更改To understand how package configurations are applied, see Package Configurations and Behavior Changes to Integration Services Features in SQL Server 2016.

  • /Ser[ver] server :(可选)。/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.

    指定 /ISServer 选项时,必须指定 /Ser[ver] 选项。The /Ser[ver] option is required when the /ISServer option is specified.

  • /SQ[L] package_path :加载存储在 msdb 数据库的 SQL ServerSQL Server 中的包 。/SQ[L] package_path: Loads a package that is stored in SQL ServerSQL 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 PackagesFor 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 ServerSQL Server 身份验证相关联。If you use the /User option, the /User login name specified is associated with SQL ServerSQL 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.

    重要说明!!IMPORTANT!! 请尽可能使用 Windows 身份验证。When possible, use Windows authentication.

    如果省略 /Server 选项,则假定使用 SQL ServerSQL Server 的默认本地实例。If the /Server option is omitted, the default local instance of SQL ServerSQL 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 ServerSQL Server 身份验证保护的包。Allows the retrieval of a package that is protected by SQL ServerSQL Server Authentication. 仅当指定了 /SQL 选项时才使用此选项。This option is used only when the /SQL option is specified. user_name 值可以用引号引起来。The user_name value can be quoted.

    重要说明!!IMPORTANT!! 请尽可能使用 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.

    这些值是长整数。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.

    重要说明!!IMPORTANT!! 在配置为检查包签名时, 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 命令行中设置的数字签名选项限制性更强的设置。NOTE: 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 ServerSQL Server 代理在 64 位计算机上以 32 位模式运行包。Causes SQL ServerSQL Server Agent to run the package in 32-bit mode on a 64-bit computer. 满足下列条件时此选项由 SQL ServerSQL Server 代理设置:This option is set by SQL ServerSQL 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 管理对象 (SMO) 以编程方式创建此作业,从而为 SQL ServerSQL Server 代理作业步骤设置此选项。You can also set this option for a SQL ServerSQL Server Agent job step by using stored procedures or SQL Server Management Objects (SMO) to programmatically create the job.

    此选项仅由 SQL ServerSQL Server 代理使用。This option is only used by SQL ServerSQL 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 ServerSQL Server Integration ServicesIntegration Services 包。The following examples demonstrate how to use the dtexec command prompt utility to configure and execute SQL ServerSQL Server Integration ServicesIntegration Services packages.

运行包Running Packages

若要使用 Windows 身份验证执行保存到 SSISSSISSQL ServerSQL Server 包,可使用以下代码:To execute an SSISSSIS package saved to SQL ServerSQL 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 ServerSQL Server 中的包但不执行该包,可使用以下代码:To validate a package that uses Windows Authentication and is saved in SQL ServerSQL 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 ServerSQL Server的默认本地实例的包,并在执行前查看其版本,可使用以下代码:To execute a package that uses Windows Authentication and is saved to the default local instance of SQL ServerSQL 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 参数必须用引号引起来。NOTE: 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  

以下选项显示所有日志类型,但只显示 Name 和 Message 列: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 的 Name 和 Message 列: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  
  

www.mattmasson.com 上的博客文章 退出代码、DTEXEC 和 SSIS 目录Blog entry, Exit Codes, DTEXEC, and SSIS Catalog, on www.mattmasson.com.