... examples, you'll need access to any edition of SQLServer
2005 or later (except Compact Edition). A 2008 copy of SQLServer Express Edition,
plus associated tools, can be downloaded for free ... particular revisions of code.
In order to try to persuade you that this is not a good standard to adopt for documenting
SQL Server code, here is a very simple SQLServer function with the barest minimum ... VisualStudio
Intellisense and the object browser, and can be imported into applications such as Sand-
castle to convert them into Help files. Of course, you can transform an XMLDOCS file
into...
...
Brad’s Sure Guideto
SQL Server
Maintenance Plans
By Brad M. McGehee
First published by Simple Talk Publishing 2009
Summary 28
Chapter 2: Before you Create any Maintenance Plans… 29
How to Configure ... Before you Create any Maintenance Plans… 29
How to Configure Database Mail 30
How to Configure a SQLServer Agent Operator 43
Summary 46
Chapter 3: Getting Started with the Maintenance Plan Wizard ... 15
Goals of this Book 16
SQL Server Editions Covered in this Book 16
Chapter 1: Why is Database Maintenance Important? 17
The Scope of Database Maintenance 17
Different Approaches to Database Maintenance...
... Statistics Task 210
Shrink Database Task 211
Execute SQLServer Agent Job Task 211
Database and Backup Component Selection 151
Backup File Storage 155
Verify backup integrity 157
Set backup compression ... 181
Creating the Job Schedule 183
Summary 183
Chapter 16: Introduction to the Maintenance Plan Designer 184
Features Unique to the Maintenance Plan Designer 185
Starting the Maintenance Plan Designer ... 188
Object Explorer 189
Maintenance Task Toolbox 189
Subplans and the Design Surface 190
Designer Menu bar 196
Summary 202
Chapter 17: Configuring Maintenance Tasks Using the Designer 203
A Note of Drag-and-Drop...
... DBAs who:
• are not T -SQL or PowerShell experts, but who are able to get around in SQLServer
Management Studio (SSMS)
• typically have 25 or fewer SQLServer instances to manage
• typically ...
recent books include How to Become an Exceptional DBA (2nd Edition), Brad's Sure Guideto
SQL Server 2008, and Mastering SQLServer Profiler, all of which are available in PDF format
at: :..B
When ... Microsoft SQLServer MVP, and was the founder of
the popular community site SQL- Server- Performance.Com, which he operated from 2000
through 2006, writing over one million words on SQLServer topics.
Brad...
... toSQLServer 2008.
All the screenshots and examples are from SQLServer 2008, which, on occasion, varies from
SQL Server2005. When there are significant differences, I will point them out.
SQL ... the Maintenance Plan
Designer for SQLServer2005 and SQLServer 2008, including both the Standard and
Enterprise editions. If you are running SQLServer 2005, you should be on Service Pack ... one of two tools that SQLServer provides to create
Maintenance Plans.
A note on terminology
SQL Server uses the term "Maintenance Plan" (note the capitalization) to refer to a
database...
... alien to many DBAs. On top of this, the DBA still needs to know T -SQL and
SQL Server internals, as well as SQLServer Management Objects (SMO), and the OS Object
Model (assuming you decide to ... other SQLServer instances, although multi -server Maintenance
Plans can be created.
• Bugs in some earlier versions of the Wizard. If you use SQLServer2005 Service Pack 2
or higher, or SQLServer ... version of
SQL Server is released your scripts may need to be modified (sometimes substantially) to
work with the new version.
Finally, aside from third-party tools, there is no easy way to automate...
... Important?
27
Remove Older Data from msdb
The SQLServer msdb database stores historical data about various activities, such as details
about backups, SQLServer Agent jobs, and Maintenance Plan execution. ... backup files, your SQL Server& apos;s hard drives will quickly fill up,
causing all sorts of problems. It is the job of the DBA to ensure that unneeded backups are
removed from a SQLServer on a regular ... unfortunately,
both can hurt SQL Server& apos;s performance. Wasted space reduces the number of rows that can
be stored in SQL Server& apos;s data cache, which can lead to increased disk I/O. The...
... prompt you to create a Database Mail profile.
A profile is a collection of one or more SMTP accounts that can be used by SQLServerto
send messages. In other words, when SQLServer wants to send ... an SMTP server will accept an e-mail, the sender must log on to the SMTP
server with an authorized e-mail account. This is done to prevent spammers from accessing
the SMTP server and using it. ... you have to tell Database Mail what mail server it should use to deliver e-mail
messages from your Maintenance Plans. If you're unsure, send the screenshot shown in
Figure 2.5 to your organization's...
... access to msdb) to send mail. To keep your setup as simple as possible, make the
Maintenance Plan profile public, by selecting the checkbox under Public then clicking Next
to move on to the ... you want to add some robustness to Database Mail, and help ensure
that the mail is delivered should the SMTP server go down for a short time, you can choose
to increase this value to a higher ... value is 1, which means that there is
only one attempt made to send an e-mail. If the SMTP server should be down when an
e-mail is to be sent, and there are no alternative SMTP accounts available,...
... SSMS, navigate to the SQLServer instance you wish to
configure, open up the SQLServer Agent folder, navigate to the Operators folder,
right-click on it and select New Operator, as shown in ... operator is, we need to learn how to create them, because a
Maintenance Plan cannot be configured to use an operator until the operator has first been
created and configured.
To create a new operator, ... able to enter an
e-mail address directly into the Maintenance Plan. Instead, we configure e-mails to be sent to
an operator.
Chapter 2: Before you Create any Maintenance Plans…
44
An operator...
... Maintenance
Plan from start to finish, using the Wizard. I'll cover preparation, how to start, and how
to navigate through and complete the Wizard, using an example Maintenance Plan that ... or to create or modify them, you
have to be a member of the sysadmin fixed server role.
For now, let's assume that there aren't any existing Maintenance Plans and that you want to
create ... beginning.
To start the Maintenance Plan Wizard, open SSMS and navigate to the Maintenance Plans
folder of the relevant server (as shown in Figure 3.1) and right-click on this folder to reveal...
... While we will discuss
why it is not a good idea to automatically shrink a database in Chapter 6, the point to keep in
mind is that, if you ever need to shrink a database, it should be done manually.
Rebuild ... the potential
problem of overlapping tasks, which could result in your SQLServer slowing down. This
is harder to achieve using the Separate schedules for each task covered next, but it can
certainly ... time.
The first thing we need to do is to give our Maintenance Plan a name. The default name is
"MaintenancePlan" but I strongly advise you to change this to something more descriptive...
... this same task automatically.
Execute SQLServer Agent Job
The Execute SQLServer Agent Job task allows you to select SQLServer Agent jobs
(ones you have previously created), and to execute them ... maintenance using the
Maintenance Plan Wizard.
History Cleanup
The History Cleanup task deletes historical data from the msdb database, including
historical data regarding backup and restore, SQLServer ... This task helps to remove index fragmentation,
but does not update index and column statistics. If you use this option to remove index
fragmentation, then you will also need to run the Update...
... activated to ensure that the plan works
successfully on all online databases.
Ignore databases where the state is not online…
…is only available in SQLServer 2008. If you run a SQLServer2005 Maintenance ... because it is automatically deleted and
recreated every time SQLServer is restarted.
All user databases
Just as a DBA often wants to create a Maintenance Plan that is specific to system databases, ... Maintenance Plan Wizard needs to know which databases you want to
run the task against.
System databases
This option specifies that your task will only run against the SQLServer instance's system...
... Plans that don't seem to be doing
what you expect them to do.
Chapter 2 described how to configure Database Mail so that these Maintenance Plan reports
can be sent to you via e-mail, and it ... all of these options to a dedicated chapter (Chapter 4), where we'll also look at
general considerations when scheduling multiple tasks, so as to avoid overlap and
server resource contention.
For ... Figure 3.11 is devoted to task scheduling, as shown in
Figure 3.13.
Figure 3.13: Scheduling maintenance tasks.
By default, each task is set to Not Scheduled (On Demand). To implement a schedule...