A custom data collector for automated tests was deployed successfully at a customer site. However when we’ve tried to replace it in MTM, old versions persisted in the database. The following procedure was used to unregister the stale data collectors.
- Get all data collectors from tbl_DataCollector:
SELECT * FROM [Tfs_DefaultCollection].[dbo].[tbl_DataCollector]
- Execute the stored procedure prc_UnregisterDataCollector with parameters:
@partitionId: the partitionId as appears in the results (usually is 1)
@typeUri: the URI of the data collector you want to unregister, as appears in the results given by running the previous step.
For example, the following script unregisters the custom data collector MyLogsCollector:
DECLARE @return_value int
EXEC @return_value = [dbo].[prc_UnregisterDataCollector]
@partitionId = 1,
@typeUri = N'datacollector://MyCompany/MyLogsCollector/1.0'
SELECT 'Return Value' = @return_value
Or using SQL Management Studio:
- Expand Databases, expand the collection (e.g.: ‘tfs_DefaultCollection’) database, and then expand Programmability.
- Right click on prc_UnregisterDataCollector and select Execute Stored Procedure.
- Enter values for @partitionId and @typeUri from the results in the first step above.
- Click OK. The return value should indicate 0 for successful execution.