SQL Server Maintenance Solution

Ola Hallengren has recently released a new version of his maintenance solution scripts. He has added the ability to log to a table, which is useful if you want to analyse how your indexes are rebuilt and reorganized over time. All you need to do is to set @LogToTable = ‘Y’.

EXECUTE dbo.IndexOptimize @Databases = 'USER_DATABASES', 

@FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',

@FragmentationMedium = 'INDEX_REORGANIZE',

@FragmentationLow = NULL,

@LogToTable = 'Y'

It can also be used with DatabaseBackup and DatabaseIntegrityCheck.

http://ola.hallengren.com/Versions.html

http://ola.hallengren.com/scripts/MaintenanceSolution.sql