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

Brad’s Sure Guide to SQL Server Maintenance Plans- P41 pdf

5 471 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 512,03 KB

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

Nội dung

This is the default option and is identical to the option provided when configuring text file reports using the Maintenance Plan Wizard, where a new file is created each time a report i

Trang 1

Chapter 16: Introduction to the Maintenance Plan Designer

If you decide to generate a text file report, you have two additional options

Create a new file This is the default option and is identical to the option provided

when configuring text file reports using the Maintenance Plan Wizard, where a new file

is created each time a report is created A default storage location for the report files is also provided

Append to file This option forces all text file reports to be written to a single physical

file Obviously, this file will grow in size each time a Maintenance Plan job runs

I suggest you stick to the default options, as separate files for each text file report makes it easier to find them, and the default location for the files is where DBAs always look to find them If you change the location, then it will make it harder for other DBAs, not familiar with your configuration, to find these reports

If you decide to ignore my advice, and select the single file option, then you'll also need to specify the path and the name of the file to which you want all text reports to be appended

Be warned though that it will make it much more difficult to find specific Maintenance Plan text file reports when they are all lumped together into a single file!

Immediately below the text file configuration options, in grayed out type, is the Send report

to an e-mail recipient option It is very similar to the option available from the Maintenance

Plan Wizard option that sends an e-mail to an operator when a Maintenance Plan job

completes However, there is one important difference: you can't use it Likewise, the next

option on the screen, Agent operator, is grayed out and can't be used.

So how come you can set this option using the Maintenance Plan Wizard, but not with the Maintenance Plan Designer? It's not a mistake; this is intentional The Maintenance Plan Designer has a special maintenance task called the Notify Operator, which is a much more powerful way of notifying DBAs if something goes wrong with a Maintenance Plan We will discuss this task in Chapter 17

So, if the Notify Operator task is used to send e-mail notifications, why is this option even available on this screen? Again, there is a valid reason If you create a Maintenance Plan from scratch using the Designer then, yes, you must use the Notify Operator task for e-mail reports However, say you created a plan through the Wizard, specifying that you want e-mails sent to a specific DBA, and then later needed to change this so that the mail was sent

to a different DBA? In that case, if you opened the wizard-created plan in the Designer, you'd find that this Send report to an e-mail recipient option would be available and you could

change the Agent who was to receive the e-mails

Trang 2

Chapter 16: Introduction to the Maintenance Plan Designer

The first option, Log extended information, is selected by default, and specifies that the

text file report be as complete as possible In fact, this is the same level of logging as that provided by the Maintenance Plan Wizard when it creates text log reports If you deselect this option, you get a less detailed report I recommend that you leave this option selected, as the additional information provides you with details that can make troubleshooting Maintenance Plans much easier There is no downside to leaving this option on

The second option, Log to remote server, allows you to send your text log reports to a

different SQL Server than the one on which you are running the Maintenance Plan I don't recommend this option because it adds complexity to your plans, but it can be used in cases where you want consolidate Maintenance Plan text file reports in a central location

MultiServer Maintenance Plans

The eighth and final option on the Designer menu bar is called Servers… (it looks like a little

server) and allows you to set up multiserver Maintenance Plans The theory is that you can create a single Maintenance Plan on one SQL Server instance, and then run it on multiple SQL Server instances The multiserver Maintenance Plan is created on what is called a master server, and then rolled out onto target servers

Unfortunately, the theory does not translate well into practice in this case This feature is awkward to configure, not very flexible, and is the cause of a lot of administrative headaches

As such, I have not discussed them in this book, and I don't recommend you use the feature The Servers… icon is grayed out until master and target servers have been configured in

SSMS I suggest you don't do this Leave the option grayed out and ignore it

If you feel you have a need for such a feature, I suggest you investigate using T-SQL or PowerShell scripts which, in effect, can offer the same benefits, but are much more flexible and reliable

Summary

Finally, we have covered the basics of how to use the Maintenance Plan Designer screen Now it's time to begin learning how to configure individual maintenance tasks within the Designer

Trang 3

Chapter 17: Configuring

Maintenance Tasks Using

the Designer

Having explored the Designer GUI in some detail in the previous chapter, we're now ready to investigate how to use the Designer to configure each of the eleven maintenance tasks that are available You may be thinking that these are exactly the same eleven tasks we saw when using the Maintenance Plan Wizard, but that's not quite the case Eight of the eleven tasks (Check Database Integrity, Rebuild Index, Reorganize Index, Update Statistics, Shrink Database, History Cleanup, and Maintenance Cleanup) are logistically more or less identical to the ones we configured through the Wizard We'll cover most of these tasks in relatively little detail, avoiding as far as possible repetition of configuration options that are identical to what we saw when using the Wizard

There is one task in the Maintenance Plan Designer, Back Up Database, which performs the same role as three separate backup tasks (Full, Differential, Transaction Log) in the Wizard You may recall from Chapter 16 that one of the compelling advantages of the Designer is that, unlike the Wizard, it enables us to include multiple instances of the same task in a single Maintenance Plan Therefore, rather than configure three separate backup tasks, as we did

in the Wizard, in the Designer we simply configure three separate instances of the same task, one instance to do full backups, one differential, and one for transaction log backups

This ability to include multiple executions of the same task in a single plan applies to any Maintenance Plan task within the Designer, but it is particularly useful in regard to the Maintenance Cleanup task, as it allows us to overcome the previously-noted limitations of Wizard version of the task, namely that it only allowed us to remove one of the three types

of file (BAK, TRN and TXT) in any given plan Using the Designer, we'll create a single plan that removes all three types of file in one go

Finally, we'll cover in full detail two new tasks that are excusive to the Designer, namely Execute T-SQL Statement and Notify Operator

A Note of Drag-and-Drop Caution

Trang 4

Chapter 17: Configuring Maintenance Tasks Using the Designer

Remember, though, that each subplan has its own design surface If you are not careful, it is easy to assign a Maintenance task to the wrong subplan Always double-check that the correct subplan is highlighted before dragging a task out of the toolbox If you do make a mistake, it is easy to correct Simply right-click on the misplaced task and select Delete, then

highlight the correct surface and drag and drop the task You cannot drag and drop tasks between subplans

Check Database Integrity Task

As discussed in Chapter 5, the Check Database Integrity task is used to investigate the logical and physical integrity of all the objects in a database, looking for any corruption that could put data at risk In order to configure this task in the Designer, the first step is to drag

it into the design surface of the relevant subplan Throughout this chapter, I'm going to keep things simple and use a single subplan and design surface, as in Figure 17.1

Figure 17.1: Maintenance Plan Tasks appear as rectangles on the design surface.

As mentioned in the previous chapter, the cross on the red background indicates that the task

is not yet configured To manually configure this and any other task in the Designer, right-click on it and select Edit, or double-click on the task, to bring up the task's configuration

screen, shown in Figure 17.2

Trang 5

Chapter 17: Configuring Maintenance Tasks Using the Designer

Figure 17.2: The configuration options screen for the Check Database Integrity Task.

The configuration screen for the Check Database Integrity task is similar, although not identical, to the one we saw in Chapter 5 The first thing you will notice is the Connection

drop-down box, which is currently displaying Local server connection Referring back to

the Manage Connections option in the Designer menu bar, you'll recall that, by default,

you'll create the Maintenance Plan on the local SQL Server (the SQL Server instance you are connected to via SSMS) Clicking on the New… button takes you to the screen where you can

define a new custom connection (the same screen can be reached via Manage Connections)

Unless you've previously created a custom connection, Local server connection will be the

only available choice in the drop-down box, and is the one I recommend you stick to I don't recommend using custom connections because they add complexity to your Maintenance Plans If you need this capability, then you should probably be using custom T-SQL or PowerShell scripts instead

Scheduling tasks in Designer

In the Wizard, the task scheduling option was at the bottom of each individual task

configuration screen In the Designer, scheduling is done at the subplan level, not at the individual task level, and will be covered in Chapter 18.

Next on the screen is the Database(s) drop-down box Clicking on <Select one or more>

brings up the database selection screen shown in Figure 17.3 and with which we are by now very familiar

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

TỪ KHÓA LIÊN QUAN