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

Brad’s Sure Guide to SQL Server Maintenance Plans- P52 pps

5 301 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 592 KB

Nội dung

Chapter 19: Create and Modify Maintenance Plans Using the Designer 256 which they are to execute. The easiest way to do this is to first order the tasks on the design surface in the proper order, and then draw the green connecting arrows. Setting precedence is always done two tasks at a time, so start with the first two tasks and work your way down. So, for example, we start out by linking the Check Database Integrity task and the Rebuild Index task. Next, link the Rebuild Index task with the History Cleanup Task, and so on, until all of the six tasks are linked, as shown in Figure 19.9. Chapter 19: Create and Modify Maintenance Plans Using the Designer 257 Figure 19.9: The green arrows aren't pretty, but they don't need to be. When this subplan is scheduled to run, these six tasks will run, one after another, in the order dictated by the direction of the precedence arrows. Of course, this assumes that each of the tasks succeeds. The fact that we are using "on success" conditions (green arrows) to link successive tasks means that a failure of any one of these tasks will prevent tasks further down the chain from executing. Chapter 19: Create and Modify Maintenance Plans Using the Designer 258 Therefore, if any one of these tasks fails, we want the operator to know about it and act on it. This is where the Notify Operator tasks come into play. The next step is to link each of the six core maintenance tasks with one instance of a Notify Operator tasks, using a red arrow, indicating an "on failure" condition. Having completed this step, the subplan should look as shown in Figure 19.10. Figure 19.10: The red arrows indicate failure. Chapter 19: Create and Modify Maintenance Plans Using the Designer 259 Now, if any of the Maintenance Tasks fails, the linked Notify Operator task will execute, sending a customized e-mail to the operator, describing which task failed, and explaining that, as a result, the rest of the tasks within this subplan will not execute. So, if the Check Database Integrity task succeeded, but the Rebuild Index task failed, the operator would receive an e-mail with a message saying that the Rebuild Index task failed, and that the remaining Maintenance Plan tasks would not be executed. Proceeding in spite of task failure If you want, you can configure the precedence in such a way as to continue the execution of all the tasks in the subplan, even if one of them fails, instead of cancelling the remaining tasks, as I have done. One way to do this would be to create an "on success" link between the Notify Operator task (that sends the e-mail notifying the operator of a failed task) and the next task you want run next. Finally, we need to deal with that seventh Notify Operator task, which is currently not connected to any other task. Since all our six core maintenance tasks are connected by green arrows, we know that if the last task in the chain, Delete TXT Files Cleanup, completes successfully, then all the tasks in the subplan have completed successfully. In this event, our final goal is that the operator receives an e-mail notification to this effect. To implement this final link, drag an arrow from the Delete TXT Files Cleanup task to the loan Notify Operator task, as shown in Figure 19.11. Figure 19.11: The Weekly AdventureWorks Maintenance Successful Operator task will only execute if all six maintenance task succeed. We have now set up the precedence for all three of our subplans, and we are almost done. Chapter 19: Create and Modify Maintenance Plans Using the Designer 260 Define Reporting and Logging The next step in implementing our Maintenance Plan is to click in the Reporting and Logging icon in the designer menu bar and configure our reporting and logging requirements. We discussed the Reporting and Logging options of the Designer in Chapter 16, and I won't go over all the details again here. However, for our Maintenance Plan, we need to ensure the points below. • Generate a text file report is selected, so a text file report is generated and saved to an appropriate location each time a subplan is executed. In our case, we'll get three reports from this Maintenance Plan, one being written to file every time each subplan runs. These reports will give you the "big picture" of how your plans are executing, and will supplement the e-mails sent via the Notify Operator task. • The Log extended information checkbox is checked, so that the data collected as part of the text file reports will be comprehensive, and will make it easier for us to track down any problems with a Maintenance Plan. The configured Reporting and Logging screen should look similar to the one shown in Figure 19.12. . tasks fails, we want the operator to know about it and act on it. This is where the Notify Operator tasks come into play. The next step is to link each of the six core maintenance tasks with one. and Modify Maintenance Plans Using the Designer 259 Now, if any of the Maintenance Tasks fails, the linked Notify Operator task will execute, sending a customized e-mail to the operator, describing. is that the operator receives an e-mail notification to this effect. To implement this final link, drag an arrow from the Delete TXT Files Cleanup task to the loan Notify Operator task, as shown

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