How to Clear Orphaned Orchestrator Runbook Instances

Author by Christopher Mank

When working with Orchestrator Runbooks, you have the ability to configure Monitor Runbooks.  As opposed to Runbooks that are run on demand or called from a parent Runbook, Monitor Runbooks are constantly running.  They can either be monitoring for scheduled date/times (Monitor Date/Time Activity) or in the case of the Service Manager Integration Pack, monitoring for newly created or updated objects in the CMDB (Monitor Object Activity). When you view the Log tab of a Monitor Runbook in the Runbook Designer, this is what it should look like.  One entry indicated that the Runbook is running. Monitor Runbook Normal Image However, if you open the Log tab of one of your Monitor Runbooks, you may see something like this. Monitor Runbook Broken Image Notice the issue?  There are multiple instances of the same Monitor Runbook running when there should only be one.  These Runbook instances are considered Orphaned Runbook Instances.  This occurs when the Runbook Service has issues and takes itself offline.  When the service is cycled, any Monitor Runbooks you have running will create these orphaned instances. Microsoft recently released a new Knowledge Base article (which you can find here) that explains how this issue can occur and how you can create a SQL Index on one of the tables in the Orchestrator DB to help prevent this issue.  I highly recommend you implement this update as soon as possible in your Orchestrator environment. Although this fix should prevent the issue from occurring going forward, it does not fix existing orphaned Runbook instances.  So how do we clean them up? One way is to run the built in Log Purge function in the Runbook Designer.  This will clear all orphaned Runbook instances, assuming the Monitor Runbook is stopped.  However, there is an even easier way to clear them without touching any of the logs.  Here are the steps. 1.  Stop any Monitor Runbooks that have orphaned instances. 2.  Login to SQL Server Management Studio and connect to the server that runs the Orchestrator DB. 3.  Run the following query against the Orchestrator DB.  This will execute the ClearOrphanedRunbookInstances Stored Procedure that will clear any orphaned Runbook instance that may be running in your environment. USE [Orchestrator] GO DECLARE @return_value int EXEC @return_value = [Microsoft.SystemCenter.Orchestrator.Runtime.Internal].[ClearOrphanedRunbookInstances] SELECT 'Return Value' = @return_value GO 4.  Start the Monitor Runbooks that you stopped in Step #1. That's all to it.  A nice and quick way to clear the orphaned instances. Until the Whole World Hears, Christopher

Author

Christopher Mank

Systems Architect