Managing Data Collection Using Transact-SQL
The data collector provides an extensive collection of stored procedures that you can use to perform any data collection task. In addition, there are functions and views that you can use to get configuration data for the msdb and management data warehouse databases, execution log data, and data that is stored in the management data warehouse.
You can use the stored procedures, functions, and views that are provided to create your own end-to-end data collection scenarios.
Important
Unlike regular stored procedures, the data collector stored procedures use strictly typed parameters and do not support automatic data type conversion. If these parameters are not called with the correct input parameter data types, as specified in the argument description, the stored procedure returns an error.
You can use SQL Server Management Studio to create and execute the provided code samples. For more information, see Using Object Explorer. As an alternative you can create the query in any editor and save it in a text file that has a .sql file name extension. You can execute the query from the Windows command prompt using the sqlcmd utility. For more information, see Using the sqlcmd Utility.
Stored Procedures and Views
Working with the data collector
The following table describes the stored procedures that you can use to work with the data collector.
Procedure name |
Description |
---|---|
Enable the data collector. |
|
Disable the data collector. |
Working with collection sets
The following table describes the stored procedures that you can use to work with collection sets.
Procedure name |
Description |
---|---|
Run a collection set on demand. |
|
Start a collection set. |
|
Stop a collection set. |
|
Create a collection set. |
|
Delete a collection set. |
|
Change a collection set configuration. |
|
Upload collection set data to the management data warehouse. This is effectively an on-demand upload. |
Working with collection items
The following table describes the stored procedures that you can use to work with collection items.
Procedure name |
Description |
---|---|
Create a collection item. |
|
Delete a collection item. |
|
Update a collection item. |
Working with collector types
The following table describes the stored procedures that you can use to work with collector types.
Procedure name |
Description |
---|---|
Create a collector type. |
|
Update a collector type. |
|
Delete a collector type. |
Getting configuration information
The following table describes the views that you can use for getting configuration information and execution log data.
View name |
Description |
---|---|
Get data collector configuration. |
|
Get collection item information. |
|
Get collection set information. |
|
Get collector type information. |
|
Get information about collection set and package execution. |
|
Get information about task execution. |
|
Get information when the execution log is full. |
Configuring access to the management data warehouse
The following table describes the stored procedures that you can use to configure access to the management data warehouse.
Procedure name |
Description |
---|---|
Specify the database name defined in the connection string for the management data warehouse. |
|
Specify the instance defined in the connection string for the management data warehouse. |
Configuring the management data warehouse
The following table describes the stored procedures that you can use to work with the management data warehouse configuration.
Procedure name |
Description |
---|---|
Create a collection snapshot in the management data warehouse. |
|
Update the data source for data collection. |
|
Add a collector type to the management data warehouse. |
|
Remove a collector type from the management data warehouse. |
|
Delete data from the management data warehouse. |
Working with upload packages
The following table describes the stored procedures that you can use to work with upload packages.
Procedure name |
Description |
---|---|
Configure the number of data upload retries. |
|
Specify temporary storage for data between upload retries. |
Working with the data collection execution log
The following table describes the stored procedures that you can use to work with the data collection execution log.
Procedure name |
Description |
---|---|
Delete collection set entries from the execution log. |
Functions
The following table describes the functions that you can use to obtain execution and trace information.
Function name |
Description |
---|---|
Get SSIS execution log data for a specific package. |
|
Get execution statistics for a collection set or package. This information includes errors that are logged. |
|
Get the events that are logged when the Generic SQL Trace collector type is used to collect data. |
In This Section
See Also