Error message when you delete a record in Microsoft Dynamics CRM: "Error: Deletion Service failed to clean up some tables" (921391)



The information in this article applies to:

  • Microsoft CRM 3.0

SYMPTOMS

When you delete a record in Microsoft Dynamics CRM, the following error message may be logged in the Application log:
Event Type: Error
Event Source: MSCRMDeletionService
Event Category: None
Event ID: 16387
Date: Date
Time: Time
AM User: N/A
Computer: Computer_Name
Description:
Error: Deletion Service failed to clean up some tables.

CAUSE

This problem occurs because there is a constraint on the entity table of the record that is being deleted.

RESOLUTION

To resolve this problem, follow these steps.

Note Before you follow the instructions in this article, make sure that you have a complete backup copy of the database that you can restore if a problem occurs.

To identify the table where the Deletion Service is failing, follow these steps:
  1. On the Microsoft Dynamics CRM server, click Start, click Run, type cmd, and then click OK.
  2. At the command prompt, locate the system drive, locate the program files, locate Microsoft Dynamics CRM, locate the server, locate the bin, type crmdeletionservice.exe -runonce, and then press ENTER. You then receive a message that resembles the following message:Can't clean up the following tables: CampaignNote The table that is returned in the message is the table for which the Deletion Service failed.
The following example demonstrates how to resolve this problem for the Campaign table.

To resolve the problem for the Campaign table, follow these steps:
  1. Run a statement in Microsoft SQL Query Analyzer. To do this, follow these steps:
    1. Click Start, point to All Programs, point to Microsoft SQL Server, and then click Query Analyzer.
    2. Run the following query against the Organization Name_MSCRM database.
      delete from Campaign where DeletionStateCode = 2
      
      This query returns a message that resembles the following message:DELETE statement conflicted with COLUMN REFERENCE constraint 'campaign_leads'.
  2. Open SQL Server Enterprise Manager, and then follow these steps:
    1. In SQL Server Enterprise Manager, open the MSCRM database.
    2. Right-click the CampaignBase table, and then click Design Table.
    3. On the toolbar, click Manage Relationships.
    4. Click the Relationships tab, click the campaign_leads value in the Selected list, click to clear the Enforce relationship for INSERTs and UPDATEs check box, and then click OK.
    5. Repeat steps 2c and 2d.
    6. Click the Relationships tab, click the campaign_leads value in the Selected list, click to select the Enforce relationship for INSERTs and UPDATEs check box, and then click OK.

Modification Type:MinorLast Reviewed:7/24/2006
Keywords:kbtshoot kberrmsg kbMBSMigrate kbprb KB921391 kbAudEndUser kbAudKnowledgeWorker