I plan on using the IndexOptimize
script by Ola Hallengren to replace the SharePoint 2013 On Premise Defragmentation Timer Job.
Anyone out there using it for this purpose? What params do you use and how? Here is what I put together to target the databases that the OOOTB Timer job would normally handle:
EXEC sp_msforeachdb
'if exists(select 1 from [?].sys.objects where name=''proc_DefragmentIndices'')
EXECUTE dbo.IndexOptimize
@Databases = ''?'',
@FragmentationLow = NULL,
@FragmentationMedium = ''INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE'',
@FragmentationHigh = ''INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE'',
@FragmentationLevel1 = 5,
@FragmentationLevel2 = 30
'
sp_msforeachdb
- try using Aaron's (in the previous link) or Brent Ozar's version for true reliability.