| 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 |
|
[!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)".
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.
After you have determined which packages are currently running, you can retrieve information about the packages and request that a package be stopped.
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
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.
Package Management (SSIS Service)
Enumerating Available Packages Programmatically