Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Semestr2 / 1 - Oracle / Oracle selected docs / SQL reference.pdf
Скачиваний:
24
Добавлен:
12.05.2015
Размер:
11.92 Mб
Скачать

ALTER ROLLBACK SEGMENT

ALTER ROLLBACK SEGMENT

Purpose

Use the ALTER ROLLBACK SEGMENT statement to bring a rollback segment online or offline, change its storage characteristics, or shrink it to an optimal or specified size.

The information in this section assumes that your database is running in rollback undo mode (the UNDO_MANAGEMENT initialization parameter is set to MANUAL or not set at all).

If your database is running in Automatic Undo Management mode (the UNDO_ MANAGEMENT initialization parameter is set to AUTO), then user-created rollback segments are irrelevant. In this case, Oracle returns an error in response to any

CREATE ROLLBACK SEGMENT or ALTER ROLLBACK SEGMENT statement. To suppress these errors, set the UNDO_SUPPRESS_ERRORS parameter to TRUE.

See Also:

CREATE ROLLBACK SEGMENT on page 14-82 for information on creating a rollback segment

Oracle9i Database Reference for information on the UNDO_ MANAGEMENT and UNDO_SUPPRESS_ERRORS parameters

Prerequisites

You must have ALTER ROLLBACK SEGMENT system privilege.

Syntax

alter_rollback_segment::=

ONLINE

OFFLINE storage_clause

ALTER

ROLLBACK

SEGMENT

rollback_segment

;

 

 

 

 

K

 

 

 

 

M

 

 

 

TO

integer

 

 

 

SHRINK

 

(storage_clause on page 7-56)

9-136 Oracle9i SQL Reference

ALTER ROLLBACK SEGMENT

Semantics

rollback_segment

Specify the name of an existing rollback segment.

ONLINE

Specify ONLINE to bring the rollback segment online. When you create a rollback segment, it is initially offline and not available for transactions. This clause brings the rollback segment online, making it available for transactions by your instance.

You can also bring a rollback segment online when you start your instance with the initialization parameter ROLLBACK_SEGMENTS.

See Also: "Bringing a Rollback Segment Online: Example" on page 9-138

OFFLINE

Specify OFFLINE to take the rollback segment offline.

If the rollback segment does not contain any information needed to roll back an active transaction, Oracle takes it offline immediately.

If the rollback segment does contain information for active transactions, Oracle makes the rollback segment unavailable for future transactions and takes it offline after all the active transactions are committed or rolled back.

Once the rollback segment is offline, it can be brought online by any instance.

To see whether a rollback segment is online or offline, query the data dictionary view DBA_ROLLBACK_SEGS. Online rollback segments have a STATUS value of IN_ USE. Offline rollback segments have a STATUS value of AVAILABLE.

Restriction on Taking Rollback Segments Offline You cannot take the SYSTEM rollback segment offline.

See Also: Oracle9i Database Administrator’s Guide for more information on making rollback segments available and unavailable

storage_clause

Use the storage_clause to change the rollback segment’s storage characteristics.

SQL Statements: ALTER CLUSTER to ALTER SEQUENCE 9-137

ALTER ROLLBACK SEGMENT

Restriction on Rollback Segment Storage You cannot change the values of the

INITIAL and MINEXTENTS for an existing rollback segment.

See Also: storage_clause on page 7-56 for syntax and additional information "Changing Rollback Segment Storage: Example" on page 9-139

SHRINK Clause

Specify SHRINK if you want Oracle to attempt to shrink the rollback segment to an optimal or specified size. The success and amount of shrinkage depend on the available free space in the rollback segment and how active transactions are holding space in the rollback segment.

The value of integer is in bytes, unless you specify K or M for kilobytes or megabytes.

If you do not specify TO integer, then the size defaults to the OPTIMAL value of the storage_clause of the CREATE ROLLBACK SEGMENT statement that created the rollback segment. If OPTIMAL was not specified, then the size defaults to the

MINEXTENTS value of the storage_clause of the CREATE ROLLBACK SEGMENT statement.

Regardless of whether you specify TO integer:

The value to which Oracle shrinks the rollback segment is valid for the execution of the statement. Thereafter, the size reverts to the OPTIMAL value of the CREATE ROLLBACK SEGMENT statement.

The rollback segment cannot shrink to less than two extents.

To determine the actual size of a rollback segment after attempting to shrink it, query the BYTES, BLOCKS, and EXTENTS columns of the DBA_SEGMENTS view.

Restriction on Shrinking Rollback Segments In a Real Application Clusters environment, you can shrink only rollback segments that are online to your instance.

See Also: "Resizing a Rollback Segment: Example" on page 9-139

Examples

Bringing a Rollback Segment Online: Example This statement brings the rollback segment rbs_one online:

9-138 Oracle9i SQL Reference

ALTER ROLLBACK SEGMENT

ALTER ROLLBACK SEGMENT rbs_one ONLINE;

Changing Rollback Segment Storage: Example This statement changes the

STORAGE parameters for rbs_one:

ALTER ROLLBACK SEGMENT rbs_one

STORAGE (NEXT 1000 MAXEXTENTS 20);

Resizing a Rollback Segment: Example This statement attempts to resize a rollback segment to 100 megabytes:

ALTER ROLLBACK SEGMENT rbs_one

SHRINK TO 100 M;

SQL Statements: ALTER CLUSTER to ALTER SEQUENCE 9-139

Соседние файлы в папке Oracle selected docs