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

Brad’s Sure Guide to SQL Server Maintenance Plans- P25 doc

5 179 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

Tiêu đề Reorganize Index Task
Trường học Hawaii University
Chuyên ngành Database Management
Thể loại Bài luận
Năm xuất bản 2009
Thành phố Hawaii
Định dạng
Số trang 5
Dung lượng 552,95 KB

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

Nội dung

Details: Reorganize Index HAWAII Reorganize index on Local server connection Databases: AdventureWorks Object: Tables and views Compact large objects Task start: 2009-07-30T15:05:51.. [A

Trang 1

After the Reorganize Task runs, it produces a text report similar to the following:

Microsoft(R) Server Maintenance Utility (Unicode) Version

10.0.2531

Report was generated on "HAWAII."

Maintenance Plan: MaintenancePlan

Duration: 00:00:15

Status: Succeeded.

Details:

Reorganize Index (HAWAII)

Reorganize index on Local server connection

Databases: AdventureWorks

Object: Tables and views

Compact large objects

Task start: 2009-07-30T15:05:51.

Task end: 2009-07-30T15:06:06.

Success

Command:USE [AdventureWorks]

GO

ALTER INDEX [PK_AWBuildVersion_SystemInformationID] ON [dbo] [AWBuildVersion] REORGANIZE WITH ( LOB_COMPACTION = ON )

GO

USE [AdventureWorks]

GO

ALTER INDEX [PK_DatabaseLog_DatabaseLogID] ON [dbo].[DatabaseLog] REORGANIZE WITH ( LOB_COMPACTION = ON )

GO

While the above is an abbreviated report, yours will show the ALTER INDEX command run for every index in every table in your selected databases If there are any problems or error messages, you will see them here also

Reorganize Versus Rebuild

Trang 2

Reorganize Index Task Rebuild Index Task Removing

empty space

and logical

fragmentation

Performs a less thorough index defragmentation than Rebuild Index

If an index does not have any fragmentation, then it is not reorganized, saving resources

Virtually all wasted free space and logical fragmentation is removed All indexes are rebuilt from scratch, whether they need it

or not

Performance

impact

Does not require long blocking locks

An online task that allows users

to access the database during the task

Requires potentially long blocking locks that prevent users from accessing the indexes being rebuilt

A task that should be performed offline, though with the Enter-prise Edition of SQL Server, you can use the online version of rebuilding

an index

Speed Generally takes longer to run than

the Rebuild Index Task

Generally runs faster than the Reorganize Index Task

Space

requirements Uses less disk space than the

Rebuild Index Task

Uses less space in the transaction log than the Rebuild Index Task

Uses more disk space than the Reorganize Index Task

More space is required in the transaction log than the Reorgan-ize Index task

Statistics

maintenance Index and column statistics must

be updated separately This adds

to the administration hassle

Index and column statistics are automatically updated as part of this step, using the FULLSCAN option

Trang 3

When and How Often to Reorganize Indexes

As I stated in the previous chapter, my general preference is to use the Rebuild Index task, as long as it fits into my available maintenance window If I don't have an available maintenance window, then I generally use the Reorganize Index task, along with the Update Statistics task So, before you choose Reorganize over Rebuild, or vice versa, you need to determine what your maintenance windows are

While the Reorganize Index task does offer you the option to run the task outside

maintenance windows, I would still advise against this if possible Although the performance impact of this task, along with Update Statistics, will be much lower than for the

Rebuild Index task, it could still be felt by the users, especially if your database tables are large and your servers busy

As such, if you've chosen the Reorganize Index task, here are my general scheduling recommendations, when using the Maintenance Plan Wizard

Nightly, if possible If running both the Reorganize Index task and Update

Statistics task does not significantly affect users, I suggest you run these two tasks daily, picking a time when running them will have the least impact

Consider alternatives, otherwise If running the Reorganize Index task and Update Statistics task does affect user performance, then you may need to consider exerting

a finer-grained control over the process, using T-SQL or PowerShell scripts

Configuring the Reorganize Index Task

Trang 4

Figure 8.1: The Reorganize Index Task screen is similar to the Rebuild Index Task, but it

has fewer options.

Database Selection

The options here, with the Databases, Object and Selection drop-down boxes, are the same

as those described in the equivalent section of the Rebuild Index chapter (Chapter 7), so I will not walk through them again

As before, my advice is that you select the same database or databases here as for every other

Trang 5

Don't be tempted to configure Rebuild and Reorganize in a single plan

While it is possible to create a single Maintenance Plan that will run the Reorganize

Index task and the Update Statistics task for some databases, and to run the

Rebuild Index task for other databases, this can get confusing very quickly Instead,

create separate Maintenance Plans, as I described previously.

As with the Rebuild Index task, you also have the ability to select an individual database, and then narrow the scope of the task to one or more tables or indexed views Just as I suggested you should not use this feature with the Rebuild Index task, I make the same recommendation here If you are at the point where you need to pick and choose which tables and indexed views to reorganize, then you would be better off using T-SQL or PowerShell scripts to do this task for you, as the Maintenance Plan Wizard is very inflexible

Compact large objects

The only major task-specific option that we need to consider is whether or not to select the

Compact large objects option, as shown in Figure 8.2.

Figure 8.2: Generally, you will want to keep this option selected.

It is checked by default, which means that if a table on which this task runs stores LOB data (text, ntext, or image data types), then LOB data in these tables will be treated just the same

as any other type of data, and will be reorganized

If you deselect this option, then LOB data will not be reorganized Generally, you will want

to keep this option selected, as reorganizing LOB data can boost the performance of your

LOB data, then this task will take more time, which is

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

TỪ KHÓA LIÊN QUAN