How can we force the rebuild of all index on the Altiris database?
Answer
The following script can be used on SQL Server 2000 and SQL Server 2005 instances:
GO
EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?', ' ',80)"
GO
Note: This script would be best used in a SQL maintenance plan schedule to run bi-weekly or monthly, as it can take from a few minutes to over an hour to execute.
Source: http://www.mssqlcity.com/Articles/Adm/index_fragmentation.htm