the Maintenance Plan WizardNow that we have all the preliminaries out of the way, we can focus on how to create a Maintenance Plan using the Maintenance Plan Wizard.. This chapter will p
Trang 1Chapter 2: Before you Create any Maintenance Plans…
Figure 2.16: Most of the options on this screen are optional.
Summary
You now have set up Database Mail and at least one operator Now, when you create a Maintenance Plan, you can choose to send e-mails to an operator In the next chapter, I will show you how this is done
Trang 2the Maintenance Plan Wizard
Now that we have all the preliminaries out of the way, we can focus on how to create a Maintenance Plan using the Maintenance Plan Wizard The marketing story behind the Wizard is "answer a few simple questions on some screens, and voilà, you have a working Maintenance Plan." Of course, the reality is not quite that simple
While the Wizard does present various configuration options, it does not explain what they
do, or their pros and cons There is also no way to determine if the options you choose are even applicable to your situation
This chapter will provide a quick overview of the entire process of creating a 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 implements the core database maintenance tasks identified in Chapter 1
I won't be going into a lot of detail this time around Instead, I will save the detail for later chapters, which will show you how to implement each individual task, from database integrity checking to reorganizing indexes and updating statistics, and cover every possible option available As we progress through this and subsequent chapters, I'll try to anticipate and answer your likely questions, and offer lots of advice and best practices on database maintenance
So, while this chapter will get you started, it is just a beginning We still have a lot of hard work ahead before you know everything there is to know about using the Maintenance Plan Wizard
Finally, before we start, I will remind you again here, as I will be reminding you throughout this book: a Maintenance Plan created with the Maintenance Plan Wizard or Maintenance Plan Designer provides only the core components of a SQL Server database maintenance plan As discussed in Chapter 1, there are additional database maintenance tasks, which you must do outside of a Maintenance Plan created using the Wizard
Trang 3Chapter 3: Getting Started with the Maintenance Plan Wizard
Exploiting the Full Potential of the
Wizard
If you decide to use the Maintenance Plan Wizard to create Maintenance Plans for a given server or set of servers, my advice would be to take advantage of as many of its features as you can The Wizard allows you to perform the core database maintenance tasks using one tool, and you might as well get all of the benefits the tools provides, such as the ease of setup
I suggest that you avoid thinking that you'll use some of the features available in the Wizard, but perform other tasks using T-SQL or PowerShell scripts Instead, pick one or the other, for a given server, or set of servers, and stick with it For all the examples in this chapter and this book, I am going to assume that you will be taking maximum advantage of the features available to you from the Maintenance Plan Wizard
Investigating Existing Maintenance Plans
Before you create a new Maintenance Plan, it is a good idea to first check to see if there are any existing Maintenance Plans, and find out what they do This way, you can avoid inadvertently creating a new Maintenance Plan that includes tasks that overlap with an existing plan
To find out if there are any existing Maintenance Plans, open SSMS, select the relevant SQL Server instance, and then click on the Management folder The contents of the Management folder vary between SQL Server 2005 and SQL Server 2008 However, in either version, any current plans will be stored in the Maintenance Plans subfolder If it's empty, it means there aren't any Otherwise, you will see a list of one or more Maintenance Plans, as shown in Figure 3.1
If there are any Maintenance Plans, you will want to check them out to see if they are
Trang 4Figure 3.1: This example shows two existing Maintenance Plans.
Chapter 19 demonstrates how to view and modify the contents of an existing Maintenance Plan, using the Maintenance Plan Designer
Privileges required for managing Maintenance Plans
In order to view Maintenance Plans from within SSMS, 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 a new one
Trang 5Chapter 3: Getting Started with the Maintenance Plan Wizard
Creating a Maintenance Plan
In this section, I'll walk through all the Wizard steps required to create a Maintenance Plan that will perform all of the "core" database maintenance tasks identified in Chapter 1
Starting the Maintenance Plan Wizard
When I use the Maintenance Plan Wizard to create a new Maintenance Plan, I often goof up and choose the wrong option Hopefully, I can help you avoid this bad habit by teaching you how to do things correctly from the 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 the pop-up menu shown in Figure 3.2
Figure 3.2: Choose Maintenance Plan Wizard from the menu.
The mistake I almost always make is to select the New Maintenance Plan… option I think
I do this because I instinctively know that my goal is to create a new Maintenance Plan, and the first option looks like it will work Actually, it will work, but not as expected The New