Skip to content

Latest commit

 

History

History
61 lines (40 loc) · 3.72 KB

File metadata and controls

61 lines (40 loc) · 3.72 KB
title Managing Running Packages Programmatically
description Managing Running Packages Programmatically
author chugugrace
ms.author chugu
ms.date 03/04/2017
ms.service sql
ms.subservice integration-services
ms.topic reference
helpviewer_keywords
packages [Integration Services], managing
running packages [Integration Services]

Managing Running Packages Programmatically

[!INCLUDEsqlserver-ssis]

As you work programmatically with [!INCLUDEssISnoversion] packages, you may want to determine which packages are currently running. The xref:Microsoft.SqlServer.Dts.Runtime.Application class of the xref:Microsoft.SqlServer.Dts.Runtime namespace provides methods and classes to satisfy these requirements.

For more information about monitoring packages, see Package Management (SSIS Service).

All the methods discussed in this topic require a reference to the Microsoft.SqlServer.ManagedDTS assembly. After you add the reference in a new project, import the xref:Microsoft.SqlServer.Dts.Runtime namespace with a using or Imports statement.

Important

The methods of the xref:Microsoft.SqlServer.Dts.Runtime.Application class for working with the SSIS Package Store support only ".", localhost, or the server name for the local server. You cannot use "(local)".

Determining Which Packages Are Currently Running

To determine which packages are currently running on the specified server, call the xref:Microsoft.SqlServer.Dts.Runtime.Application.GetRunningPackages%2A method. This method returns a xref:Microsoft.SqlServer.Dts.Runtime.RunningPackages collection of xref:Microsoft.SqlServer.Dts.Runtime.RunningPackage objects.

Note

Administrators see all packages that are currently executing on the computer; other users see only those packages that they have launched.

Working with Running Packages

After you have determined which packages are currently running, you can retrieve information about the packages and request that a package be stopped.

Getting Information about a Running Package

As you iterate through the xref:Microsoft.SqlServer.Dts.Runtime.RunningPackages collection, you can use the properties of the xref:Microsoft.SqlServer.Dts.Runtime.RunningPackage object to locate a package or to obtain additional information about the packages that are running:

  • xref:Microsoft.SqlServer.Dts.Runtime.RunningPackage.ExecutionDuration%2A

  • xref:Microsoft.SqlServer.Dts.Runtime.RunningPackage.ExecutionStartTime%2A

  • xref:Microsoft.SqlServer.Dts.Runtime.RunningPackage.InstanceID%2A

  • xref:Microsoft.SqlServer.Dts.Runtime.RunningPackage.PackageDescription%2A

  • xref:Microsoft.SqlServer.Dts.Runtime.RunningPackage.PackageID%2A

  • xref:Microsoft.SqlServer.Dts.Runtime.RunningPackage.PackageName%2A

  • xref:Microsoft.SqlServer.Dts.Runtime.RunningPackage.UserName%2A

Stopping a Running Package

You can call the xref:Microsoft.SqlServer.Dts.Runtime.RunningPackage.Stop%2A method of a xref:Microsoft.SqlServer.Dts.Runtime.RunningPackage object to request that the package be stopped. There may be a delay between the time that a stop request is issued and the time that the package actually stops.

See Also

Package Management (SSIS Service)
Enumerating Available Packages Programmatically