Note: The following two scripts are provided to diagnose and correct fragmentation. If you are familiar with the DBCC INDEXDEFRAG command you do not have to use these scripts. They are provided for your convenience only as this is beyond our scope of support. These scripts should only be run as advised by Blackbaud Customer Support and by someone familiar with SQL Server.
TIEDefrag.exe is a self-extracting ZIP file containing both the TIEFragCheck.sql and DefragmentTableIndexes.sql files. Download and extract these files which can be run via the SQL Server Query Analyzer.
- TIEFragCheck.sql will list all tables in the BBMINE database that are more than 10% fragmented. This script will typically run in 15 minutes or less and is just an analysis which will not change any data.
- DefragmentTableIndexes.sql will defragment each of these tables.
Every 5 minutes, a report of the status will appear in the "Messages" tab in the Query Analyzer results window. This script could take several hours to run. It can be stopped at any time, and it can be run multiple times without harm. This script can be run while users are in the system but may use server resources. To ensure that no users are negatively impacted it is recommended to run this script during off hours.
- The DBCC SHOWCONTIG TSQL command can be used to diagnose table fragmentation.
- The DBCC INDEXDEFRAG TSQL command can be used to defragment a table.
Refer to the SQL Server Books Online for a discussion of these commands.