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

Brad’s Sure Guide to SQL Server Maintenance Plans- P39 docx

5 198 0

Đ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 530,63 KB

Nội dung

Chapter 16: Introduction to the Maintenance Plan Designer 191 Figure 16.5: The right-hand side of the screen is dominated by the design surface (highlighted in red) where you visually create Maintenance Plans using the Maintenance Plan Designer. Starting at the top of Figure 16.5, we see the Designer menu bar (covered later), and then a name textbox that is automatically filled in with the name you gave to the plan. Below that is a textbox where you can, optionally, enter a description of the plan, which I recommend you do. Below that is a grid describing the various subplans that comprise your Maintenance Plan. We'll take we brief look at this now, but will discuss subplans in a lot more detail in Chapter 18. Chapter 16: Introduction to the Maintenance Plan Designer 192 Subplans The grid just above the design surface lists the subplans that comprise your Maintenance Plan, and allows you to set a schedule for each of them, as shown in Figure 16.6. This is different from how scheduling was done using the Database Maintenance Wizard. In the Wizard, each task had its own schedule. Using the Designer, scheduling is done by the subplan, and a subplan can contain one or more tasks. Figure 16.6: Subplans are created and managed here. Each subplan represents a collection of maintenance tasks that run on the same time schedule. We will cover the topic of subplans in much more detail in Chapter 18 but, for the time being, you just need to know that a single Maintenance Plan can be made up of several subplans. Each subplan is made up of one or more maintenance tasks, and each subplan can be assigned its own time schedule. In other words, you can schedule the set of tasks defined by one subplan to run on a different schedule from the set of tasks in another subplan. Subplans and SQL Server Agent Jobs Behind the scenes, when you create a Maintenance Plan, a SQL Server Agent job is created for each subplan. As such, each subplan runs independently of other subplans within a given Maintenance Plan Certain tasks fit naturally onto the same subplan, whereas other tasks gravitate towards separate plans, as they tend to run on very different schedules. For example, the Reorganize Index and Update Statistics tasks would likely belong to the same subplan, occurring one after the other, whereas the task to perform daily full database backups would be on a separate subplan from the task to perform hourly transaction log backups. When you first create a Maintenance Plan using the Maintenance Plan Designer, a default subplan, named Subplan_1 is created, which is not scheduled. In order to schedule a subplan, simply click on the Subplan Schedule button on the right-hand side of the grid, to bring up the Job Schedule Properties screen. To the right of the Subplan Schedule button is the Remove Schedule icon (more on both these options a little later, when we discuss the Designer Menu bar, where they are also available). Chapter 16: Introduction to the Maintenance Plan Designer 193 If you were to create a new subplan by clicking on the Add Subplan icon on the top menu, then a second subplan, Subplan_2, would be displayed, as shown in Figure 16.7. Figure 16.7: Each subplan is displayed in this window. Each of these two subplans can have Maintenance Plan tasks associated with them (I'll show you how to do this next) along with their respective schedules. You can have as many subplans as you need, but I recommend that you keep them to a minimum, otherwise scheduling can get very confusing. The Design Surface The bottom section of the right-hand side of the screen is taken up by the design surface, which you can see, surrounded by a red border, in Figure 16.5. It is onto this surface that you can drag and drop tasks, in order to construct your plans. There is a separate design surface associated with each subplan. In other words, for every subplan you create, there will be a related design surface where you can assign Maintenance Plan tasks. Dragging and Dropping Tasks In order to demonstrate this, let's drag some tasks onto each of the Design surfaces for our two subplans. For the sake of demonstration, we'll add the Check Database Integrity task to Subplan_1 and to Subplan_2 we'll add the Reorganize Index task. Click on the first subplan to highlight it. This activates the Design surface for that subplan. Drag the Check Database Integrity task from the toolbox and drop it on the design surface. The resulting screen should look as shown in Figure 16.8. Chapter 16: Introduction to the Maintenance Plan Designer 194 Figure 16.8: Subplan_1 has the Check Database Integrity task associated with its design surface. Notice that Subplan_1 is highlighted and the design surface below it includes the Check Database Integrity task. If we were to schedule this subplan, then the Check Database Integrity task would run on this schedule. Next, repeat the process for the second subplan and the Reorganize Index task, as shown in Figure 16.9. Figure 16.9: Subplan_2 has the Reorganize Index task associated with its design surface. Chapter 16: Introduction to the Maintenance Plan Designer 195 Notice that Subplan_2 is highlighted and the design surface below it includes the Reorganize Index task. Now you can create a schedule just for this subplan, which will execute the Reorganize Index task, and any other tasks you decide to add to the subplan. Task Configuration Boxes We'll go through this process in a lot more detail in Chapter 18, when we examine each of the available maintenance tasks, but there are a few general points worth noting here in regard to the task maintenance boxes that appear on the design surface. When you select a given task, by clicking on its box, that task is in focus. A selected (in focus) task will be surrounded by a dotted gray box that can be expanded or contracted using one of the eight handles (small white squares). In fact, I expanded the task box shown in Figure 16.9 in order to make visible all the text inside it. On the left-hand side of each task box is an icon that represents that task. I don't really find the icons obvious or memorable enough to differentiate each task, so I tend to just ignore them and rely on the task name, which is in bold type at the top of each task box. Below the task's name is a short description of the task, along with some configuration settings. This text will change from task to task, and depending how you configure the task. The red circle with a white "x," to the right of the task boxes in Figures 16.8 and 16.9 indicates that, as of yet, neither of these tasks has been configured. Once a task is configured, this symbol will disappear. Of course, the absence of the symbol doesn't necessarily mean that that a task is configured correctly, only that it has been configured. Finally, at the bottom of the task box is a green arrow, pointing down. This is used to link one task to another, to establish precedence between tasks, and insert conditional logic that controls the flow of tasks. In other words, you can use these arrows to specify the order in which tasks should execute within a given subplan and change the action of a dependent task based on the outcome of the precedent task. For example, if we were to drag an Update Statistics task onto the design surface for the subplan that also contains our Reorganize Index task, shown in Figure 16.9, then we'd want to use these green arrows to establish precedence between the two tasks. In other words, we'd want to specify, not only that the Reorganize Index task takes place before the Update Statistics task but also, potentially, that the latter should only be executed if the Reorganize Index task has been successfully completed. We'll discuss task precedence in a lot more detail in Chapter 18. In case you start experimenting with the Designer before reading the rest of this book… …be aware that when you add tasks to the same subplan, you should manually configure the precedence between tasks. If you don't, then all the tasks on the same subplan will try to execute at the same time, which, as you might imagine, can cause a lot of problems. . from the set of tasks in another subplan. Subplans and SQL Server Agent Jobs Behind the scenes, when you create a Maintenance Plan, a SQL Server Agent job is created for each subplan. As such,. of maintenance tasks that run on the same time schedule. We will cover the topic of subplans in much more detail in Chapter 18 but, for the time being, you just need to know that a single Maintenance. Maintenance Plan Designer. Starting at the top of Figure 16.5, we see the Designer menu bar (covered later), and then a name textbox that is automatically filled in with the name you gave to

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