CRM 2011 Maintenance Jobs
CRM 2011 has a number of maintenance jobs which are run on a scheduled basis by the Asynchronous Processing Service (maintenance) service. This article describes the jobs and how to schedule them to more convenient times.
Information on the job types can be found in the CRM 2011 SDK under AsyncOperation (System Job) Entity OptionSet Attribute Metadata but the description for what each job type does is limited. Additional information was provided by Microsoft (http://blogs.msdn.com/b/crminthefield/archive/2013/02/07/more-details-on-dynamics-crm-2011-async-service-maintenance-jobs.aspx) as shown below.
- Deletion Service (14): It no longer cleans up physical entity data since a physical delete occurs immediately (no more deletionstatecode), but it does perform some periodic cleanup of artifacts that are associated to deleted records. See my blog post on what specifically it cleans up. Runs daily by default.
- Indexing Management (15): Essentially checks to make sure system-managed indexes exist for all entities and recreates missing indexes. Runs daily by default.
- Reindex All (30): Does two things, 1) it reorganizes or rebuilds fragmented indexes based on the amount of fragmentation, and 2) it performs a DBCC SHRINKDATABASE command to release unused physical drive space for both db and log files. This is a good thing for CRM Online organizations where drive space allocation is governed, but for on-premise we generally recommend postponing this job to essentially disable it (next run 1/1/2099) and implement your own index maintenance routine that does not shrink db/log files. Runs daily by default.
- Cleanup Workflows (21): Looks for instances of workflow assemblies that are no longer referenced in either rules or in-process jobs. Assemblies that no longer have references are deleted. Consider the scenario where you register v2.0 of a custom workflow assembly. You may have updated your rules to reference the new version, but some in-progress jobs may still be referencing v1.0. Once those jobs have completed, this maintenance job will cleanup the v1.0 assembly that no longer contains any references to rules/jobs. Runs daily by default.
- Create Audit Partition (41): Alters the partitioning scheme for the auditbase table (SQL Enterprise only). Runs monthly by default.
- Check for MUI Updates (42): Detects upgrades to MUI packs and schedules workers to perform the reprovisioning. Runs daily by default.
- (UR10+) RefreshRowCountSnapshots (46): Refreshes the Record Count snapshot statistics. Runs daily by default.
- (UR10+) RefreshReadSharingSnapshots (47): Refreshes the POA read snapshot statistics. Runs daily by default.
Note that instances of these jobs are created for each Organization in a deployment and the default schedule is setup based on when the Org is created. Rescheduling for off-peak usage hours is advised for all Organizations.