SQL Maintenance for CRM v4
Posted Thursday, December 4th, 2008
Take the scripts from this document, and create a SQL job to run nightly after a backup to ensure optimal SQL performance.
Rebuild Indexes
For SQL Server 2005:
a) Click Start, point to Programs, point to Microsoft SQL Server 2005, and then click SQL Server Management Studio.
b) In the Connect to Server dialog box enter the server name and select Windows authentication credentials, and then click OK.
c) In the Database Selection menu, select the Microsoft Dynamics CRM database that you want to run this script against.
d) In the Query window, type the following commands:
On the toolbar, click Execute Query. The results appear in the results pane.
De-Fragmenting Indexes with a Script
For SQL Server 2005:
e) Click Start, point to Programs, point to Microsoft SQL Server 2005, and then click SQL Server Management Studio.
f) In the Connect to Server dialog box enter the server name and select Windows authentication credentials, and then click OK.
g) In the Database Selection menu, select the Microsoft Dynamics CRM database that you want to run this script against.
h) In the Query window, type the following commands:





