Microsoft Dynamics CRM 4.0 Performance Optimization

Source: Internet
Author: User
Tags management studio sql server management sql server management studio microsoft dynamics

When you run Microsoft Dynamics CRM 4.0, The asyncoperationbase table is greatly increased. If the table contains millions of records, the performance is slow.

See: http://support.microsoft.com/kb/968520/

However, this operation will delete the data involved in the expected sales report, affecting the normal use of the report. Therefore, after testing, I made the following changes for your reference only.

 

1) Stop IIS on the CRM server and back up your CRM Databases

 

2) create two indexes in the database:

 

Create nonclustered index crm_asyncoperation_cleanupcompleted

On [DBO]. [asyncoperationbase] ([statuscode], [statecode], [operationtype])

 

Go

 

Create nonclustered index crm_duplicaterecord_cleanupcompleted

On [DBO]. [duplicaterecordbase] ([asyncoperationid])

 

Go

 

3) Stop the CRM asynchronous service Microsoft Dynamics CRM async Service

 

4) Open SQL Server Management studio and run the following code:

Declare @ deleterowcount int

Select @ deleterowcount = 2000

Declare @ deletedasyncrowstable table (asyncoperationid uniqueidentifier not null)

Declare @ continue int, @ rowcount int

Select @ continue = 1

While (@ continue = 1)

Begin

Begin tran

Insert into @ deletedasyncrowstable (asyncoperationid)

Select top (@ deleterowcount) asyncoperationid

From asyncoperationbase

Where (operationtype in (1, 9, 12, 25, 27) and statecode = 3 and statuscode in (30, 32 ))

 

Or (operationtype in (10) and statecode = 3 and statuscode in (32 ))

 

Select @ rowcount = 0

Select @ rowcount = count (*) from @ deletedasyncrowstable

Select @ continue = case when @ rowcount <= 0 then 0 else 1 end

 

If (@ continue = 1)

Begin

Delete workflowlogbase from workflowlogbase W, @ deletedasyncrowstable d

Where W. asyncoperationid = D. asyncoperationid

Delete bulkdeletefailurebase from bulkdeletefailurebase B, @ deletedasyncrowstable d

Where B. asyncoperationid = D. asyncoperationid

 

Delete asyncoperationbase from asyncoperationbase A, @ deletedasyncrowstable d

Where a. asyncoperationid = D. asyncoperationid

 

Delete @ deletedasyncrowstable

End

 

Commit

End

======================================

Appendix:

Optimizing and maintaining Microsoft Dynamics CRM 4.0

: Http://www.microsoft.com/downloads/details.aspx? Familyid = ba826cee-eddf-4d6e-842d-27fd654ed893 & displaylang = en

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.