The Ultimate Maintenance Plan By Edward Roepe Perimeter DBA, LLC

Slides:



Advertisements
Similar presentations
Burt King We will cover: Essentials --No command line needed here (mott) What is SQL Server How does it come to life What are the.
Advertisements

DataBase Administration Scheduling jobs Backing up and restoring Performing basic defragmentation and index rebuilding Using alerts Archiving.
SQL Server Best Practices Keep Your Database In Top Performance Shape and Maintain Effective Backups September, 2007 Richard Kokoski.
SQL Server 2005 Implementation and Maintenance Chapter 10: Maintaining and Automating SQL Server.
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 1 IT390 Business Database Administration Unit 5 :
Backup, Integrity Check and Index and Statistics Maintenance
Database Optimization & Maintenance Tim Richard ECM Training Conference#dbwestECM Agenda SQL Configuration OnBase DB Planning Backups Integrity.
Backup, Integrity Check and Index and Statistics Maintenance
Utility Database Chris
Module 7: Restoring Databases. Overview SQL Server Recovery Process Preparing to Restore a Database Restoring Backups Restoring Databases from Different.
CS27510 Commercial Database Applications. Maintenance Maintenance Disaster Recovery Disaster Recovery.
Designing Custom Maintenance Plans with TSQL By John Miner.
Today’s Agenda Chapter 12 Admin Tasks Chapter 13 Automating Admin Tasks.
Sofia, Bulgaria | 9-10 October SQL Server 2005 High Availability for developers Vladimir Tchalkov Crossroad Ltd. Vladimir Tchalkov Crossroad Ltd.
Maintaining a Mirrored Database Tips and Tricks by Paul G. Hiles.
Learningcomputer.com SQL Server 2008 – Administration, Maintenance and Job Automation.
IT 456 Seminar 5 Dr Jeffrey A Robinson. Overview of Course Week 1 – Introduction Week 2 – Installation of SQL and management Tools Week 3 - Creating and.
Module 16: Performing Ongoing Database Maintenance
1 Chapter Overview Performing Configuration Tasks Setting Up Additional Features Performing Maintenance Tasks.
Week 7 : Chapter 7 Agenda SQL 710 Maintenance Plan:
1 Chapter Overview Defining Operators Creating Jobs Configuring Alerts Creating a Database Maintenance Plan Creating Multiserver Jobs.
SQL School is strongly committed to provide COMPLETE PRACTICAL REALTIME Trainings on SQL Server Technologies – Dev, SQL DBA, MSBI (SSIS, SSAS, SSRS) and.
Maintenance Practices. Goal  Automate the necessary DBA chores to put organizations on the path of having healthier, consistent and more trustworthy.
Praveen Srivatsa Director| AstrhaSoft Consulting blogs.asthrasoft.com/praveens |
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
SQL SERVER MAINTENANCE PLANS Kat
Linkedin: dennisegraham Dennis E Graham Reporting For SQL Health.
You Inherited a Database Now What? What you should immediately check and start monitoring for. Tim Radney, Senior DBA for a top 40 US Bank President of.
New Instance… Now What? Presented by: James Donahoe Senior Solutions Engineer – TeleTracking Technologies MCSA: SQL Server 2012.
Database Administration for the Non-DBA Denny Cherry twitter.com/mrdenny.
SQL Server Agent All the Knobs You Need to Know Taiob M Ali.
SQL Server DBA Online TrainingSQL Server DBA Online Training.
ProgressBook Suite Maintenance
SQL Server Management Strategies
Calgary Oracle User Group
SQL Database Management
Backups for Azure SQL Databases and SQL Server instances running on Azure Virtual Machines Session on backup to Azure feature (manual and managed) in SQL.
Smarter Technology for Better Business
SQL Server Agent All the Knobs You Need to Know
You Inherited a Database Now What?
Automated Restore Script Output for Ola Hallengren’s Maintenance Solution 1) Start SQL Services on Local 2) Connect to Azure AlwaysOn 3) Delete all maintenance.
Visual Studio Database Tools (aka SQL Server Data Tools)
Tips for SQL Server Performance and Resiliency
SQL Replication for RCSQL 4.5
A big party is being held to honor relational database systems and their impact on modern society. Outside the venue, the host awaits the guests. The.
About PASS The PASS community encompasses everyone who uses the Microsoft SQL Server or Business Intelligence Platforms. This includes database administrators,
Database Corruption Advanced Recovery Techniques|
Example of a page header
A Technical Overview of Microsoft® SQL Server™ 2005 High Availability Beta 2 Matthew Stephen IT Pro Evangelist (SQL Server)
Designing Database Solutions for SQL Server
Summit Nashville /14/2018 9:26 PM
Introduction to SQL Server Management for the Non-DBA
Database Administration for the Non-DBA
Tips for SQL Server Performance and Resiliency
Tips for SQL Server Performance and Resiliency
Tuning Your Maintenance Plans
The Ultimate Maintenance Plan By Ed Roepe Perimeter DBA, LLC
Re-Indexing - The quest of ultimate automation
Backup and Restore your SQL Server Database
Visual Studio Database Tools (aka SQL Server Data Tools)
How to Perform A Health Check By Edward Roepe Perimeter DBA, LLC
AlwaysOn Availability Groups
You Inherited a Database Now What?
Chapter 11 Managing Databases with SQL Server 2000
Building a Performance Monitoring System using XEvents and DMVs
Make Your Maintenance Plans…
Sql Saturday Philadelphia
Ch 10. Maintaining and Automating SQL Server
The DBA Quit and now you’re it:
Presentation transcript:

The Ultimate Maintenance Plan By Edward Roepe Perimeter DBA, LLC

About Me Over 25 years experience in databases I have been working with SQL Server since version 4.21 Worked as employee 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

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 Discuss alerts Demo

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

Microsoft Maintenance Solution Integrity Check Index Maintenance Update Statistics Database Backups

Starting the Microsoft Maintenance Plan

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

Ola Hallengren Maintenance Solution Written by Ola Hallengren DBA in Saxo Bank, a Danish investment bank Microsoft MVP – SQL Server https://ola.hallengren.com/ Consists of SQL Server Backups SQL Server Integrity Check SQL Server Index and Statistics Maintenance Log of each step into table

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

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

Backups – Common Options Backup location Databases to include or exclude Full Backup Differential Backup Log Backup Verify backup Number of hours to cleanup old backups

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

Full Backups - Example EXEC [DBAUtility].[dbo].[DatabaseBackup] @Databases = 'ALL_DATABASES', @Directory = 'E:\SQLServerBackups', @BackupType = 'FULL', @Verify = 'N', @CleanupTime = '192', @CleanupMode = 'AFTER_BACKUP', @Compress = 'Y', @CopyOnly = 'N', @ChangeBackupType = 'N', @CheckSum = 'N', @LogToTable = 'Y'

Log Backups - Example EXEC [DBAUtility].[dbo].[DatabaseBackup] @Databases = 'ALL_DATABASES', @Directory = 'E:\SQLServerBackups', @BackupType = 'LOG', @Verify = 'N', @CleanupTime = 192, @CleanupMode = 'AFTER_BACKUP', @Compress = 'Y', @CopyOnly = 'N', @ChangeBackupType = 'Y', @CheckSum = 'N', @LogToTable = 'Y'

Index & Statistics – Basic Options Databases to include or exclude Tables to include or exclude Define three fragmentation groups 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:

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)

Index & Statistics - Example EXEC [DBAUtility].[dbo].[IndexOptimize] @Databases = 'All_DATABASES’, @FragmentationLow = NULL, @FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE’, @FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE’, @FragmentationLevel1 = 5, @FragmentationLevel2 = 30, @MaxDOP = 1, @SortInTempdb = 'Y’, @LOBCompaction = 'N’, @UpdateStatistics = 'ALL’, @OnlyModifiedStatistics = 'Y’, @LogToTable = 'Y'

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

Integrity Check - Example EXEC [DBAUtility].[dbo].[DatabaseIntegrityCheck] @Databases = 'ALL_DATABASES', @LogToTable = 'Y'

Ola Hallengren – Pros & Cons 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

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

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 email 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

Alerts – Script 3011 - Part 1 Error 0823 - Hardware or System Problems Error 0824 - Logical Page Consistency I/O Error Error 0825 - Read Operation I/O Error Error 0832 - Page Corruption In Memory Error 1105 - Filegroup Full Error 1205 - Deadlock Detected Error 9001 - Database Log Not Available Error 9002 - Transaction Log Full Error 9003 - Invalid LSN in Transaction Log Error 9004 - Error With Transaction Log Error 9100 - Index Corruption

Alerts – Script 3011 - 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

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

Demo of OLA install How to download software https://ola.hallengren.com/ How to install stored procedures and jobs Change the default database Create jobs option Backup directory option No schedule on jobs

Demo of “DBA” Jobs How to install stored procedures (Script 3023) How to install scheduled jobs (Script 3022) Show Daily DB Maintenance Show Daily Full Backups Show Daily Log Backups Show Daily Syspolicy Purge Show Daily System Cleanup Show Alerts

Summary Tour of Microsoft maintenance solution Tour of Ola Hallengren maintenance solution Other maintenance items Setup alerts Suggested maintenance plans Demo of Ola install Demo of DBA jobs install

Q&A Contact Information Edward Roepe Perimeter DBA, LLC 4780 Ashford Dunwoody Road, Suite 337 Dunwoody GA 30338 (678) 575-6146 Edward@PerimeterDBA.com www.PerimeterDBA.com Our Services Health Checks Security Checks Performance Tuning High Availability Disaster Recovery Managed Services Business Intelligence Development Services