P. 1
SQL Server Maintenance Plans Brad eBook Jan13

SQL Server Maintenance Plans Brad eBook Jan13

|Views: 1,562|Likes:
Published by Sanjay Sharma

More info:

Published by: Sanjay Sharma on Jul 23, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less






  • Introduction
  • Who Should Read this Book
  • Goals of this Book
  • SQL Server Editions Covered in this Book
  • Chapter 1: Why is Database Maintenance Important?
  • The Scope of Database Maintenance
  • Diferent Approaches to Database Maintenance
  • Maintenance Plan Wizard
  • Maintenance Plan Designer
  • T-SQL Scripts
  • PowerShell Scripts
  • Core Maintenance Plan Tasks
  • Backup Databases
  • Verify the Integrity of a Database
  • Maintain a Database's Indexes
  • Maintain Index and Column Statistics
  • Remove Older Data from msdb
  • Remove Old Backups
  • What's Outside the Scope of the Maintenance Plan Wizard and Designer?
  • Summary
  • Chapter 2: Before you Create any Maintenance Plans…
  • How to Confgure Database Mail
  • How to Confgure a SQL Server Agent Operator
  • Chapter 3: Getting Started with the Maintenance Plan Wizard
  • Exploiting the Full Potential of the Wizard
  • Investigating Existing Maintenance Plans
  • Creating a Maintenance Plan
  • Starting the Maintenance Plan Wizard
  • Scheduling Maintenance Tasks
  • Overview of Maintenance Tasks
  • Selecting Core Maintenance Tasks
  • Maintenance Task Order
  • Confguring Individual Tasks
  • Report Options
  • Completing the Wizard
  • A Closer Look at Maintenance Plan Implementation
  • Testing Your Maintenance Plan
  • Chapter 4: Task Scheduling
  • Scheduling: General Considerations
  • Avoid Scheduling Tasks During Busy Periods
  • Avoid Overlapping Tasks
  • Task Frequency
  • Task Scheduling in the Wizard
  • Job Schedule Properties
  • Scheduling Individual Maintenance Tasks
  • Chapter 5: Check Database Integrity Task
  • An Overview of the Check Database Integrity Task
  • When and How Often to Run Integrity Checks
  • Confguring the Task
  • The "Include indexes" Option
  • Creating the Job Schedule
  • Chapter 6: Shrink Database Task
  • Sizing Your Database Files
  • Problems with the Shrink Database Task
  • The Right Way to Shrink a Database
  • Chapter 7: Rebuild Index Task
  • An Overview of the Rebuild Index Task
  • When and How Often to Rebuild Indexes
  • Tracking Index Fragmentation
  • Ofine Index Maintenance
  • Online Index Maintenance
  • Scripting Index Rebuilds
  • Confguring the Rebuild Index Task
  • Database Selection
  • Free space options
  • Advanced options
  • Chapter 8: Reorganize Index Task
  • An Overview of the Reorganize Index Task
  • Reorganize Versus Rebuild
  • When and How Often to Reorganize Indexes
  • Confguring the Reorganize Index Task
  • Compact large objects
  • Chapter 9: Update Statistics Task
  • Overview of the Update Statistics Task
  • When and How Often to Update Statistics
  • Confguring the Update Statistics Task
  • The Update Option
  • The Scan type Option
  • Chapter 10: Execute SQL Server Agent Job Task
  • An Overview of the Execute SQL Server Agent Job Task
  • When and How Often to Run the Custom Job
  • Creating SQL Server Agent Jobs
  • Confguring the Execute SQL Server Agent Job Task
  • Selecting the Job
  • Chapter 11: History Cleanup Task
  • An Overview of the History Cleanup Task
  • When and How Often to Clean Up MSDB
  • Confguring the History Cleanup Task
  • Selecting the Historical Data to Delete
  • Chapter 12: Back Up Database (Full) Task
  • Backup Strategy – a Brief Primer
  • An Overview of the Backup Database (Full) task
  • When and How Often to Perform Full Backups
  • Confguring the Back Up Database (Full) Task
  • Database and Backup Component Selection
  • Backup File Storage
  • Verify backup integrity
  • Set backup compression
  • Chapter 13: Back Up Database (Diferential) Task
  • An Overview of the Back Up Database (Diferential) Task
  • When and How Often to Perform Diferential Backups
  • Confguring the Back Up Database (Diferential) Task
  • Database Selection and Backup Component
  • Chapter 14: Back Up Database (Transaction Log) Task
  • An Overview of the Backup Database (Transaction Log) Task
  • When and How Often to Back Up Transaction Logs
  • Confguring the Backup Database (Transaction Log) Task
  • Backing Up the Tail of the Log
  • Chapter 15: Maintenance Cleanup Task
  • An Overview of the Maintenance Cleanup Task
  • When and How Often to Clean Up Your Backup and Report Files
  • Confguring the Maintenance Cleanup Task
  • Specifying the type of fle to delete
  • Specifying File Location
  • Delete fles older than…
  • Chapter 16: Introduction to the Maintenance Plan Designer
  • Features Unique to the Maintenance Plan Designer
  • Starting the Maintenance Plan Designer
  • Exploring the Maintenance Plan Designer
  • Object Explorer
  • Maintenance Task Toolbox
  • Subplans and the Design Surface
  • Designer Menu bar
  • Chapter 17: Confguring Maintenance Tasks Using the Designer
  • A Note of Drag-and-Drop Caution
  • Check Database Integrity Task
  • Rebuild Index Task
  • Reorganize Index Task
  • Update Statistics Task
  • Shrink Database Task
  • Execute SQL Server Agent Job Task
  • History Cleanup Task
  • Maintenance Cleanup Task
  • Back Up Database Task
  • Execute T-SQL Statement Task
  • Notify Operator Task
  • Chapter 18: Subplans and Precedence
  • Subplans
  • Using a Single Subplan: Pros and Cons
  • Using Multiple Subplans: Pros and Cons
  • Using Subplans
  • How to Use Precedence
  • Chapter 19: Create and Modify Maintenance Plans Using the Designer
  • Establishing Your Maintenance Goals
  • Creating Maintenance Plans: the Big Picture
  • 1. Create the new Maintenance Plan
  • Create the New Maintenance Plan
  • Create the Subplans
  • Add the Maintenance Plan Tasks
  • Confgure the Maintenance Plan Tasks
  • Set Precedence
  • Defne Reporting and Logging
  • Save the Maintenance Plan
  • Test the Maintenance Plan
  • Set the Schedules
  • Run in Production and Follow Up
  • Modifying an Existing Maintenance Plan

In some ways, the next section of the screen, shown in Figure 12.7, forms the heart of the
backup task, since it allows us to defne how and where the backup fles are stored.

Let's look at each option in turn.

Backup databases across one or more fles

If you choose this option, you can either back up to a backup device, which is a pre-created
fle that can hold one or more backups, or create striped backups, which allow you to
perform a backup of a database on two or more physical fles at the same time.

Backup devices are a holdover from previous versions of SQL Server and are no longer used
much by DBAs. They are hard to work with and don't ofer many advantages over standard
backup fles, which we will discuss in the next section.

Chapter 12: Back Up Database (Full) Task


Figure 12.7: Generally, the second option, selected by default, is the choice to make.

A striped backup can, under certain conditions, speed up the backup process. However, like
backup devices, this option is not used very often, because there are many better ways to
boost backup performance that are faster, save disk space, and are easier to administer. This
better way, backup compression, we will discuss a little more in the pages ahead.

As you have probably already guessed, I recommend that you don't use this option in your
Maintenance Plan. If, for some reason, you do need it, you may be better of using T-SQL or
PowerShell scripts instead, as trying to use this option via the Maintenance Plan Wizard is
tedious and not very fexible.

Create a backup fle for every database

This is the default option, and the one you should select. It will automatically create a new
backup fle on disk for each database you selected in the Database(s) section of the screen.
Backup fles will automatically be assigned the name of the database, along with the word
backup: and the date of the backup. This means that you can easily identify which backup fle
is which, and when it was taken. This option has three of its own sub-options. Let's look at
them one at a time.

Create a sub-directory for each database

If you select this option, a sub-directory will be created for each database you back up, and
the associated backups will be stored there. So, if you back up two databases, one called
Sales and one called Marketing, then backups for the Sales database will be stored in a sub-
directory called Sales and those for Marketing database in a sub-directory called Marketing.

Chapter 12: Back Up Database (Full) Task


If you don't choose this option, then all the backups will be stored in the same folder
(which you specify with the next option). Either option works fne. Personally, I don't use
sub-directories because I don't like to go through multiple levels of folders to view my
backup fles. However, other DBAs like the organization provided by using this option. The
choice is yours.


This defnes the parent folder that will used to store all database backup fles arising from
execution of this task. The choice of folder is a very important decision, and you should not
automatically select the default folder to store your backups.

Ideally, you will have a destination designated specifcally for storing backups, on a locally
attached drive, SAN, or NAS device. Your backups should not be stored on the same drive
locations as your "live" MDF and LDF fles, otherwise you might experience I/O contention,
when backups are made, that could afect the performance of your servers. Use the browse
button to select the backup location.

Backing up over a network

You can also perform backups over the network using this option. This is not my personal
preference because, if you have a network problem while the backup is being made, the
backup will fail, and the Maintenance Wizard doesn't provide a way to recover. If you
have to back up over the network, then you need to consider a third-party backup tool
that is designed for network resilience; or to create your own T-SQL or PowerShell
script that can detect a failed backup and then restart it once the network is back up
and running.

Backup fle extension

The default backup fle extension is BAK and it should not be changed. If you change it, you
risk confusing yourself, and others, about which fles are backups and which are not.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->