Oracle8i SQL Reference
Release 2 (8.1.6)

A76989-01

Library

Product

Contents

Index

Prev Up Next

SQL Statements (continued), 3 of 5


storage_clause

Syntax


Purpose

To specify storage characteristics for any of the following schema objects:

Storage parameters affect both how long it takes to access data stored in the database and how efficiently space in the database is used. For a discussion of the effects of these parameters, see Oracle8i Designing and Tuning for Performance.

When you create a tablespace, you can specify values for the storage parameters. These values serve as default values for segments allocated in the tablespace.

When you alter a tablespace, you can change the values of storage parameters. The new values serve as default values only for subsequently allocated segments (or subsequently created objects).


Note:

The storage_clause is interpreted differently for locally managed tablespaces. At creation, Oracle ignores MAXEXTENTS and uses the remaining parameter values to calculate the initial size of the segment. For more information, see "CREATE TABLESPACE"


When you create a cluster, index, rollback segment, snapshot, snapshot log, table, or partition, you can specify values for the storage parameters for the segments allocated to these objects. If you omit any storage parameter, Oracle uses the value of that parameter specified for the tablespace.

When you alter a cluster, index, rollback segment, snapshot, snapshot log, table, or partition, you can change the values of storage parameters. The new values affect only future extent allocations.

Prerequisites

To change the value of a STORAGE parameter, you must have the privileges necessary to use the appropriate CREATE or ALTER statement.

Keywords and Parameters

INITIAL  

specifies in bytes the size of the object's first extent. Oracle allocates space for this extent when you create the schema object. Use K or M to specify this size in kilobytes or megabytes.

The default value is the size of 5 data blocks. The minimum value is the size of 2 data blocks for nonbitmapped segments or 3 data blocks for bitmapped segments, plus one data block for each free list group you specify (see "FREELIST GROUPS"). The maximum value depends on your operating system. Oracle rounds values up to the next multiple of the data block size for values less than 5 data blocks, and rounds up to the next multiple of 5 data blocks for values greater than 5 data blocks.

Restriction: You cannot specify INITIAL in an ALTER statement. 

NEXT 

specifies in bytes the size of the next extent to be allocated to the object. Use K or M to specify the size in kilobytes or megabytes. The default value is the size of 5 data blocks. The minimum value is the size of 1 data block. The maximum value depends on your operating system. Oracle rounds values up to the next multiple of the data block size for values less than 5 data blocks. For values greater than 5 data blocks, Oracle rounds up to a value that minimizes fragmentation, as described in Oracle8i Concepts.

If you change the value of the NEXT parameter (that is, if you specify it in an ALTER statement), the next allocated extent will have the specified size, regardless of the size of the most recently allocated extent and the value of the PCTINCREASE parameter.  

PCTINCREASE 

specifies the percent by which the third and subsequent extents grow over the preceding extent. The default value is 50, meaning that each subsequent extent is 50% larger than the preceding extent. The minimum value is 0, meaning all extents after the first are the same size. The maximum value depends on your operating system.  

 

Oracle rounds the calculated size of each new extent to the nearest multiple of the data block size.

If you change the value of the PCTINCREASE parameter (that is, if you specify it in an ALTER statement), Oracle calculates the size of the next extent using this new value and the size of the most recently allocated extent. 

 

Suggestion: If you wish to keep all extents the same size, you can prevent SMON from coalescing extents by setting the value of PCTINCREASE to 0. In general, Oracle Corporation recommends a setting of 0 as a way to minimize fragmentation and avoid the possibility of very large temporary segments during processing.  

 

Restriction: You cannot specify PCTINCREASE for rollback segments. Rollback segments always have a PCTINCREASE value of 0.  

MINEXTENTS 

specifies the total number of extents to allocate when the object is created. This parameter enables you to allocate a large amount of space when you create an object, even if the space available is not contiguous. The default and minimum value is 1, meaning that Oracle allocates only the initial extent, except for rollback segments, for which the default and minimum value is 2. The maximum value depends on your operating system.  

 

If the MINEXTENTS value is greater than 1, then Oracle calculates the size of subsequent extents based on the values of the INITIAL, NEXT, and PCTINCREASE parameters.

Restriction: You cannot specify MINEXTENTS in an ALTER statement. 

MAXEXTENTS 

specifies the total number of extents, including the first, that Oracle can allocate for the object. The minimum value is 1 (except for rollback segments, which always have a minimum value of 2). The default value depends on your data block size.  

 

UNLIMITED 

specifies that extents should be allocated automatically as needed. Oracle Corporation recommends this setting as a way to minimize fragmentation.

However, do not use this clause for rollback segments. Rogue transactions containing inserts, updates, or deletes that continue for a long time will continue to create new extents until a disk is full. 

 

 

Caution: A rollback segment that you create without specifying the storage_clause has the same storage parameters as the tablespace that the rollback segment is created in. Thus, if you create the tablespace with MAXEXTENTS UNLIMITED, then the rollback segment will also have the same default. 

FREELIST GROUPS 

specifies the number of groups of free lists for the database object you are creating. The default and minimum value for this parameter is 1. Oracle uses the instance number of Oracle Parallel Server instances to map each instance to one free list group.

Each free list group uses one database block. If you do not specify a large enough value for INITIAL to cover the minimum value plus one data block for each free list group, Oracle increases the value of INITIAL the necessary amount.

See Also: Oracle8i Parallel Server Concepts

 

Restriction: You can specify the FREELIST GROUPS parameter only in CREATE TABLE, CREATE CLUSTER, CREATE MATERIALIZED VIEW, CREATE MATERIALIZED VIEW LOG, and CREATE INDEX statements.  

FREELISTS 

for objects other than tablespaces, specifies the number of free lists for each of the free list groups for the table, partition, cluster, or index. The default and minimum value for this parameter is 1, meaning that each free list group contains one free list. The maximum value of this parameter depends on the data block size. If you specify a FREELISTS value that is too large, Oracle returns an error indicating the maximum value. 

 

Restriction: You can specify FREELISTS in the storage_clause of any statement except when creating or altering a tablespace or rollback segment. 

OPTIMAL 

is relevant only to rollback segments. It specifies an optimal size in bytes for a rollback segment. Use K or M to specify this size in kilobytes or megabytes. Oracle tries to maintain this size for the rollback segment by dynamically deallocating extents when their data is no longer needed for active transactions. Oracle deallocates as many extents as possible without reducing the total size of the rollback segment below the OPTIMAL value.  

 

NULL 

specifies no optimal size for the rollback segment, meaning that Oracle never deallocates the rollback segment's extents. This is the default behavior.  

 

The value of OPTIMAL cannot be less than the space initially allocated for the rollback segment specified by the MINEXTENTS, INITIAL, NEXT, and PCTINCREASE parameters. The maximum value depends on your operating system. Oracle rounds values up to the next multiple of the data block size.  

BUFFER_POOL 

defines a default buffer pool (cache) for a schema object. All blocks for the object are stored in the specified cache. If a buffer pool is defined for a partitioned table or index, then the partitions inherit the buffer pool from the table or index definition, unless overridden by a partition-level definition. 

 

Note: BUFFER_POOL is not a valid clause for creating or altering tablespaces or rollback segments.

See Also: Oracle8i Designing and Tuning for Performance for more information about using multiple buffer pools.  

 

KEEP 

retains the schema object in memory to avoid I/O operations.  

 

RECYCLE 

eliminates blocks from memory as soon as they are no longer needed, thus preventing an object from taking up unnecessary cache space. 

 

DEFAULT 

always exists for objects not assigned to KEEP or RECYCLE

Examples

The following statement creates a table and provides storage parameter values:

CREATE TABLE dept 
    (deptno     NUMBER(2), 
     dname      VARCHAR2(14), 
     loc        VARCHAR2(13) ) 
     STORAGE  ( INITIAL 100K  NEXT     50K 
                MINEXTENTS 1  MAXEXTENTS 50  PCTINCREASE 5); 

Oracle allocates space for the table based on the STORAGE parameter values as follows:

The following statement creates a rollback segment and provides storage parameter values:

CREATE ROLLBACK SEGMENT rsone 
    STORAGE ( INITIAL  10K  NEXT 10K 
              MINEXTENTS 2  MAXEXTENTS 25 
               OPTIMAL 50K ); 

Oracle allocates space for the rollback segment based on the STORAGE parameter values as follows:


Prev Up Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index