Tải bản đầy đủ (.pdf) (40 trang)

oracle 8 database administration volume 1 instruction guide phần 8 pptx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (163.43 KB, 40 trang )

Types of Segments
......................................................................................................................................................

Coalescing on Demand
The view DBA_FREE_SPACE_COALESCED can be used to find out if any
tablespace has extents that can be coalesced. Use the following query to get
this information:
SVRMGR> SELECT tablespace_name, total_extents,
2> percent_extents_coalesced
3> FROM dba_free_space_coalesced
4> WHERE percent_extents_coalesced <> 100;
TABLESPACE_NAME
TOTAL_EXTE
PERCENT_EX
--------------------------------RBS
3
33
DATA01
9
22
2 rows selected.

Coalescing free space in a tablespace can be performed by executing the
command:
ALTER TABLESPACE tablespace COALESCE;

OEM
1 Use Oracle Tablespace Manager.
2 Expand Tablespaces node.
3 Select the tablespace.
4 Select Tools—>Coalesce Free Extents.



......................................................................................................................................................
Oracle8: Database Administration
9-15


Lesson 9: Storage Structure and Relationships
......................................................................................................................................................

Using Block Space Utilization Parameters

Database Block: Review
• Minimum unit of I/O
• Consists of one or more O/S blocks
• Set by DB_BLOCK_SIZE
• Set at database creation

9-11

Copyright © Oracle Corporation, 1998. All rights reserved.

......................................................................................................................................................
9-16
Oracle8: Database Administration


Using Block Space Utilization Parameters
......................................................................................................................................................

Database Block Contents


Header
Free space

Data

9-12

Copyright © Oracle Corporation, 1998. All rights reserved.

Oracle data blocks contain:
• Block header: Header contains the data block address, table directory,
row directory, and transaction slots that are used when transactions make
changes to rows in the block. Block headers grow from the top down.
• Data space: Row data is inserted into the block bottom up.
• Free space: The free space in a block is in the middle allowing both the
header and the row data space to grow if necessary. The free space in a
block is contiguous initially. However, deletions and updates may
fragment the free space in the block. The free space in the block is
coalesced by the Oracle server when necessary.

......................................................................................................................................................
Oracle8: Database Administration
9-17


Lesson 9: Storage Structure and Relationships
......................................................................................................................................................

Block Space

Utilization Parameters
INITRANS
MAXTRANS
PCTFREE
PCTUSED

9-13

Copyright © Oracle Corporation, 1998. All rights reserved.

Block space utilization parameters can be used to control the use of space in
data and index segments.
Parameters Controlling Concurrency
INITRANS and MAXTRANS specify the initial and the maximum number
of transaction slots, which are created in an index or a data block. The
transaction slots are used to store information about transactions that are
making changes to the block at a point in time. A transaction only uses one
transaction slot even if it is changing more than one row or index entry.
INITRANS, which defaults to 1 for a data segment, and 2 for an index
segment, guarantees minimum level of concurrency. For example, if set to 3,
INITRANS ensures that at least three transactions can concurrently make
changes to the block. If necessary, additional transaction slots can be
allocated from the free space in the block, to permit more concurrent
transactions to modify rows in the block.

......................................................................................................................................................
9-18
Oracle8: Database Administration



Using Block Space Utilization Parameters
......................................................................................................................................................

MAXTRANS, which has a default value of 255, sets the limit for the
number of concurrent transactions that can make changes to a data or an
index block. When set, this value restricts use of space for transaction slots
and therefore guarantees that there is sufficient space in the block for use by
row or index data.
Parameters Controlling the Use of Data Space
PCTFREE for a data segment specifies the percentage of space in each data
block reserved for growth resulting from updates to rows in the block. The
default for PCTFREE is 10 percent.
PCTUSED for a data segment represents the minimum percentage of used
space that Oracle Server tries to maintain for each data block of the table. A
block is put back on the free list when its used space falls below PCTUSED.
The free list of a segment is a list of blocks that are candidates for
accommodating future inserts. A segment, by default, is created with one
free list. Segments can be created with a higher number of free lists by
setting the FREELISTS parameter of the storage clause. The default for
PCTUSED is 40 percent.
Both PCTFREE and PCTUSED are calculated as percentages of available
data space, that is, the block space that remains after deducting the header
space from the total block size.
Block space utilization parameters can only be specified for segments and
cannot be set at the tablespace level.
Note
The use of these parameters for indexes is discussed in detail in the lesson
“Managing Indexes.”
Specifying FREELISTS is discussed in detail in the course Oracle8:
Performance Tuning.


......................................................................................................................................................
Oracle8: Database Administration
9-19


Lesson 9: Storage Structure and Relationships
......................................................................................................................................................

Block Space Usage
PCTFREE=20

Inserts

PCTUSED=40

80%

1

Inserts
2

80%

Inserts
40%

3
9-14


Inserts
4

Copyright © Oracle Corporation, 1998. All rights reserved.

The following steps explain how space within a block is used for a data
segment, such as a table with PCTFREE=20 and PCTUSED=40:
1 Rows are inserted into the block until the utilization reaches 80% or
(100-PCTFREE). The block is no longer available for inserts when rows
occupy 80% of available data space in the block.
2 The remaining 20% can be used when the size of the row increases, for
example, the case in which a column that was originally NULL is
updated to be assigned a value. Thus block utilization may be in excess
of 80% as a result of updates.
3 If rows are deleted in the block or if rows reduce in size as a result of
updates, block utilization may fall below 80%. However, a block is not
used for inserts until the utilization falls below PCTUSED, which in this
example, is 40%.
4 When the utilization falls below PCTUSED, the block is available for
inserts. As rows are inserted into the block, the utilization of the block
increases and the cycle repeats starting with step 1.
Note
Guidelines for setting PCTFREE and PCTUSED are discussed in the
lessons on tables and indexes, “Managing Table Storage” and “Managing
Indexes” respectively.

......................................................................................................................................................
9-20
Oracle8: Database Administration



Obtaining Information About Storage Structures
......................................................................................................................................................

Obtaining Information About Storage Structures

Data Dictionary Views
Used extents
Free extents
DBA_EXTENTS DBA_FREE_SPACE
Segments
Data files
DBA_SEGMENTS DBA_DATA_FILES
Tablespaces
DBA_TABLESPACES

9-15

Copyright © Oracle Corporation, 1998. All rights reserved.

The relationships between tablespaces, data files, segments, and extents
(both used and free) can be viewed by querying the data dictionary.
When a tablespace with one or more files is created, a row is added to
DBA_TABLESPACES. For each file in the database, a row is added to
DBA_DATA_FILES. At this stage, the space in each data file, excluding the
file header, shows up as one free extent in DBA_FREE_SPACE.
When a segment is created, a row is visible in DBA_SEGMENTS. The
space allocated to the extents in this segment can be viewed from
DBA_EXTENTS, while DBA_FREE_SPACE is adjusted to show lower free

space in the files where the extents have been created for the segment.
All the space in a file (excluding the header block) must be accounted for
either in DBA_FREE_SPACE or in DBA_EXTENTS.

......................................................................................................................................................
Oracle8: Database Administration
9-21


Lesson 9: Storage Structure and Relationships
......................................................................................................................................................

Querying Segment Information
DBA_SEGMENTS
– General information
– OWNER
SEGMENT_NAME
– SEGMENT_TYPE
– TABLESPACE_NAME

– Size

– Storage settings

– EXTENTS
– BLOCKS

9-16








INITIAL_EXTENT
NEXT_EXTENT
MIN_EXTENTS
MAX_EXTENTS
PCT_INCREASE

Copyright © Oracle Corporation, 1998. All rights reserved.

Query the DBA_SEGMENTS view to check the current number of extents
and blocks allocated to a segment.
SVRMGR> SELECT segment_name,tablespace_name,extents,blocks
2> FROM dba_segments
3> WHERE owner='SCOTT';
SEGMENT_NAME
TABLESPACE_NAME EXTENTS
BLOCKS
-------------------------- ---------------EMP
DATA01
5
55
DEPT
DATA01
1
5
BONUS

DATA01
1
5
SALGRADE
DATA01
1
5
DUMMY
DATA01
1
5
5 rows selected.

......................................................................................................................................................
9-22
Oracle8: Database Administration


Obtaining Information About Storage Structures
......................................................................................................................................................

Getting Used Extent Information
DBA_EXTENTS
– Identification
– OWNER
– SEGMENT_NAME
– EXTENT_ID

– Location and size






9-17

TABLESPACE_NAME
RELATIVE_FNO
FILE_ID
BLOCK_ID
BLOCKS
Copyright © Oracle Corporation, 1998. All rights reserved.

Use the DBA_EXTENTS view to check the extents for a given segment.
SVRMGR> SELECT extent_id,file_id,block_id,blocks
2> FROM dba_extents
3> WHERE owner='SCOTT'
4> AND segment_name='EMP';
EXTENT_ID
FILE_ID
BLOCK_ID
---------------------0
4
2
1
4
27
2
4
32

3
4
42
4
4
57
5 rows selected.

BLOCKS
-----5
5
10
15
20

......................................................................................................................................................
Oracle8: Database Administration
9-23


Lesson 9: Storage Structure and Relationships
......................................................................................................................................................

Checking Free
Extent Information
DBA_FREE_SPACE
– Location and size







9-18

TABLESPACE_NAME
RELATIVE_FNO
FILE_ID
BLOCK_ID
BLOCKS

Copyright © Oracle Corporation, 1998. All rights reserved.

Use the DBA_FREE_SPACE view to check the extents for a given segment.
SVRMGR> SELECT tablespace_name, count(*),
2>
max(blocks), sum(blocks)
3> FROM dba_free_space
4> GROUP BY tablespace_name;
TABLESPACE_NAME COUNT(*)
MAX(BLOCKS
--------------- ----------------DATA01
2
1284
RBS
3
2329
SORT
1
1023

SYSTEM
1
5626
TEMP
1
2431
5 rows selected.

SUM(BLOCKS
---------1533
2419
1023
5626
2431

......................................................................................................................................................
9-24
Oracle8: Database Administration


Planning the Location of Segments
......................................................................................................................................................

Planning the Location of Segments

Organizing Tablespaces Based
on Fragmentation Propensity
Tablespace

Usage


Fragmentation

SYSTEM

Data dictionary

Zero

TOOLS

Applications

Very low

DATAn

Data segments

Low

INDEXn

Index segments

Low

RBSn

Rollback segments


High

TEMPn

Temporary segments

Very high*

* Relevant only if tablespace PERMANENT
9-19

Copyright © Oracle Corporation, 1998. All rights reserved.

Different types of segments have varying propensities for fragmentation. It
is recommended that they are placed in different tablespaces in order to
minimize the waste of space.
Types of Objects and Fragmentation
The recommended structure for the tablespaces, their uses, and their
fragmentation propensities are shown in the table. The following are the
different types of objects listed in an increasing order of fragmentation
propensity:
• Data dictionary objects, with the exception of the audit table, are never
dropped or truncated, and therefore are not likely to fragment the
tablespace.
• Space used for repositories of applications such as Oracle Enterprise
Manager and Designer/2000 are only deallocated while reorganizing
these structures. Since these tables are seldomly reorganized, these
objects have very low propensity for fragmentation.
• Data and index segements used for user-written applications might need

to be reorganized more frequently than repositories. So, they have a
higher propensity for fragmentation than application repositories.

......................................................................................................................................................
Oracle8: Database Administration
9-25


Lesson 9: Storage Structure and Relationships
......................................................................................................................................................




Since rollback segments can deallocate extents automatically, they are
likely to cause fragmentation in a system with high update activity.
Temporary segments in permanent tablespaces can release space quite
frequently, and therefore they must be located in separate tablespaces.
Temporary segments are discussed in a later lesson.

Influence of Segment Life Span
Segments may have different life spans in a database. For example, in a
project-based environment, such as a software house, all data relating to an
application may need to be purged when the development of the system is
complete. Using a separate set of tablespaces for locating these segments
may help during clean up. At the end of the project the whole tablespace can
be backed up and dropped to provide space for other applications using the
database.

......................................................................................................................................................

9-26
Oracle8: Database Administration


Summary
......................................................................................................................................................

Summary

Summary
• Allocation and deallocation of extents
for different types of segments

• Block space utilization parameters

9-20

Copyright © Oracle Corporation, 1998. All rights reserved.

Quick Reference
Context
Initialization parameters
Dynamic performance views
Data dictionary views

Reference
DB_BLOCK_SIZE
None
DBA_TABLESPACES
DBA_DATA_FILES

DBA_SEGMENTS
DBA_EXTENTS
DBA_FREE_SPACE

Commands

DBA_FREE_SPACE_COALESCED
ALTER TABLESPACE ... COALESCE

......................................................................................................................................................
Oracle8: Database Administration
9-27


Lesson 9: Storage Structure and Relationships
......................................................................................................................................................

......................................................................................................................................................
9-28
Oracle8: Database Administration


10
................................

Managing Rollback
Segments


Lesson 10: Managing Rollback Segments

......................................................................................................................................................

Instructor Note
Topic
Lecture

Timing
50 minutes

Practice

45 minutes

Total

95 minutes

......................................................................................................................................................
10-2
Oracle8: Database Administration


Objectives
......................................................................................................................................................

Objectives

Objectives
• Planning the number and size of
rollback segments

• Creating rollback segments using
appropriate storage settings
• Maintaining rollback segments
• Obtaining rollback segment information
from the data dictionary
ã Troubleshooting rollback segment
problems

10-2

Copyright â Oracle Corporation, 1998. All rights reserved.

......................................................................................................................................................
Oracle8: Database Administration
10-3


Lesson 10: Managing Rollback Segments
......................................................................................................................................................

Overview

Rollback Segment
Old
image

Table

New
image


Rollback
segment
Update
transaction
10-3

Copyright © Oracle Corporation, 1998. All rights reserved.

A rollback segment is used to save the old value when a process is making
changes to the data in a database. It stores block information such as file and
block ID, and also data, as it existed before being modified.
The header of a rollback segment contains a transaction table where
information about current transactions using the segment is stored.
A transaction can use only one rollback segment to store all of its rollback
(undo) records.
Many concurrent transactions can write to one rollback segment.

......................................................................................................................................................
10-4
Oracle8: Database Administration


Rollback Segments
......................................................................................................................................................

Rollback Segments

Rollback Segments: Purpose


Transaction
rollback

Transaction
recovery
10-4

Rollback
segment

Read
consistency

Copyright © Oracle Corporation, 1998. All rights reserved.

Transaction Rollback
When a transaction makes changes to a row in a table, the old image is saved
in the rollback segment. If the transaction is rolled back, the value in the
rollback segment is written back to the row, restoring the original value.
Transaction Recovery
If the instance fails when transactions are in progress, Oracle server needs to
rollback the uncommitted changes when the database is opened again. This
rollback is known as transaction recovery and is only possible if changes
made to the rollback segment are also protected by the redo log files.
Read Consistency
When transactions are in progress, other users in the database should not see
any uncommitted changes made by these transactions. In addition, a
statement should not see any changes that were committed after the
statement commences execution. The old values in the rollback segments are
also used to provide the readers a consistent image for a given statement.


......................................................................................................................................................
Oracle8: Database Administration
10-5


Lesson 10: Managing Rollback Segments
......................................................................................................................................................

Types of Rollback Segments
• SYSTEM
• Non-SYSTEM
– Private
– Public

10-5

Copyright © Oracle Corporation, 1998. All rights reserved.

SYSTEM Rollback Segment
The SYSTEM rollback segment is created in the SYSTEM tablespace when
a database is created. This rollback segment can only be used for changes
made to objects in the SYSTEM tablespace.
Non-SYSTEM Rollback Segments
A database that has multiple tablespaces needs at least one non-SYSTEM
rollback segment. A non-SYSTEM rollback segment, which is created by
the database administrator, can be used for changes made to objects in any
non-SYSTEM tablespace. There are two types of non-SYSTEM rollback
segments.
Private

Private rollback segments are segments that are only acquired by an instance
if they are either named in the parameter file or if they are explicitly brought
online by issuing a command manually.

......................................................................................................................................................
10-6
Oracle8: Database Administration


Rollback Segments
......................................................................................................................................................

Public
Public rollback segments form a part of a pool of rollback segments
available in a database. Public rollback segments can be used with the
Oracle Parallel Server.
Note
The use of public rollback segments is discussed in the manual Oracle8
Parallel Server Concepts and Administration.
Instructor Note
Although deferred rollback segments are used by the Oracle server, no
maintenance is required on the part of the DBA. They are created when a
user rolls back a transaction that made changes to data in a tablespace that is
currently offline. They are automatically dropped when they are no longer
needed.

......................................................................................................................................................
Oracle8: Database Administration
10-7



Lesson 10: Managing Rollback Segments
......................................................................................................................................................

Using Rollback Segments with Transactions

Transactions and Rollback
Segments

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAA
AAAAA
AAAAA
AAAAA
AAAAA

1

Transaction 1 Transaction 2


AAAA
AAAA
AAAA
AAAA
AAAA
10-6

Active extent

2

4

3

Inactive extent

Copyright © Oracle Corporation, 1998. All rights reserved.

Allocation of Rollback Segment
When a transaction begins, a rollback segment needs to be assigned to this
transaction. A transaction may request a specific rollback segment using the
following command:
SET TRANSACTION USE ROLLBACK SEGMENT rollback_segment

If no such request is made, the Oracle server chooses the rollback segment
with the fewest transactions, and assigns it to the transaction.
Using Extents
Transactions use extents of a rollback segment in an ordered circular

fashion, moving from one to the next after the current extent is full. A
transaction writes a record to the current location in the rollback segment
and advances the current pointer by the size of the record.

......................................................................................................................................................
10-8
Oracle8: Database Administration


Using Rollback Segments with Transactions
......................................................................................................................................................

Example
In the above example, two transactions, Transaction 1 and Transaction 2
have been assigned to a rollback segment, which has four extents.
1 When the transactions commence, they begin writing to Extent 3 of the
rollback segment.
2 As the two transactions generate more rollback information, they
continue to write into Extent 3.
3 When Extent 3 is full, the transactions write to the next extent in the
ring, which is Extent 4. When transactions start writing to a new extent
as in this step, it is called a wrap.
4 When the last extent for the rollback segment (Extent 4) is full, the
transactions can use the first in the ring (Extent 1) if it is free or inactive.
An extent is only free or inactive if there are currently no active
transactions using the extent—that is, all transactions that wrote to the
extent have completed.
Note that more than one transaction can write to the same extent of a
rollback segment. Each rollback segment block contains information from
one and only one transaction.


......................................................................................................................................................
Oracle8: Database Administration
10-9


Lesson 10: Managing Rollback Segments
......................................................................................................................................................

Growth of Rollback Segments

AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA

AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA

AAAAAAAAAAAAA

1

2

4

3

AAAAAA
AAAAAA
AAAAAA
AAAAAA
AAAAAA

10-7

Active extent

AAAAAA
AAAAAA
AAAAAA
AAAAAA

AAAA
AAAAAAAAAAAAAAA AAAAAAAAAAAA
AAAA
AAAAAAAAAAAAAAA AAAAAAAAAAAA
AAAA

AAAAAAAAAAAAAAA AAAAAAAAAAAA
AAAA
AAAAAAAAAAAAAAA AAAAAAAAAAAA
AAAA
AAAAAAAAAAAAAAA AAAAAAAAAAAA
AAAA
AAAAAAAAAAAAAAA AAAAAAAAAAAA
AAAA
AAAAAAAAAAAAAAA AAAAAAAAAAAA
AAAA
AAAAAAAAAAAAAAA AAAAAAAAAAAA
AAAA
AAAAAAAAAAAAAAA AAAAAAAAAAAA
AAAA
AAAAAAAAAAAAAAA AAAAAAAAAAAA
AAAA
AAAAAAAAAAAAAAA AAAAAAAAAAAA
AAAA
AAAAAAAAAAAAAAA AAAAAAAAAAAA
AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAA AAAAAAAAAAAA
AAAA
AAAAAAAAAAAA
AAAAAAAAAAAA
AAAAAAAAAAAA
AAAAAAAAAAAA
AAAAAAAAAAAA
AAAAAAAAAAAA
AAAAAAAAAAAAAAAAAA AAAA
AAAA

AAAAAAAAAAAAAAAAAA AAAA
AAAA
AAAAAAAAAAAAAAAAAA AAAA
AAAA
AAAAAAAAAAAAAAAAAA AAAA
AAAA
AAAAAAAAAAAAAAAAAA AAAA
AAAA
AAAAAAAAAAAAAAAAAA AAAA
AAAA
AAAAAAAAAAAAAAAAAA AAAA
AAAA
AAAAAAAAAAAAAAAAAA AAAA
AAAA
AAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAA

2

1

5

3

4

Inactive extent


New extent

Copyright © Oracle Corporation, 1998. All rights reserved.

The pointer or the head of the rollback segment moves to the next extent
when the current extent is full. When the last extent that is currently
available is full, the pointer can only move back to the beginning of the first
extent if that extent is free. The pointer cannot skip over an extent and move
to the second or any other extent. If the first extent is being used, the
transaction will allocate an additional extent for the rollback segment. This
is called an extend. Similarly, if the head tries to move into an extent and that
extent is active, the rollback segment will allocate an additional extent. A
rollback segment may grow in this manner until it reaches the maximum
number of extents specified by the MAXEXTENTS parameter.

......................................................................................................................................................
10-10
Oracle8: Database Administration


Using Rollback Segments with Transactions
......................................................................................................................................................

Shrinkage of Rollback Segments
AAAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAA
AAAAAAAAAAAAAAA

AAAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA
AAAAAAAAAAA
AAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA
AAAAAAAAAAA
AAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA
AAAAAAAAAAA
AAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA
AAAAAAAAAAA
AAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAAA

AAAAAAAAAA
AAAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAAA
AAAAAAAAAAAAAAAA
AAAAAAAAAAA
AAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA
AAAAAAAAAAA
AAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAAA
AAAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA
AAAAAAAAAAA
AAAAAAAA
AA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AAA
AAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAA
AAAAAAAAAAAAA

1

3

Active extent
Inactive extent

Copyright © Oracle Corporation, 1998. All rights reserved.

OPTIMAL Parameter
The OPTIMAL parameter specifies the size in bytes that a rollback segment
must shrink to, if possible. Specifying OPTIMAL minimizes the waste of
space in a rollback segment. If the OPTIMAL parameter is specified, a
rollback segment can release space on completion of transactions that
caused the growth.
The deallocation of extents is not done as soon as transactions are
completed. The process of deallocating extents is performed only when the
head moves from one extent to the next. Extents are deallocated if:
• The current size of the rollback segment exceeds OPTIMAL

• There are contiguous inactive extents
The Oracle server tries to deallocate the size of the rollback segment until it
is equal to OPTIMAL but may have to stop short if the next extent to be
deallocated is in use.
The Oracle server always deallocates the oldest inactive extents as they are
least likely to be used for read-consistency.

......................................................................................................................................................
Oracle8: Database Administration
10-11


×