How to clean up tracking database?
Hello,
I'm using the Tracking Service in my host application to retrieve information about the running workflows. I needed to test something, so I downloaded the Tracking Service samples from the Windows SDK website. I accidentally used thesametracking database for the sample application as for my own application. So now is my tracking database polluted with information of the sample application.
How can I safely remove all information of the sample application from the tracking database without damaging the tracking information if my host application? Or is this not possible?
The easiest thing to do would be to re-run the database creation scripts, although that doesn't save the existing tracking information. To do that, you can look at the DeleteWorkflowInstance stored procedure in the tracking database. This does take a WorkflowInstanceInternalId as a parameter, so you would need to get this id from the workflowInstance table where you can relate your workflowId (guid) to the internal tracking id (int). You could also look at the WorkflowTypeId column, as it relates to the Type table to find out which workflows are the ones you don't want in your system.
As with any procedure where you are working in the database like this, make sure that you backup first in case you delete the wrong information.