You're likely aware that the Dynamics CRM 2011 Asynchronous Service regularly executes multiple internal maintenance jobs for each organization (database) and that these are scheduled initially at the time of organization creation on default frequencies (daily, monthly, etc.). Hopefully, you're also aware of the need to reschedule these jobs to execute during non-peak usage hours so as to minimize impact on system performance. If not, I urge you to review our previous blog post that discusses a tool created by one of our team members for this exact purpose, the CRM 2011 Maintenance Job Editor (http://crmjobeditor.codeplex.com).

Earlier we took an in-depth look at one of the more intriguing maintenance jobs in particular, the Deletion Service. But what about those other jobs? For those curious types like myself, here are the juicy details:

UPDATE: The DeletionService and ReindexAll operations were modified slightly in the UR12 release. Additional details have been noted in the table below

UPDATE#2: The DeletionService operation was modified again in the UR16 release. The table has been updated to reflect this change.

Maintenance Job

Operation Code

Purpose

Default Frequency

DeletionService

14

In CRM 4.0, this operation had a more prominent role in that it was responsible for all physical data deletion which occurred asynchronously, but that role has been greatly diminished in 2011 since all entity data is physically deleted immediately. It now performs periodic cleanup of artifacts that were previously associated to deleted entity records such as matchcode, sync subscription, and POA records as well as the deleted object tracking records themselves.

UR12: With the UR12 release, the DeletionService maintenance operation now cleans up subscription tracking records for deleted metadata objects as they expire.

Validates that system-managed indexes exist for all entities and recreates any missing indexes.

Daily

ReindexAll

30

Reorganizes/rebuilds fragmented indexes depending on the amount of fragmentation, and performs a DBCC SHRINKDATABASE command to release unused physical drive space for both database and transaction log files. The latter works well for CRM Online organizations where drive space allocation is governed, but for on-premise environments we generally recommend postponing this job to essentially disable it (next run 1/1/2099) and opt for implementing your own index maintenance routine that does not shrink the physical files.

UR12: With the UR12 release, this maintenance job has been modified to no longer shrink the database/log files as part of the operation. Thus any on-premise installation can now assess the necessity of this job based on the merits of your index maintenance strategy alone.

Daily

CleanupInactiveWorkflowAssemblies

31

Seeks custom workflow assemblies that are no longer referenced in workflow rules or in-process jobs. Those unreferenced assemblies are then deleted. Consider the scenario where you register version 2.0 of a custom workflow assembly. You may update your rules to reference the new version, but some in-progress jobs may still be referencing version 1.0. Once those jobs have completed, this maintenance job will clean up the version 1.0 assembly that is no longer referenced by rules/jobs.

Remember, since the above jobs are technically internal operations, they are subject to change without notice. We'll do our best to keep this article updated on any changes we identify in future updates. If you'd like to see the Deployment SDK extended to provide API's for managing the above operations, please make your voice heard by signing up for Dynamics Suggestions on Microsoft Connect and vote for this feature here! And, while you're on Dynamics Suggestions take some time to vote on other feedback or create feedback of your own.

@Ankit - Unfortunately, no. The current job editor does not provide a means for modifying the schedule of that operation. I recommend that you use the Microsoft Connect site to provide feedback on the need for capabilities specific to the management of particular system jobs.

Greg P

19 Jun 2014 11:28 AM

Is there any way to find out how long these jobs run for. I'm looking in the [AsyncOperation] table but no luck.

@Greg P - I don't believe the duration of job execution is tracked in any of the CRM databases. The MSCRM_CONFIG.[dbo].ScalegroupOrganizationMaintenanceJobs table keeps track of LastResultCode and LastRunTime, but not anything regarding duration. Since these jobs generally execute stored procedures, you could probably profile/trace the core execution at the SQL level. Hope that helps!

David O'Rourke

14 Jan 2015 8:16 AM

If you look in the event log for the CRM server, the async maintenance service logs the start and end times each time it runs a task. You can filter the event log viewer to a source of 'MSCRMAsyncService$maintenance' and just see the logs from this service.

Thom

2 Mar 2015 3:24 AM

I have a job running and the "tasktype=32". I cannot find this maintenance job reference anywhere. any thoughts?