Home
%3CLINGO-SUB%20id%3D%22lingo-sub-323370%22%20slang%3D%22en-US%22%3ESharePoint%20Database%20Maintenance%20Recommendations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-323370%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3EFirst%20published%20on%20TECHNET%20on%20Nov%2009%2C%202017%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70504i0E1069686CD276C9%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Database%20maintenance%20is%20a%20highly-neglected%20topic%20in%20daily%20SharePoint%20operation.%20It%20seems%20to%20be%20common%20sense%20that%20database%20backups%20must%20occur%20on%20a%20regular%20base%2C%20but%20only%20few%20customers%20realize%20the%20necessity%20to%20do%20some%20extra%20work%20on%20top%20of%20that.%20Main%20reason%20for%26nbsp%3Bnot%20creating%20database%20maintenance%20jobs%26nbsp%3Bis%20missing%20SQL%20in-depth%20knowledge%20(what%20to%20do%20and%20why)%20and%20lack%20of%20time%20to%20care%20about%20it%20(don%E2%80%99t%20know%20how%20to%20set%20it%20up%20and%20where%20to%20find%20someone%20to%20help).%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20TechNet%20is%20highlining%20the%20importance%20of%20this%20topic%20in%20two%20articles%20%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fcc262731(v%3Doffice.14).aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20(Database%20maintenance%20for%20SharePoint%202010%20Products%20%3C%2FA%3E%20%2F%20%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fhh292622.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Best%20practices%20for%20SQL%20Server%20in%20a%20SharePoint%20Server%20farm%20%3C%2FA%3E%20%3A(%3C%2Fimg%3E%20%3CBR%20%2F%3E%3CBLOCKQUOTE%3E%22Routine%20database%20maintenance%20is%20essential%20for%20the%20smooth%20operation%20of%20Microsoft%20SharePoint%20databases%22%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%22(%E2%80%A6)%20we%20strongly%20recommend%20implementing%20a%20scheduled%20maintenance%20plan%20from%20SQL%20Server%20(%E2%80%A6)%22%3C%2FBLOCKQUOTE%3E%3CBR%20%2F%3E%20In%20%3CA%20href%3D%22https%3A%2F%2Fservices.premier.microsoft.com%2Fassess%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Microsoft%20Premier%20Risk%20Assessments%20%3C%2FA%3E%20(RAP%20as%20a%20Service%20for%20SharePoint%20Server)%20a%20missing%20or%20incomplete%20Maintenance%20Job%20would%20result%20in%20an%20High%20Risk%20Finding.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Okay%20%E2%80%93%20I%20guess%20you%20get%20the%20point.%20This%20extra%20stuff%20that%20is%20supposed%20to%20add%20some%20database%20magic%20should%20be%20done.%20But%20anybody%20who%20is%20interested%20in%20setting%20up%20a%20SQL%20maintenance%20plan%2C%20most%20likely%20ends%20up%20in%20not%20finding%20good%20guidance%20that%20is%20up%20to%20date.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20TechNet%20covers%20things%20to%20focus%20on%20-%20unfortunately%20in%20two%20separate%20articles.%20One%20article%20was%20written%20for%20SharePoint%202010%20(%20%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fcc262731(v%3Doffice.14).aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Database%20maintenance%20for%20SharePoint%202010%20Products%20%3C%2FA%3E%20)%2C%20the%20second%20one%20explains%20best%20practices%20for%20SharePoint%202013%20(%20%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fhh292622.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Best%20practices%20for%20SQL%20Server%20in%20a%20SharePoint%20Server%20farm%20%3C%2FA%3E%20).%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Basically%2C%20both%20articles%20are%20important%20and%20valid%2C%20but%20the%20SharePoint%202010%20article%20includes%20some%20outdated%20information%20for%20SharePoint%202013%2F2016%20environments%20(Database%20Fill%20factor%20recommendations%20have%20been%20different%20in%20SharePoint%202010).%20I%20decided%20to%20write%20this%20new%20article%20to%20have%20one%20step%20by%20step%20guide%20that%20possibly%20suits%20for%20most%20SharePoint%20farms.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-1676073183%22%20id%3D%22toc-hId--1442320937%22%20id%3D%22toc-hId--1442320937%22%3EWhat%20to%20include%20in%20the%20SQL%20Maintenance%20Plan%20for%20SharePoint%202013%2F2016%20databases%3C%2FH2%3E%3CBR%20%2F%3E%20Following%20tasks%20should%20be%20included%20in%20your%20SharePoint%20Database%20Maintenance%20Job%3A%20%3CBR%20%2F%3E%3COL%3E%3CBR%20%2F%3E%3CLI%3ECheck%20Database%20Integrity%20Task%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3ERebuild%20Index%20Task%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EUpdate%20Statistics%20(Fullscan)%20Task%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EHistory%20Cleanup%20Task%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EMaintenance%20Cleanup%20Task%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FOL%3E%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70505i9263E330A1746089%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Additional%20Notes%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3EThis%20task%20sequence%20was%20validated%20by%20some%20of%20my%20great%20Microsoft%20colleagues%20%3CBR%20%2F%3E%20(Thank%20you%20Andreas%20Maiwald%2C%20Rainer%20Asbach%20and%20Johann%20Hackl)%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EDatabase%20backup%20tasks%20could%20be%20added%20as%20well%20in%20theory.%20I%20recommend%20packaging%20all%20backup%20related%20tasks%20within%20a%20separate%20Maintenance%20Plan%2C%20for%20a%20more%20granular%20scheduling.%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--876083778%22%20id%3D%22toc-hId-1045191896%22%20id%3D%22toc-hId-1045191896%22%3EHow%20to%20set%20up%20your%20Maintenance%20Plan%3C%2FH2%3E%3CBR%20%2F%3E%20Use%20the%20SQL%20Management%20Studio%20to%20create%20your%20maintenance%20plan.%20Don%E2%80%99t%20use%20the%20wizard%2C%20the%20Maintenance%20Plan%20Editor%20gives%20you%20more%20control%20about%20your%20plan%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70506i1A86BF32196F489C%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Manually%20add%20(drag%20%26amp%3B%20drop)%20the%20tasks%20from%20the%20toolbox%20pane%20into%20your%20plan%20and%20double%20click%20on%20each%20of%20them%2C%20to%20configure%20them%20properly.%26nbsp%3BBut%20prior%20to%20designing%20the%20tasks%20of%20the%20plan%2C%20you%20should%20take%20care%20about%20reporting%2Flogging%2C%20so%20you%20can%20follow%20up%20on%20any%20issues%20or%20Problems.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId-670213052%22%20id%3D%22toc-hId-1735753370%22%20id%3D%22toc-hId-1735753370%22%3EConfigure%20Logging%20and%20Reporting%3C%2FH3%3E%3CBR%20%2F%3E%20SQL%20Server%20offers%20logging%2Freporting%20features%2C%20that%26nbsp%3B%20should%20be%20included%20in%20a%20SQL%20Maintenance%20Plan.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70507i70F5915E299343BA%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CA%20href%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2F2017%2F11%2FSharePointMaintenance_ReportingLogging_Where.png%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20%3C%2FA%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70508i099D6E953CE2AE16%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3EMake%20sure%20to%20get%20familiar%20with%20this%20additional%20reading%3A%20%3CBR%20%2F%3E%20%3C%2FSTRONG%3E%20%3CA%20href%3D%22https%3A%2F%2Fwww.mssqltips.com%2Fsqlservertip%2F3225%2Fsql-server-maintenance-plans-reporting-and-logging%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20SQL%20Server%20Maintenance%20Plans%20Reporting%20and%20Logging%3C%2FA%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId--1881943909%22%20id%3D%22toc-hId--71701093%22%20id%3D%22toc-hId--71701093%22%3E1.%20Task%3A%20Check%20Database%20Integrity%3C%2FH3%3E%3CBR%20%2F%3E%20%3CSTRONG%3EWhy%20do%20we%20need%20this%3A%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20The%20Check%20Database%20Integrity%20Task%20checks%20the%20allocation%20and%20structural%20integrity%20of%20a%20database%2C%20by%20running%20the%20DBCC%20CHECKDB%20Transact-SQL%20statement.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3EHow%20to%20configure%20this%20task%20(Example)%3A%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70509i6EE0AB30292BD581%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3E%20Make%20sure%20to%20get%20familiar%20with%20this%20additional%20reading%3A%20%3CBR%20%2F%3E%20%3C%2FSTRONG%3E%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fmaintenance-plans%2Fcheck-database-integrity-task-maintenance-plan%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Check%20Database%20Integrity%20Task%20(Maintenance%20Plan)%3C%2FA%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId--139133574%22%20id%3D%22toc-hId--1879155556%22%20id%3D%22toc-hId--1879155556%22%3E2.%20Task%3A%20Rebuild%20Index%3C%2FH3%3E%3CBR%20%2F%3E%20%3CSTRONG%3EWhy%20do%20we%20need%20this%3A%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20We%20use%20the%20Rebuild%20Index%20Task%20dialog%20to%20re-create%20the%20indexes%20on%20the%20tables%20in%20the%20database%20with%20a%20new%20fill%20factor.%20The%20fill%20factor%20determines%20the%20amount%20of%20empty%20space%20on%20each%20page%20in%20the%20index%2C%20to%20accommodate%20future%20expansion.%20As%20data%20is%20added%20to%20the%20table%2C%20the%20free%20space%20fills%20because%20the%20fill%20factor%20is%20not%20maintained.%20Reorganizing%20data%20and%20index%20pages%20can%20re-establish%20the%20free%20space.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3EImportant%3A%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20The%20Rebuild%20Index%20Task%20needs%20urgent%20attention%20in%20terms%20of%20%3CEM%3E%20scheduling%20%3C%2FEM%3E%20.%20For%20best%20results%2C%20the%20Rebuild%20Index%20Task%20should%20be%20executed%20in%20offline%20mode.%20If%20the%20SharePoint%20environment%20is%20used%20across%20time%20zones%20(and%20there%20is%20no%20real%20maintenance%20slot%20during%20the%20night)%2C%20the%20plan%20must%20be%20scheduled%20to%20run%20on%20the%20weekend.%20Consider%20creating%20a%20separate%20Rebuild%20Index%20Maintenance%20Plan%20that%20is%20scheduled%20for%20the%20Weekend.%20That%20way%20you%20can%20run%20other%20tasks%20on%20a%20daily%20(nightly)%20base.%20Learn%20about%20the%20difference%20between%20offline%20and%20online%20Index%20Rebuild%3A%20%3CSTRONG%3E%20%3C%2FSTRONG%3E%20%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fcc262731(v%3Doffice.14).aspx%23DBMaintenanceForSPS2010_OnlineVsOfflineIndexRebuild%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Database%20maintenance%20for%20SharePoint%202010%20Products%2C%20Section%3A%20Online%20vs.%20offline%20index%20rebuilds%20%3C%2FA%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3E%20How%20to%20configure%20this%20task%20(Example)%3A%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70510iF03E2D520247642E%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3E%20Make%20sure%20to%20get%20familiar%20with%20this%20additional%20reading%3A%20%3CBR%20%2F%3E%20%3C%2FSTRONG%3E%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fmaintenance-plans%2Frebuild-index-task-maintenance-plan%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Rebuild%20Index%20Task%20(Maintenance%20Plan)%3C%2FA%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId-1603676761%22%20id%3D%22toc-hId-608357277%22%20id%3D%22toc-hId-608357277%22%3E3.%20Task%3A%20Update%20Statistics%20(Fullscan)%3C%2FH3%3E%3CBR%20%2F%3E%20%3CSTRONG%3EWhy%20do%20we%20need%20this%3A%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20Query%20performance%20can%20significantly%20be%20improved%20by%20updating%20database%20statistics%20using%20the%20fullscan%20option.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20There%20have%20been%20multiple%20Premier%26nbsp%3Bcustomers%20I%20support%2C%20who%20suffered%20dramatical%20performance%20issues%20caused%20by%20outdated%20statistics.%20This%20is%20what%20we%20want%20to%20avoid%20by%20creating%20a%20Maintenance%20Plan%20Task%20to%20update%20statistics%20with%20the%20Fullscan%20option.%20If%20the%20statistics%20of%20one%20of%20your%20content%20databases%20is%20in%20such%20a%20poor%20state%2C%20the%20CPU%20load%20of%20your%20SQL%20database%20instance%20is%20likely%20to%20hit%20100%25%2C%20causing%20serious%20problems%20for%20the%20whole%20farm.%20%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Fhelp%2F3103194%2Foutdated-database-statistics-decrease-sharepoint-server-performance%2C-cause-time-outs%2C-and-generate-run-time-errors%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EThis%20is%20a%20known%20issue%20at%20Microsoft%20support%20and%20caused%20by%20outdated%20statistics%20%3C%2FA%3E%20.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Even%20though%20there%20are%20Timer%20Jobs%20%2F%20Health%20Analyzer%20Rules%20that%20are%20supposed%20to%20take%20care%20about%20just%20these%20statistics%2C%20there%20are%20circumstances%20where%20these%20jobs%20do%20not%20work%20properly.%20This%20is%20the%20reason%20why%20Microsoft%20explicitly%20recommends%20creating%20a%20task%20to%20update%20statistics%20using%20the%20fullscan%20option.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3EHow%20to%20configure%20this%20task%20(Example)%3A%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CA%20href%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2F2017%2F11%2FSharePointMaintenance_Tasks_2_RebuildIndexTask.png%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20%3C%2FA%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70511iD87B6528CE66AF2C%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3E%20Make%20sure%20to%20get%20familiar%20with%20this%20additional%20reading%20%3C%2FSTRONG%3E%20%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fmaintenance-plans%2Fupdate-statistics-task-maintenance-plan%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Update%20Statistics%20Task%20(Maintenance%20Plan)%20%3C%2FA%3E%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Fhelp%2F3103194%2Foutdated-database-statistics-decrease-sharepoint-server-performance%2C-cause-time-outs%2C-and-generate-run-time-errors%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Outdated%20database%20statistics%20decrease%20SharePoint%20Server%20performance%2C%20cause%20time-outs%2C%20and%20generate%20run-time%20errors%20%3C%2FA%3E%20%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fhh292622.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20%3C%2FA%3E%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fhh292622.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Best%20practices%20for%20SQL%20Server%20in%20a%20SharePoint%20Server%20farm%20%3C%2FA%3E%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId--948480200%22%20id%3D%22toc-hId--1199097186%22%20id%3D%22toc-hId--1199097186%22%3E4.%20Task%3A%20History%20Cleanup%20Task%3C%2FH3%3E%3CBR%20%2F%3E%20%3CSTRONG%3EWhy%20do%20we%20need%20this%3A%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20The%20History%20Cleanup%20Task%20discards%20old%20historical%20information%20from%20tables%20in%20the%20msdb%20database.%20This%20task%20supports%20deleting%20backup%20and%20restore%20history%2C%20SQL%20Server%20Agent%20Job%20history%2C%20and%20maintenance%20plan%20history.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3EHow%20to%20configure%20this%20task%20(Example)%3A%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70512i18427FBAB08812E7%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3E%20Make%20sure%20to%20get%20familiar%20with%20this%20additional%20reading%3A%20%3CBR%20%2F%3E%20%3C%2FSTRONG%3E%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fmaintenance-plans%2Fhistory-cleanup-task-maintenance-plan%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20History%20Cleanup%20Task%20(Maintenance%20Plan)%3C%2FA%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId-794330135%22%20id%3D%22toc-hId-1288415647%22%20id%3D%22toc-hId-1288415647%22%3E5.%20Task%3A%20Maintenance%20Cleanup%20Task%3C%2FH3%3E%3CBR%20%2F%3E%20%3CSTRONG%3EWhy%20do%20we%20need%20this%3A%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20Use%20the%20Maintenance%20Cleanup%20Task%20to%20remove%20old%20files%20related%20to%20maintenance%20plans%2C%20including%20text%20reports%20(See%3A%20Logging%20and%20Reporting)%20created%20by%20maintenance%20plans%20and%20database%20backup%20files.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3EHow%20to%20configure%20this%20task%20(Example)%3A%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CA%20href%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2F2017%2F11%2FSharePointMaintenance_Tasks_4_HistoryCleanupTask.png%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20%3C%2FA%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70513iF8B4A7912CF1F1C2%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3E%20Make%20sure%20to%20get%20familiar%20with%20this%20additional%20reading%3A%20%3CBR%20%2F%3E%20%3C%2FSTRONG%3E%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fmaintenance-plans%2Fmaintenance-cleanup-task-maintenance-plan%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Maintenance%20Cleanup%20Task%20(Maintenance%20Plan)%3C%2FA%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--1561313321%22%20id%3D%22toc-hId-1277912543%22%20id%3D%22toc-hId-1277912543%22%3EConnecting%20the%20Tasks%20of%20the%20Plan%3C%2FH2%3E%3CBR%20%2F%3E%20Once%20you%20added%20all%20tasks%20and%20configured%20them%20individually%2C%20you%20must%20connect%20them%20all%20together%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70514i6B2BE6991B9F5AA5%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Connect%20them%20by%20pointing%20the%20green%20arrow%20to%20the%20next%20task.%20Double%20click%20the%20connector%20arrow%20and%20configure%20the%20Connection%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70515i08813DAA1756497E%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20After%20connecting%20two%20tasks%2C%20the%20plan%20indicates%20the%20workflow%20between%20two%20tasks%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70516iD530E6EDDF86E124%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-181497014%22%20id%3D%22toc-hId--529541920%22%20id%3D%22toc-hId--529541920%22%3EScheduling%20the%20Maintenance%20Plan%3C%2FH2%3E%3CBR%20%2F%3E%20Customers%20usually%20schedule%20Maintenance%20Plans%20for%20SharePoint%20databases%20on%20a%20daily%2Fweekly%20base%20(depending%20on%20the%20runtime).%20Plans%20must%20be%20aligned%20with%20other%20maintenance%20tasks%20like%20backup%20Jobs%20and%20are%20scheduled%20to%20run%20in%20off%20peak%20hours%20(during%20the%20night%2C%20at%20the%20weekend)%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3E%20Important%3A%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20The%20Rebuild%20Index%20Task%20needs%20urgent%20attention%20in%20terms%20of%20%3CEM%3E%20scheduling%20%3C%2FEM%3E%20.%20For%20best%20results%2C%20the%20Rebuild%20Index%20Task%20should%20be%20executed%20in%20offline%20mode.%20If%20the%20SharePoint%20environment%20is%20used%20across%20time%20zones%20(and%20there%20is%20no%20real%20maintenance%20slot%20during%20the%20night)%2C%20the%20plan%20must%20be%20scheduled%20to%20run%20on%20the%20weekend.%20Consider%20creating%20a%20separate%20Rebuild%20Index%20Maintenance%20Plan%20that%20is%20scheduled%20for%20the%20Weekend.%20That%20way%20you%20can%20run%20other%20tasks%20on%20a%20daily%20(nightly)%20base.%20%3CBR%20%2F%3E%20Learn%20about%20the%20difference%20between%20offline%20and%20online%20Index%20Rebuild%3A%20%3CSTRONG%3E%20%3C%2FSTRONG%3E%20%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fcc262731(v%3Doffice.14).aspx%23DBMaintenanceForSPS2010_OnlineVsOfflineIndexRebuild%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Database%20maintenance%20for%20SharePoint%202010%20Products%2C%20Section%3A%20Online%20vs.%20offline%20index%20rebuilds%3C%2FA%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--1485383382%22%20id%3D%22toc-hId--663226644%22%20id%3D%22toc-hId--663226644%22%3ETest%20the%20Maintenance%20Plan%3C%2FH2%3E%3CBR%20%2F%3E%20Carefully%20evaluate%20the%20Maintenance%20Plan%20on%20your%20Test%20Environment%20for%20a%20period%20of%20time%20(2-4%20weeks)%2C%20using%20complete%20copies%20of%20your%20production%20databases.%20Check%20the%20overall%20runtime%20and%20make%20sure%20the%20plan%20does%20not%20collide%20with%20other%20scheduled%20maintenance.%20Backup%20Jobs%20of%20transaction%20logs%20are%20not%20affected.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20As%20soon%20as%20you%20have%20insight%20about%20overall%20runtime%20and%20are%20familiar%20with%20the%20necessary%20configuration%20of%20the%20maintenance%20plan%20on%20your%20Test%20environment%2C%20create%20the%20Plan%20on%20your%20productive%20environment.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-257426953%22%20id%3D%22toc-hId-1824286189%22%20id%3D%22toc-hId-1824286189%22%3ECheck%20the%20results%20of%20the%20Maintenance%20Plan%3C%2FH2%3E%3CBR%20%2F%3E%20Usually%20you%20check%20the%20results%20of%20your%20database%20maintenance%20using%20following%20two%20options%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3E%201.%26nbsp%3BCheck%20Maintenance%20Job%20History%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20Right%20click%20the%20Maintenance%20Job%20in%20SQL%20Management%20Studio%20and%20choose%20the%20View%20History%20Option%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CA%20href%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2F2017%2F11%2FSharePointMaintenance_ConnectTasks_3.png%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20%3C%2FA%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70517iCCA6B47A709BE9E0%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3E%202.%20Check%20Maintenance%20Job%20Log%20File%20%3CBR%20%2F%3E%20%3C%2FSTRONG%3E%20In%20the%20log%20file%20folder%20(in%20the%20root%20folder%20of%20the%20SQL%20instance)%20there%20is%20a%20log%20file%20for%20each%20Maintenance%20Job.%20This%20can%20be%20reviewed%20and%20checked.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Further%20Reading%3A%20%3CA%20href%3D%22https%3A%2F%2Fwww.mssqltips.com%2Fsqlservertip%2F3225%2Fsql-server-maintenance-plans-reporting-and-logging%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20SQL%20Server%20Maintenance%20Plans%20Reporting%20and%20Logging%3C%2FA%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-2000237288%22%20id%3D%22toc-hId-16831726%22%20id%3D%22toc-hId-16831726%22%3ESQL%20Server%20Jobs%20vs.%20Maintenance%20Plans%3C%2FH2%3E%3CBR%20%2F%3E%20I%20want%20to%20explicitly%20point%20out%2C%20that%20experienced%20database%20admins%20can%20of%20course%20use%20SQL%20Server%20Jobs%20instead%20of%20creating%20a%20SQL%20Server%20Maintenance%20Plan.%20SQL%20Server%20Jobs%20add%20further%20flexibility%20and%20are%20often%20used%20in%20SQL%20Server%20Always%20On%20scenarios.%20The%20steps%20to%20include%20in%20the%20job%20match%20the%20steps%20described%20above.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Further%20reading%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Fssms%2Fagent%2Fcreate-a-job%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Create%20a%20Job%20%3C%2FA%3E%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Fssms%2Fagent%2Fschedule-a-job%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Schedule%20a%20Job%20%3C%2FA%3E%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Fssms%2Fagent%2Fview-the-job-history%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20View%20the%20Job%20History%20%3C%2FA%3E%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--551919673%22%20id%3D%22toc-hId--1790622737%22%20id%3D%22toc-hId--1790622737%22%3EWhat%20you%20must%20not%20do%3C%2FH2%3E%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3EShrinking%20databases%20on%20a%20regular%20base.%26nbsp%3BJust%20don't%26nbsp%3Bdo%20it.%20Shrink%20manually%20if%20you%20really%20have%20to%2C%20but%20never%20include%20it%20in%20a%20Maintenance%20Plan.%20Further%20Reading%3A%20%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fcc262731(v%3Doffice.14).aspx%23DBMaintenanceForSPS2010_ShrinkingDataFiles%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Shrinking%20data%20files%3C%2FA%3E%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3ERun%20Maintenance%20Plan%20during%20working%20hours.%20Don't%20do%20it.%20Performance%20is%20likely%20to%20be%20degraded%20during%20the%20single%20steps%20of%20the%20Maintenance.%20Review%20the%20%3CSTRONG%3E%20Scheduling%20the%20Maintenance%20Plan%20%3C%2FSTRONG%3E%20section%20of%20this%20article%20to%20learn%20more.%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-1190890662%22%20id%3D%22toc-hId-696890096%22%20id%3D%22toc-hId-696890096%22%3EConclusion%3C%2FH2%3E%3CBR%20%2F%3E%20SQL%20Database%20Maintenance%26nbsp%3Bis%20no%20rocket%20science.%20It%20is%20easy%20to%20set%20up%20and%20creates%20performance%20and%20reliability%20benefits.%20Make%20sure%20to%20set%20up%20a%20Maintenance%20Plan%20on%20all%20of%20your%20SharePoint%20farms.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--1361266299%22%20id%3D%22toc-hId--1110564367%22%20id%3D%22toc-hId--1110564367%22%3EFinal%20Note%3C%2FH2%3E%3CBR%20%2F%3E%20Please%20share%20your%20thoughts%20%26amp%3B%20own%26nbsp%3Bexperiences%20in%20the%20comments.%20Any%20feedback%20or%20additions%20for%20this%20post%20is%20highly%20welcome.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Thank%20you%20for%20rating%20this%20article%20if%20you%20liked%20it%20or%20it%20was%20helpful%20for%20you.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-323370%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20TECHNET%20on%20Nov%2009%2C%202017%20Database%20maintenance%20is%20a%20highly-neglected%20topic%20in%20daily%20SharePoint%20operation.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-323370%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Econfiguration%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Edatabase%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOn%20Premises%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Eoperation%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESQL%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1033324%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20Database%20Maintenance%20Recommendations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1033324%22%20slang%3D%22en-US%22%3E%3CP%3EA%20good%20article%20and%20nicely%20written%3B%20I%20am%20interested%20as%20to%20why%20you%20include%20an%20update%20stats%20task%20post%20running%20an%20index%20rebuild%3F%20IX%20rebuilds%20include%20an%20update%20stats%20with%20fullscan%2C%20as%20far%20as%20I%20am%20aware%20so%20this%20seems%20to%20be%20unnecessary(%3F).%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft
First published on TECHNET on Nov 09, 2017


Database maintenance is a highly-neglected topic in daily SharePoint operation. It seems to be common sense that database backups must occur on a regular base, but only few customers realize the necessity to do some extra work on top of that. Main reason for not creating database maintenance jobs is missing SQL in-depth knowledge (what to do and why) and lack of time to care about it (don’t know how to set it up and where to find someone to help).

TechNet is highlining the importance of this topic in two articles (Database maintenance for SharePoint 2010 Products / Best practices for SQL Server in a SharePoint Server farm ):
"Routine database maintenance is essential for the smooth operation of Microsoft SharePoint databases"

"(…) we strongly recommend implementing a scheduled maintenance plan from SQL Server (…)"

In Microsoft Premier Risk Assessments (RAP as a Service for SharePoint Server) a missing or incomplete Maintenance Job would result in an High Risk Finding.

Okay – I guess you get the point. This extra stuff that is supposed to add some database magic should be done. But anybody who is interested in setting up a SQL maintenance plan, most likely ends up in not finding good guidance that is up to date.

TechNet covers things to focus on - unfortunately in two separate articles. One article was written for SharePoint 2010 ( Database maintenance for SharePoint 2010 Products ), the second one explains best practices for SharePoint 2013 ( Best practices for SQL Server in a SharePoint Server farm ).

Basically, both articles are important and valid, but the SharePoint 2010 article includes some outdated information for SharePoint 2013/2016 environments (Database Fill factor recommendations have been different in SharePoint 2010). I decided to write this new article to have one step by step guide that possibly suits for most SharePoint farms.


What to include in the SQL Maintenance Plan for SharePoint 2013/2016 databases


Following tasks should be included in your SharePoint Database Maintenance Job:

  1. Check Database Integrity Task

  2. Rebuild Index Task

  3. Update Statistics (Fullscan) Task

  4. History Cleanup Task

  5. Maintenance Cleanup Task




Additional Notes:

  • This task sequence was validated by some of my great Microsoft colleagues
    (Thank you Andreas Maiwald, Rainer Asbach and Johann Hackl)

  • Database backup tasks could be added as well in theory. I recommend packaging all backup related tasks within a separate Maintenance Plan, for a more granular scheduling.



How to set up your Maintenance Plan


Use the SQL Management Studio to create your maintenance plan. Don’t use the wizard, the Maintenance Plan Editor gives you more control about your plan:



Manually add (drag & drop) the tasks from the toolbox pane into your plan and double click on each of them, to configure them properly. But prior to designing the tasks of the plan, you should take care about reporting/logging, so you can follow up on any issues or Problems.


Configure Logging and Reporting


SQL Server offers logging/reporting features, that  should be included in a SQL Maintenance Plan.





Make sure to get familiar with this additional reading:
SQL Server Maintenance Plans Reporting and Logging


1. Task: Check Database Integrity


Why do we need this:
The Check Database Integrity Task checks the allocation and structural integrity of a database, by running the DBCC CHECKDB Transact-SQL statement.

How to configure this task (Example):



Make sure to get familiar with this additional reading:
Check Database Integrity Task (Maintenance Plan)


2. Task: Rebuild Index


Why do we need this:
We use the Rebuild Index Task dialog to re-create the indexes on the tables in the database with a new fill factor. The fill factor determines the amount of empty space on each page in the index, to accommodate future expansion. As data is added to the table, the free space fills because the fill factor is not maintained. Reorganizing data and index pages can re-establish the free space.

Important:
The Rebuild Index Task needs urgent attention in terms of scheduling . For best results, the Rebuild Index Task should be executed in offline mode. If the SharePoint environment is used across time zones (and there is no real maintenance slot during the night), the plan must be scheduled to run on the weekend. Consider creating a separate Rebuild Index Maintenance Plan that is scheduled for the Weekend. That way you can run other tasks on a daily (nightly) base. Learn about the difference between offline and online Index Rebuild: Database maintenance for SharePoint 2010 Products, Section: Online vs. offline index rebuilds

How to configure this task (Example):



Make sure to get familiar with this additional reading:
Rebuild Index Task (Maintenance Plan)


3. Task: Update Statistics (Fullscan)


Why do we need this:
Query performance can significantly be improved by updating database statistics using the fullscan option.

There have been multiple Premier customers I support, who suffered dramatical performance issues caused by outdated statistics. This is what we want to avoid by creating a Maintenance Plan Task to update statistics with the Fullscan option. If the statistics of one of your content databases is in such a poor state, the CPU load of your SQL database instance is likely to hit 100%, causing serious problems for the whole farm. This is a known issue at Microsoft support and caused by outdated statistics .

Even though there are Timer Jobs / Health Analyzer Rules that are supposed to take care about just these statistics, there are circumstances where these jobs do not work properly. This is the reason why Microsoft explicitly recommends creating a task to update statistics using the fullscan option.

How to configure this task (Example):



Make sure to get familiar with this additional reading :


4. Task: History Cleanup Task


Why do we need this:
The History Cleanup Task discards old historical information from tables in the msdb database. This task supports deleting backup and restore history, SQL Server Agent Job history, and maintenance plan history.

How to configure this task (Example):



Make sure to get familiar with this additional reading:
History Cleanup Task (Maintenance Plan)


5. Task: Maintenance Cleanup Task


Why do we need this:
Use the Maintenance Cleanup Task to remove old files related to maintenance plans, including text reports (See: Logging and Reporting) created by maintenance plans and database backup files.

How to configure this task (Example):



Make sure to get familiar with this additional reading:
Maintenance Cleanup Task (Maintenance Plan)


Connecting the Tasks of the Plan


Once you added all tasks and configured them individually, you must connect them all together:



Connect them by pointing the green arrow to the next task. Double click the connector arrow and configure the Connection:



After connecting two tasks, the plan indicates the workflow between two tasks:




Scheduling the Maintenance Plan


Customers usually schedule Maintenance Plans for SharePoint databases on a daily/weekly base (depending on the runtime). Plans must be aligned with other maintenance tasks like backup Jobs and are scheduled to run in off peak hours (during the night, at the weekend)

Important:
The Rebuild Index Task needs urgent attention in terms of scheduling . For best results, the Rebuild Index Task should be executed in offline mode. If the SharePoint environment is used across time zones (and there is no real maintenance slot during the night), the plan must be scheduled to run on the weekend. Consider creating a separate Rebuild Index Maintenance Plan that is scheduled for the Weekend. That way you can run other tasks on a daily (nightly) base.
Learn about the difference between offline and online Index Rebuild: Database maintenance for SharePoint 2010 Products, Section: Online vs. offline index rebuilds


Test the Maintenance Plan


Carefully evaluate the Maintenance Plan on your Test Environment for a period of time (2-4 weeks), using complete copies of your production databases. Check the overall runtime and make sure the plan does not collide with other scheduled maintenance. Backup Jobs of transaction logs are not affected.

As soon as you have insight about overall runtime and are familiar with the necessary configuration of the maintenance plan on your Test environment, create the Plan on your productive environment.


Check the results of the Maintenance Plan


Usually you check the results of your database maintenance using following two options:

1. Check Maintenance Job History
Right click the Maintenance Job in SQL Management Studio and choose the View History Option:





2. Check Maintenance Job Log File
In the log file folder (in the root folder of the SQL instance) there is a log file for each Maintenance Job. This can be reviewed and checked.

Further Reading: SQL Server Maintenance Plans Reporting and Logging


SQL Server Jobs vs. Maintenance Plans


I want to explicitly point out, that experienced database admins can of course use SQL Server Jobs instead of creating a SQL Server Maintenance Plan. SQL Server Jobs add further flexibility and are often used in SQL Server Always On scenarios. The steps to include in the job match the steps described above.

Further reading:


What you must not do



  • Shrinking databases on a regular base. Just don't do it. Shrink manually if you really have to, but never include it in a Maintenance Plan. Further Reading: Shrinking data files

  • Run Maintenance Plan during working hours. Don't do it. Performance is likely to be degraded during the single steps of the Maintenance. Review the Scheduling the Maintenance Plan section of this article to learn more.



Conclusion


SQL Database Maintenance is no rocket science. It is easy to set up and creates performance and reliability benefits. Make sure to set up a Maintenance Plan on all of your SharePoint farms.


Final Note


Please share your thoughts & own experiences in the comments. Any feedback or additions for this post is highly welcome.

Thank you for rating this article if you liked it or it was helpful for you.

1 Comment
Occasional Visitor

A good article and nicely written; I am interested as to why you include an update stats task post running an index rebuild? IX rebuilds include an update stats with fullscan, as far as I am aware so this seems to be unnecessary(?).