1. Trang chủ
  2. » Công Nghệ Thông Tin

Brad’s Sure Guide to SQL Server Maintenance Plans- P46 ppt

5 112 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 572,06 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Using these links we can dictate "what happens next" in a given subplan, based on the outcome of what is called "task branching." Tasks on separate subplans execute independently of one

Trang 1

In the previous chapters, I have often referred to subplans and precedence, without giving

much more than a cursory explanation of them In this chapter, we will take an in-depth look

at each of these important features of the Maintenance Plan Designer

As noted previously, a single Maintenance Plan can be made up one or more subplans Each

subplan is made up of one or more maintenance tasks, and each subplan can be assigned its own schedule on which to run

Precedence links can be used within a single subplan to control how the tasks within that

subplan execute Using these links we can dictate "what happens next" in a given subplan, based on the outcome of what is called "task branching."

Tasks on separate subplans execute independently of one another In other words, you cannot modify the action of tasks in one subplan based on the outcome of tasks executed in another subplan

As you devise your Maintenance Plans, you'll probably end up using both features; creating new subplans to accommodate tasks with conflicting schedule requirements, and using precedence links within a given subplan to exert control on the overall behavior of the Maintenance Plan This chapter will show you how to use both techniques

While it depends on the overall goal of your Maintenance Plans, I generally recommend using

as few subplans as you can, restricting their use to those tasks that really do need to run at different times Instead of relying on multiple subplans for your Maintenance Plans, I want to suggest that you focus your efforts instead on the power of precedence to control how your Maintenance Plans execute

Subplans

When you create a Maintenance Plan using the Maintenance Plan Designer, you can either lump all the Maintenance Plan tasks into a single subplan that runs according to a single, specific, schedule, or you can spread your Maintenance Plan tasks over one or more subplans, each with its own schedule Let's look at the pros and cons of each option

Trang 2

Using a Single Subplan: Pros and Cons

Using a single subplan keeps your Maintenance Plan simple and straightforward Every task is

on a single design surface, and easy to see

If cleverly designed, you can use precedence (more on this topic coming up very soon) to determine if and when a particular task executes, and how it affects the execution of another task For example, you could have a subplan that contains a Check Database Integrity task,

a Back Up Database task and a Notify Operator task You can set up precedence rules that dictate that, if the integrity check succeeds, then the backup task should be run immediately, but if the integrity check fails, an e-mail notification should, instead, be sent to the operator, letting him know that the Check Database Integrity task has failed

Some Maintenance Plan tasks fit together nicely on the same subplan and on the same schedule For example, every task that is performed only once a week, during a scheduled maintenance window, is likely to be on the same subplan

Other tasks have incompatible schedule requirements and so are better placed on multiple subplans, which run on different schedules For example, a task that performs full backups once a day can't be included on the same subplan as a task that performs transaction log backups once an hour

Using Multiple Subplans: Pros and Cons

Multiple subplans allow you to design a Maintenance Plan with multiple schedules so that specific tasks can execute independently, on a schedule of your choice In fact, the need

to include multiple schedules within a single Maintenance Plan is the only real reason to use multiple subplans If particular tasks have very different schedule requirements, then you simply place them in different subplans with an appropriate schedule in each case For example, if you had certain tasks that needed to be run hourly, others daily, others weekly, and others monthly, then you'd probably need four separate subplans

If you design your Maintenance Plans cleverly, using multiple subplans, you may be able to keep the number of Maintenance Plans you need to create for a single server to as few as one

On the downside, if you use multiple subplans, you can only see one design surface at

a time from within the Maintenance Plan Designer If each design surface has one or more Maintenance Plan tasks, you can't view them as a whole This makes it somewhat more difficult to get a big picture of what the overall plan is doing, and to troubleshoot potential problems

Trang 3

Precedence only works for tasks within a single subplan; it cannot cross subplans This means that you can't make the action of a task in one subplan dependent on the behavior of a task in

a separate subplan

In almost all cases, my advice is as follows:

• tasks that are not schedule-dependent, but are precedence-dependent, should be on the same subplan

• tasks that are schedule-dependent, and not precedence-dependent, should be on separate subplans, each with their own schedule

Using Subplans

In order to demonstrate how to use subplans, and to set their schedules, let's look at a simple example Let's assume that we want to create a Maintenance Plan that does a full backup once a day and a transaction log backup once an hour, and that we want to put each in its own subplan

Let's start the Maintenance Plan Designer afresh so that we have only the default subplan and

no tasks currently added to its design surface, as shown in Figure 18.1

Trang 4

The first step is to add the Back Up Database task to the default subplan, and then configure

it to perform full backups on the required databases In this case, we'll perform a full backup

on the AdventureWorks database Once the task has been dragged and dropped onto the design surface of Subplan_1, and configured, it will look as shown in Figure 18.2.

Figure 18.2: The Backup Database Task has been added to Subplan_1, and configured.

The next step is to create the schedule for this subplan by clicking on the calendar icon for

Subplan_1 The Job Schedule Properties screen appears, as shown in Figure 18.3.

Trang 5

Figure 18.3: This is the Job Schedule Properties screen we have seen many times before

In Figure 18.3, I have scheduled Subplan_1, containing the full backup task, to occur once a

day at 1 a.m Once the schedule has been set, click OK to continue, and you will be returned

to the Designer, where you will see that the schedule has now been set for Subplan_1, as

shown in Figure 18.4

Ngày đăng: 04/07/2014, 23:20