运行 Integration Services (SSIS) 包Run Integration Services (SSIS) Packages

适用范围:SQL Server,包括 Linux Azure SQL 数据库yesAzure SQL 数据仓库no并行数据仓库 APPLIES TO: yesSQL Server, including on Linux yesAzure SQL Database yesAzure SQL Data Warehouse noParallel Data Warehouse

要运行 Integration ServicesIntegration Services 包,您可以根据包的存储位置使用某个工具。To run an Integration ServicesIntegration Services package, you can use one of several tools depending on where those packages are stored. 下表中列出了这些工具。The tools are listed in the table below.

备注

本文介绍如何在一般情况下运行 SSIS 包以及如何在本地运行包。This article describes how to run SSIS packages in general, and how to run packages on premises. 还可在以下平台上运行 SSIS 包:You can also run SSIS packages on the following platforms:

为了在 Integration ServicesIntegration Services 服务器上存储包,您使用项目部署模型将项目部署到服务器。To store a package on the Integration ServicesIntegration Services server, you use the project deployment model to deploy the project to the server. 有关信息,请参阅部署 Integration Services (SSIS) 项目和包For information, see Deploy Integration Services (SSIS) Projects and Packages.

为了在 SSIS 包存储区、msdb 数据库或文件系统中存储包,您使用包部署模型。To store a package in the SSIS Package store, the msdb database, or in the file system, you use the package deployment model. 有关详细信息,请参阅早期包部署 (SSIS)For more information, see Legacy Package Deployment (SSIS).

工具Tool 在 Integration Services 服务器上存储的包Packages that are stored on the Integration Services server 在 SSIS 包存储区或 msdb 数据库中存储的包Packages that are stored in the SSIS Package Store or in the msdb database 在文件系统中存储的包,在属于 SSIS 包存储区的位置之外Packages that are stored in the file system, outside of the location that is part of the SSIS Package Store
SQL Server Data ToolsSQL Server Data Tools No No

但是,你可以将现有包从包括 msdb 数据库的 SSISSSIS 包存储区添加到项目中。However, you can add an existing package to a project from the SSISSSIS Package Store, which includes the msdb database. 以此方式将现有包添加到项目中将在文件系统中生成该包的本地副本。Adding an existing package to the project in this manner makes a local copy of the package in the file system.
Yes
SQL Server Management Studio(连接到托管 Integration Services 服务器的数据库引擎实例时)SQL Server Management Studio, when you are connected to an instance of the Database Engine that hosts the Integration Services server

有关详细信息,请参阅 Execute Package Dialog BoxFor more information, see Execute Package Dialog Box
Yes No

但是,可以从这些位置将包导入服务器。However, you can import a package to the server from these locations.
No

但是,可以从文件系统将包导入服务器。However, you can import a package to the server from the file system.
SQL Server Management Studio(连接到托管启用为 Scale Out Master 的 Integration Services 服务器的数据库引擎实例时)SQL Server Management Studio, when you are connected to an instance of the Database Engine that hosts the Integration Services server that is enabled as Scale Out Master

有关详细信息,请参阅在 Scale Out 中运行包For more information, see Run packages in Scale Out
Yes No No
SQL Server Management Studio(连接到管理 SSIS 包存储的 Integration Services 服务时)SQL Server Management Studio, when it is connected to the Integration Services service that manages the SSIS Package Store No Yes No

但是,可以从文件系统将包导入 SSISSSIS 包存储区中。However, you can import a package to the SSISSSIS Package Store from the file system.
dtexecdtexec

有关详细信息,请参阅 dtexec UtilityFor more information, see dtexec Utility.
Yes Yes Yes
dtexecuidtexecui

有关详细信息,请参阅执行包实用工具 (DtExecUI) 用户界面参考For more information, see Execute Package Utility (DtExecUI) UI Reference
No Yes Yes
SQL Server 代理SQL Server Agent

使用 SQL ServerSQL Server 代理作业计划运行包。You use a SQL ServerSQL Server Agent job To schedule a package.

有关详细信息,请参阅 SQL Server Agent Jobs for PackagesFor more information, see SQL Server Agent Jobs for Packages.
Yes Yes Yes
内置存储过程Built-in stored procedure

有关详细信息,请参阅 catalog.start_execution(SSISDB 数据库)For more information, see catalog.start_execution (SSISDB Database)
Yes No No
托管的 API,通过使用 Microsoft.SqlServer.Management.IntegrationServices 命名空间中的类型和成员Managed API, by using types and members in the Microsoft.SqlServer.Management.IntegrationServices namespace Yes No No
托管的 API,通过使用 Microsoft.SqlServer.Dts.Runtime 命名空间中的类型和成员Managed API, by using types and members in the Microsoft.SqlServer.Dts.Runtime namespace 目前不可用Not currently Yes Yes

执行和日志记录Execution and Logging

可以启用 Integration ServicesIntegration Services 包进行日志记录,这样就可以在日志文件中捕获运行时信息。Integration ServicesIntegration Services packages can be enabled for logging and you can capture run-time information in log files. 有关详细信息,请参阅 Integration Services (SSIS) 日志记录For more information, see Integration Services (SSIS) Logging.

您可以使用操作报告监视部署到 Integration ServicesIntegration Services 服务器并在其上运行的 Integration ServicesIntegration Services 包。You can monitor Integration ServicesIntegration Services packages that are deployed to and run on the Integration ServicesIntegration Services server by using operation reports. 可以在 SQL Server Management StudioSQL Server Management Studio中使用这些报告。The reports are available in SQL Server Management StudioSQL Server Management Studio. 有关详细信息,请参阅 Reports for the Integration Services ServerFor more information, see Reports for the Integration Services Server.

在 SQL Server Data Tools 中运行包Run a Package in SQL Server Data Tools

在开发、调试和测试包的过程中,通常在 SQL Server Data Tools (SSDT)SQL Server Data Tools (SSDT) 中运行包。You typically run packages in SQL Server Data Tools (SSDT)SQL Server Data Tools (SSDT) during the development, debugging, and testing of packages. 在从 SSISSSIS 设计器运行包时,包始终可以立即运行。When you run a package from SSISSSIS Designer, the package always runs immediately.

包运行时, SSISSSIS 设计器在 “进度” 选项卡上显示包执行的进度。除了有关包中失败的所有任务或容器的信息外,还可以查看包及其任务和容器的开始时间和完成时间。While a package is running, SSISSSIS Designer displays the progress of package execution on the Progress tab. You can view the start and finish time of the package and its tasks and containers, in addition to information about any tasks or containers in the package that failed. 在包完成运行后,运行时信息仍显示在“执行结果” 选项卡上。有关详细信息,请参阅 Debugging Control Flow主题中的“进度报告”部分。After the package finishes running, the run-time information remains available on the Execution Results tab. For more information, see the section, "Progress Reporting," in the topic, Debugging Control Flow.

设计时部署Design-time deployment. SQL Server Data ToolsSQL Server Data Tools中运行包时,包被生成,然后部署到文件夹。When you run a package in SQL Server Data ToolsSQL Server Data Tools, the package is built and then deployed to a folder. 在运行包前,可以指定要包将部署到其中的文件夹。Before you run the package, you can specify the folder to which the package is deployed. 如果未指定文件夹,默认将使用 bin 文件夹。If you do not specify a folder, the bin folder is used by default. 这种部署称为设计时部署。This type of deployment is called design-time deployment.

在 SQL Server Data Tools 中运行包To run a package in SQL Server Data Tools

  1. 在“解决方案资源管理器”中,如果解决方案包含多个项目,则右键单击包含包的 Integration ServicesIntegration Services 项目,然后单击“设为启动对象” 以便设置启动项目。In Solution Explorer, if your solution contains multiple projects, right-click the Integration ServicesIntegration Services project that contains the package, and then click Set as StartUp Object to set the startup project.

  2. 在“解决方案资源管理器”中,如果项目包含多个包,则右键单击某个包,然后单击“设为启动对象” 以便设置启动包。In Solution Explorer, if your project contains multiple packages, right-click a package, and then click Set as StartUp Object to set the startup package.

  3. 若要运行包,请执行以下操作:To run a package, use one of the following procedures:

    • 打开要运行的包,然后单击菜单栏上的 “启动调试” ,或按 F5。Open the package that you want to run and then click Start Debugging on the menu bar, or press F5. 包运行完成后,按 Shift+F5 返回设计模式。After the package finishes running, press Shift+F5 to return to design mode.

    • 在“解决方案资源管理器”中,右键单击包,然后单击“执行包” 。In Solution Explorer, right-click the package, and then click Execute Package.

为设计时部署指定不同文件夹To specify a different folder for design-time deployment

  1. 在“解决方案资源管理器”中,右键单击包含要运行的包的 Integration ServicesIntegration Services 项目文件夹,然后单击“属性” 。In Solution Explorer, right-click the Integration ServicesIntegration Services project folder that contains the package you want to run, and then click Properties.

  2. 在“<项目名称> 属性页” 对话框中,单击“生成” 。In the <project name> Property Pages dialog box, click Build.

  3. 更新 OutputPath 属性中的值以指定要用于设计时部署的文件夹,然后单击“确定” 。Update the value in the OutputPath property to specify the folder you want to use for design-time deployment, and click OK.

使用 SQL Server Management Studio 在 SSIS 服务器上运行包Run a Package on the SSIS Server Using SQL Server Management Studio

在将您的项目部署到 Integration ServicesIntegration Services 服务器中之后,可以在该服务器上运行此包。After you deploy your project to the Integration ServicesIntegration Services server, you can run the package on the server.

您可以使用操作报告查看有关服务器上已运行或当前正在运行的包的信息。You can use operations reports to view information about packages that have run, or are currently running, on the server. 有关详细信息,请参阅 Reports for the Integration Services ServerFor more information, see Reports for the Integration Services Server.

使用 SQL Server Management Studio 在服务器上运行包To run a package on the server using SQL Server Management Studio

  1. 打开 SQL Server Management StudioSQL Server Management Studio 并连接到包含 SQL ServerSQL Server 目录的 Integration ServicesIntegration Services 实例。Open SQL Server Management StudioSQL Server Management Studio and connect to the instance of SQL ServerSQL Server that contains the Integration ServicesIntegration Services catalog.

  2. 在对象资源管理器中,展开 “Integration Services 目录” 节点,再展开 “SSISDB” 节点,然后导航到包含在您部署的项目中的包。In Object Explorer, expand the Integration Services Catalogs node, expand the SSISDB node, and navigate to the package contained in the project you deployed.

  3. 右键单击包名称,然后选择“执行” 。Right-click the package name and select Execute.

  4. 使用 “执行包” 对话框中的 “参数”“连接管理器”“高级” 选项卡上的设置来配置包执行。Configure the package execution by using the settings on the Parameters, Connection Managers, and Advanced tabs in the Execute Package dialog box.

  5. 单击 “确定” 运行包。Click OK to run the package.

    -或 --or-

    使用存储过程来运行包。Use stored procedures to run the package. 单击“脚本” 生成创建执行实例并启动执行实例的 Transact-SQL 语句。Click Script to generate the Transact-SQL statement that creates an instance of the execution and starts an instance of the execution. 该语句包含对 catalog.create_execution、catalog.set_execution_parameter_value 和 catalog.start_execution 存储过程的调用。The statement includes a call to the catalog.create_execution, catalog.set_execution_parameter_value, and catalog.start_execution stored procedures. 有关这些存储过程的详细信息,请参阅 catalog.create_execution(SSISDB 数据库)catalog.set_execution_parameter_value(SSISDB 数据库)catalog.start_execution(SSISDB 数据库)For more information about these stored procedures, see catalog.create_execution (SSISDB Database), catalog.set_execution_parameter_value (SSISDB Database), and catalog.start_execution (SSISDB Database).

Execute Package Dialog BoxExecute Package Dialog Box

使用 “执行包” 对话框可以运行在 Integration ServicesIntegration Services 服务器上存储的包。Use the Execute Package dialog box to run a package that is stored on the Integration ServicesIntegration Services server.

Integration ServicesIntegration Services 包可以包含在环境变量中存储的值的参数。An Integration ServicesIntegration Services package may contain parameters that values stored in environment variables. 在执行此类包之前,您必须指定将使用哪一环境来提供环境变量值。Before executing such a package, you must specify which environment will be used to provide the environment variable values. 一个项目可以包含多个环境,但只能使用一个环境在执行时绑定环境变量值。A project may contain multiple environments, but only one environment can be used for binding environment variable values at the time of execution. 如果在包中未使用任何环境变量,则不要求环境。If no environment variables are used in the package, an environment is not required.

您希望做什么?What do you want to do?

打开“执行包”对话框Open the Execute Package dialog box

  1. SQL Server Management StudioSQL Server Management Studio中,连接到 Integration ServicesIntegration Services 服务器。In SQL Server Management StudioSQL Server Management Studio, connect to the Integration ServicesIntegration Services server.

    正在连接到承载 SSISDB 数据库的 SQL Server 数据库引擎SQL Server Database Engine 的实例。You're connecting to the instance of the SQL Server 数据库引擎SQL Server Database Engine that hosts the SSISDB database.

  2. 在对象资源管理器中,展开树以便显示 “Integration Services 目录” 节点。In Object Explorer, expand the tree to display the Integration Services Catalogs node.

  3. 展开 “SSISDB” 节点。Expand the SSISDB node.

  4. 展开包含您要运行的包的文件夹。Expand the folder that contains the package you want to run.

  5. 右键单击该包,然后单击“执行” 。Right-click the package, and then click Execute.

设置“常规”页上的选项Set the Options on the General page

选择 “环境” 以便指定适用于运行的包的环境。Select Environment to specify the environment that is applied with the package is run.

设置“参数”选项卡上的选项Set the Options on the Parameters tab

使用 “参数” 选项卡可以修改在包运行时使用的参数值。Use the Parameters tab to modify the parameter values that are used when the package runs.

设置“连接管理器”选项卡上的选项Set the Options on the Connection Managers tab

使用“连接管理器”选项卡可以设置包连接管理器的属性。Use the Connection Managers tab to set the properties of the package connection manager(s).

设置“高级”选项卡上的选项Set the Options on the Advanced tab

使用“高级”选项卡可以管理属性和其他包设置。Use the Advanced tab to manage properties and other package settings.

“添加” 、“编辑” 、“删除” Add, Edit, Remove
单击以便添加、编辑或删除某一属性。Click to add, edit, or remove a property.

日志记录级别Logging level
选择用于执行包的日志记录级别。Select the logging level for the package execution. 有关详细信息,请参阅 catalog.set_execution_parameter_value(SSISDB 数据库)For more information, see catalog.set_execution_parameter_value (SSISDB Database).

出错时转储Dump on errors
指定在包执行过程中发生错误时是否创建一个转储文件。Specify whether a dump file is created when errors occur during the package execution. 有关详细信息,请参阅 Generating Dump Files for Package ExecutionFor more information, see Generating Dump Files for Package Execution.

32 位运行时32-bit runtime
指定包将在 32 位系统上执行。Specify that the package will execute on a 32-bit system.

编写“执行包”对话框中选项的脚本Scripting the Options in the Execute Package Dialog Box

在您处于 “执行包” 对话框中时,还可以使用工具栏上的 “脚本” 按钮为您编写 Transact-SQLTransact-SQL 代码。While you are in the Execute Package dialog box, you can also use the Script button on the toolbar to write Transact-SQLTransact-SQL code for you. 生成的脚本使用与你在“执行包” 对话框中选择的相同选项调用存储过程 catalog.start_execution(SSISDB 数据库)The generated script calls the stored procedures catalog.start_execution (SSISDB Database) with the same options that you have selected in the Execute Package dialog box. 该脚本出现在 Management StudioManagement Studio的新脚本窗口中。The script appears in a new script window in Management StudioManagement Studio.

另请参阅See Also

dtexec 实用工具 dtexec Utility
启动 SQL Server 导入和导出向导Start the SQL Server Import and Export Wizard