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

Sams TOAD handbook mar 2003 ISBN 0672324865

14 84 0

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

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 14
Dung lượng 801,96 KB

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

Nội dung

Figure 5.7 shows the Tablespaces screen, which is used for overall monitoring and is located off the main menu at DBA, Tablespaces.. But if the check fails and you are connected as the T

Trang 1

Probably the least disputed purely DBA job function is database space management, meaning the creation, monitoring, and overall administration of tablespaces and their associated data files Even "do it all" consultants and senior developers who perform DBA tasks prefer to leave space management to

someone else One reason is that space has a tendency to

reach some threshold or limit during normal sleeping hours, when batch jobs execute and pagers going off irritate spouses the most Welcome to the world of production support!

Thus many DBAs performing database space management

generally attempt to fulfill two goals First, to avoid short-term space issues such as failure to allocate an extent for any

permanent or temporary database object And second, to

possess sufficient disk space available for both short-term and mid-term database needs It's this second objective that poses the greatest challenge, as anyone can pre-allocate all the

storage in order to avoid "unable to allocate extent" messages But it takes careful planning and attention to growth patterns in order to avoid running out of disk space before new disks arrive (or are even ordered)

Monitoring Tablespaces

TOAD offers two primary interfaces for space management: one for overall monitoring and another for administrative needs

Figure 5.7 shows the Tablespaces screen, which is used for

overall monitoring and is located off the main menu at DBA, Tablespaces

Figure 5.7 TOAD Tablespaces screen.

Trang 2

Note that the Tablespaces screen provides a single interface for viewing all your tablespace information at once Note that each tab displays different detailed information across all the

tablespaces in the database However, it's the Space tab, shown

in Figure 5.7, which is the most eye-appealing It's the only place in TOAD where you can graphically view space usage

across all your tablespaces at once

Of special interest are the last two tabs on the Tablespaces

screen: Space History and IO History These tabs permit you to graphically display space and IO usage over time, assuming that this historical information is being collected This is exactly that second and more critical space monitoring and planning step discussed earlier Figure 5.8 shows the Space History tab

Figure 5.8 TOAD Space History tab.

Trang 3

Note in Figure 5.8 that the QA database's dictionary-managed tablespace has grown very rapidly over the past month

Although it's only 22 megabytes now, it has grown from nothing

to this size in less than a month Look at the slope of the line This tablespace is worth careful monitoring But how big will it

be next month, or better yet over the next three months? TOAD can predict this for you using sound statistical methods

(assuming that you have sufficient history for TOAD to make an accurate projection) The rightmost icon in the upper left corner, which looks like a bar chart, will launch TOAD's

Database/Tablespace Forecasting screen Here you merely enter how far out to project and TOAD does the rest Figure 5.9

shows that our QA database's dictionary-managed tablespace from Figure 5.8 will grow to nearly 105 megabytes over the

next three months

Figure 5.9 TOAD Database/Tablespace

Forecasting screen.

Trang 4

When you open the Tablespaces screen, TOAD verifies whether your TOAD schema contains the necessary repository tables and data collection package, and whether it has been scheduled by using DBMS_JOBS If the check fails and you are not connected

as the TOAD user, you will see a warning that you must create these objects while connected as the TOAD user But if the

check fails and you are connected as the TOAD user, you will enter the Space Manager Setup screen, shown in Figure 5.10,

to define and create all the required components (which you also can do manually when on either of these last two tabs by clicking the very first icon in the upper-left corner of the

Tablespaces screen)

Figure 5.10 TOAD Space Manager Setup screen.

Trang 5

You have three very simple selections to make on this screen First, how often should TOAD collect the information? Second, how long should TOAD keep that information? And third, should TOAD start with empty tables (that is, with no history) or

should it try to project some data backwards? The

recommendation is to collect data every day (preferably just after a typical batch cycle), keep at least a year's worth of data (for more accurate projections), and to start with empty tables (no need for fake data being backfilled; it would just skew any short-term projections until sufficient history is collected)

Managing Tablespaces

TOAD's other primary interface for space management, which addresses more administrative needs, is the Schema Browser's Tablespaces tab, shown in Figure 5.11 The Schema Browser is launched by either selecting its icon on the main toolbar

(second icon from the top left by default) or from the main

menu at Database, Schema Browser In fact, for many DBAs the Schema Browser may actually be their default initial screen, as defined in the TOAD Options for Startup

Trang 6

tab.

The Schema Browser's Tablespaces tab provides much of the same detailed information about tablespaces and their data files

as does the Tablespaces screen discussed in the preceding

section, but more importantly, it provides numerous features for managing these resources as well The left-hand side (LHS) of the Schema Browser's Tablespaces tab provides toolbar icons for the most common tablespace administrative tasks:

Create Script, which copies the selected tablespace's DDL to the Window's clipboard

Create New Tablespace, which launches a modal window for creating a new tablespace

Alter Tablespace, which launches a modal window for

altering an existing tablespace

Place Online, which alters the selected tablespaces to the online status

Take Offline, which alters the selected tablespaces to the offline status and displays a red X next to the LHS display

Trang 7

Show Tablespace Map, which launches the Tablespace Map screen for the selected tablespace (this screen is found on the main menu at DBA, Tablespace Map and is covered later

in this chapter in the section "Checking the Level of

Tablespace Fragmentation")

Export Tablespace Using Export Wizard, which launches the Export Utility Wizard (this wizard is found on the main

menu at DBA, Export Utility Wizard)

Coalesce Tablespace, which coalesces the selected

tablespaces in order to reduce fragmentation

Drop Tablespace, which drops the selected tablespaces and their associated data files (where possible depending upon the Oracle version)

Moreover, the right-hand side (RHS) of the Schema Browser's Tablespaces tab provides toolbar icons for the Datafiles,

Fragmentation, and Quotas tabs The Datafiles tab toolbar icons are probably the most useful, and include:

Add Data File, which launches a modal window for creating

a new data file

Alter Data File, which launches a modal window for altering

an existing data fileand includes a handy utility for

calculating the minimum size the data file can be resized down to, shown in Figure 5.12

Figure 5.12 TOAD Datafile Definition window,

for size estimation.

Trang 8

Browser's Tablespaces tab is the multi-select capability, which enables you to select one or more tablespaces upon which to perform an administrative operation For example, Figure 5.13

shows just how simple it now is to coalesce all the tablespaces

in the entire database at once You merely need to multi-select the desired tablespaces, right-click to activate the context

menu, and then pick an operation That's all there is to it

Figure 5.13 The Tablespaces tab supports multi-select.

Trang 10

A routine task many DBAs perform is monitoring tablespace fragmentation But ask DBAs what they mean by tablespace fragmentation, and you'll most likely get at least several

different answers The reason is twofold First, there is both confusion and disagreement on what the general term means And second, there are several kinds of Oracle database

fragmentation often referred to when referencing the general term A quick review of the Oracle fragmentation terminology follows:

Tablespace Free space Fragmentation (TFF) occurs when a tablespace contains more than one extent of free space

Segment Fragmentation (SF) occurs when a segment is so large as to consume multiple extents

Data Block Fragmentation (DBF) occurs when rows are

deleted from data blocks and leave holes of unused space

Index Leaf Block Fragmentation occurs when rows are

deleted, thus creating partially or completely empty leaf blocks in the index B-tree

Row Fragmentation (RF) or chaining occurs when an update increases a row length such that it cannot fit in its current data block and must migrate to a new data block that has sufficient room for the entire row

TOAD offers screens for examining tablespace free space and segment fragmentation, which will be covered next TOAD

doesn't offer anything for Data Block Fragmentation, and

TOAD's offerings for both Index Leaf Block Fragmentation and

Trang 11

For viewing Tablespace Free space Fragmentation (TFF), you should use the TOAD Schema Browser's Tablespaces tab and look at the Fragmentation tab on the right-hand side of the

window, shown in Figure 5.17 The Schema Browser is launched

by either selecting its icon on the main toolbar (second icon from the top left by default) or from the main menu at

Database, Schema Browser Remember that the Schema

Browser may actually be the default initial screen, as defined in the TOAD Options for Startup

Figure 5.17 TOAD Schema Browser Tablespace

tab for viewing TFF.

Note that the screen in Figure 5.17 breaks this information

down into nice, digestible pieces It shows that there are two free space extents over 100 megabytes and six of them from 1 and 10 megabytes Of course, one of those free space extents that's over 100 megabytes is probably our free space extent above the high water mark (for example, never been utilized

Trang 12

yet) Naturally this free space information is provided by data file, because new extent allocations cannot span across them

For viewing Segment Fragmentation by tablespace, you should use the TOAD Tablespace Map screen, which is located on the main menu at DBA, Tablespace Map and shown in Figure 5.18 The basic formula used to calculate the map's coloring scheme is:

Figure 5.18 TOAD Tablespace Fragmentation

Map.

100 - ROUND((SUM OF the BLOCKS FOR that SEGMENT -LARGEST BLOCK IN that SEGMENT) / SUM OF the BLOCK FOR that SEGMENT * 100))

Note that as you hover your mouse over cells in the map, it displays which segments consume data blocks represented by that cell In Figure 5.18, the map shows that a table and its primary key share data blocks in that cell But that cell might represent hundreds of actual data blocks if this were a large tablespace Thus they may not overlap at all Of course, having

a table and its indexes in the same tablespace is a bad idea (although not with regard to fragmentation, but for spreading

IO to avoid hot disks) So keep in mind that red cells really represent segments that consume a high percentage of blocks for their overall size Thus they are candidates for object

Trang 13

Note that the Tablespace Fragmentation Map screen offers some very useful capabilities through its toolbar icons You can

coalesce the selected tablespace, display a graphical legend, display a pop-up window for showing the pointed-to cell's

segments (rather than relying on the bubble help format shown

in Figure 5.18), and display a pop-up window for filtering the displayed segments by data file, object type, owner, and object

So look at Figure 5.19 where these last three options have been turned on Notice that some of the cells are now shown in

yellow These represent cells containing the data blocks for the filter selection of the index MOVIES_PROD.MOVIERENTAL_PK Note too that the Filters window has a toolbar icon for Rebuild Table/Index, which allows rebuilding those objects that the

connected schema owns

Figure 5.19 TOAD Tablespace Fragmentation Map

pop-up windows.

Finally, note that there are a few options within TOAD related to

Trang 14

using the Tablespace Map screen, depicted in Figure 5.20 The TOAD Options screen can be opened either by using the Toolbox icon on the main toolbar or from the main menu at View,

Options Probably the most useful feature is the ability to define new threshold percentages and colors for highlighting on the tablespace map

Figure 5.20 TOAD Tablespace Fragmentation Map

options.

Ngày đăng: 19/04/2019, 10:11

TỪ KHÓA LIÊN QUAN