Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Ultimate Maintenance Plan By Ed Roepe Perimeter DBA, LLC

Similar presentations


Presentation on theme: "The Ultimate Maintenance Plan By Ed Roepe Perimeter DBA, LLC"— Presentation transcript:

1 The Ultimate Maintenance Plan By Ed Roepe Perimeter DBA, LLC

2 About Me Over 25 years experience in databases
I have been working with SQL Server since version 4.21 Worked as FTE and consultant on some of the largest SQL database installations in US Experience in many different industries Experience in very large databases, high transaction systems, and high availability Microsoft Certified Started consulting firm in 2014 in the Atlanta area

3 Agenda Discuss the Microsoft Built-in Maintenance Plans
Discuss the Ola Hallengren Maintenance Solution Discuss other items that should be part of a maintenance plan Discuss some typical maintenance plans

4 Goals of a maintenance solution
Lights out Reliable Flexible Proactive alerting Robust

5 Microsoft Maintenance Solution
Integrity Check Index Maintenance Update Statistics Database Backups

6 Starting the Microsoft Maintenance Plan

7 Microsoft Solution – Pros & Cons
Simple to setup. Just run the wizard Designed for basic servers Provided by Microsoft Cons Sometimes with older versions you have to have the same version of SSMS as SQL to create/modify Index maintenance does all indexes Statistics maintenance does all statistics

8 Ola Hallengren Maintenance Solution
Written by Ola Hallengren DBA in Saxo Bank, a Danish investment bank Microsoft MVP – SQL Server Consists of SQL Server Backups SQL Server Integrity Check SQL Server Index and Statistics Maintenance Log of each step of maintenance

9 Installing the solution
Download the scripts Create database to contain stored procedures and log table (suggest DBAUtility) Install the stored procedures Create the scheduled jobs Modify the scheduled jobs as needed Add additional maintenance functions

10 How it works Stored Procedure is called for each function (index, backup, stats, etc.) Start of each function/step is logged into table End of each function/step is logged into table Return code and any errors are returned to calling program

11 Backups – Common Options
Specify databases to include or include Full Backup Differential Backup Log Backup Verify backup Number of hours to cleanup old backups

12 Backups – Advanced Options
Compression Call to 3rd party backup programs (Quest Litespeed, Idera SQL Safe, etc.) Perform a full backup if log is taken and no full backup exists Copy Only – For snapshots. Take backup without disrupting last full backup Backup to multiple files at the same time Perform Verify and Checksum Specify cleanup BEFORE or AFTER backup

13 Full Backups - Example EXEC = = = = = = = = = = = 'Y'

14 Log Backups - Example EXEC = = = = = = = = = = = 'Y'

15 Index & Statistics – Basic Options
Databases to include or exclude Tables to include or exclude Define three fragmentation groups (2 thresholds) Low = Zero to first threshold Medium = First threshold to second threshold High = Second threshold to infinity Define actions for each group (example) Low = No action Medium = Index reorganize High = Index Rebuild:

16 Index & Statistics – Advanced Options
Specify the order for performing indexing (Online, reorganize, rebuild, etc.) Program will automatically select available options based on version and edition Specify MAXDOP or SORT_IN_TEMPDB Specify FILLFACTOR and PADINDEX Specify UpdateStatistics or OnlyModifiedStatistics Specify the time limit (to prevent running into production)

17 Index & Statistics - Example
EXEC = = = = = = = = = = = = 'Y'

18 Integrity Check – Basic Options
Specify database to include or exclude Specify PHYSICAL_ONLY or NOINDEX

19 Integrity Check - Example
EXEC = = 'Y'

20 Ola Hallengren – Pros & Cons
Pros powerful. A simple command can do 1000s of ps Very powerful. A simple command can do 1000s of steps Program automatically deals with version and edition so you can roll out the same plan to multiple different servers The index & statistics program is very sophisticated and will only do what is needed Cons Some learning curve on learning the commands and syntax The supplied maintenance jobs use CMD mode. Using the T-SQL mode is much simpler

21 Tricks to Rolling out maintenance jobs
Use CMS or Registered servers to deploy to multiple servers Create first set of jobs, script the jobs, and then deploy to other servers. Will need to remove the ID of the schedule Write script to dynamically calculate the location of the SQL log subdirectory Prefix all maintenance jobs with a unique identifier. I use “DBA –” Setup Database Mail, operator and alerts on all jobs

22 Other Maintenance Items
Recycle the SQL Log daily (retention 15 to 30 days) Cleanup the job history table in MSDB (retention 30 days) Cleanup the backup history table in MSDB (retention 30 days) Cleanup to history table in MSDB (retention 30 days) Cleanup the TXT files in the SQL Log directory (retention 30 days) Cleanup the Ola log table (retention 7 to 30 days) Cleanup the Syspolicy table Setup alerts

23 Alerts – Part 1 Error Hardware or System Problems Error Logical Page Consistency I/O Error Error Read Operation I/O Error Error Page Corruption In Memory Error Filegroup Full Error Deadlock Detected Error Database Log Not Available Error Transaction Log Full Error Invalid LSN in Transaction Log Error Error With Transaction Log Error Index Corruption

24 Alerts – Part 2 Severity 16 - Miscellaneous User Error Severity 17 - Insufficient Resources Severity 18 - Nonfatal Internal Error Severity 19 - Fatal Error in Resource Severity 20 - Fatal Error in Current Process Severity 21 - Fatal Error in Database Processes Severity 22 - Table Integrity Suspect Severity 23 - Database Integrity Suspect Severity 24 - Hardware Error Severity 25 - Unexpected Fatal Error

25 Suggested Maintenance Plans
Task Small Medium Large Integrity Check Daily Daily or Weekly Weekly Update indexes Update statistics Daily or Hourly Full Backups Differential Backups None Log Backups Hour 15 min or hour 15 min or less Cleanup tasks

26 Summary Tour of Microsoft maintenance solution
Tour of Ola Hallengren maintenance solution Tour of other maintenance items Tour of alerts Suggested maintenance plans

27 My Information Ed Roepe President /Owner Perimeter DBA,LLC Cell: (678)


Download ppt "The Ultimate Maintenance Plan By Ed Roepe Perimeter DBA, LLC"

Similar presentations


Ads by Google