The System Center 2012 Orchestrator Runbook Service takes itself offline due to database errors resulting from being the victim of one or more deadlocks. Orchestrator platform events as viewed in the Runbook Designer or the Orchestration Console reports the following events:
Summary: Runbook Server <computer> is experiencing frequent errors while accessing the database Details: The Runbook Server is experiencing frequent errors while accessing the database. Verify the status of the database server. If the problem persists, contact Technical Support.
A review of the deadlocks show a stored procedure of dbo.sp_UnpublishPolicyRequest being executed with an objectlock against the dbo.POLICY_REQUEST_ACTION_SERVERS table from each of the locks.
Numerous Runbook Instances are being completed at the same time and executing the dbo.sp_UnpublishPolicyRequest stored procedure to remove the completed instance. The foreign key relationship from the dbo.POLICY_REQUEST_ACTION_SERVERS table with a cascading delete option but no index against the SeqNumber column of the foreign key is causing a full table lock to occur rather than a more selective row lock. When the multiple executions attempt to convert their intent to lock (IX) locks to exclusive (X) locks, the deadlock results.
Use SQL Server Management Studio to execute the following T-SQL against your Orchestrator database to create an index on the SeqNumber column of the dbo.POLICY_REQUEST_ACTION_SERVERS table.
CREATE NONCLUSTERED INDEX [IX_POLICY_REQUEST_ACTION_SERVERS_SeqNumber] ON [dbo].[POLICY_REQUEST_ACTION_SERVERS] ( [SeqNumber] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
Example of what kind of content you will see when examining SQL deadlock graph details: