Deleting Microsoft Dynamics CRM 2013 Organization from SQL


Requirement: Delete Microsoft Dynamics CRM Organization

Solution: We can follow below steps to delete Dynamics CRM Organization from DB.

  1. Connect to CRM DB server and right click on CRM organization DB (for example DEMO_MSCRM)
  2. Select Delete and make sure to select Close existing connections

MDMD

This will delete organization DB , but we also need to remove Organization references from MSCRM_CONFIG DB, so follow below steps.

  1. Fire below select statement against MSCRM_CONFIG DB

select * from [dbo].Organization

  1. Note down ID of your organization, we need it for below queries.
  2. Execute following commends against MSCRM_CONFIG DB, you can change parameter and run all of them in one go

         delete from [dbo].[OrganizationFeatureMap] where OrganizationId=’ORG_GUID’

         delete from [dbo].SystemUserOrganizations where OrganizationId=’ORG_GUID’

         delete from [dbo].[OrganizationProperties] where Id=’ORG_GUID’

         delete from dbo.Organization where DatabaseName=’ORGNAME_MSCRM’

Note: This is an unsupported method of removing Organization DB and should be used only when not able to delete organization from Deployment Manager for specific reasons.

Hope it will help someone !!

Advertisements

Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s