|Oracle9i SQL Reference
Release 2 (9.2)
Part Number A96540-01
Common SQL DDL Clauses , 9 of 9
storage_clause lets you specify how Oracle should store a database object. Storage parameters affect both how long it takes to access data stored in the database and how efficiently space in the database is used.
Oracle9i Database Performance Tuning Guide and Reference for a discussion of the effects of the storage parameters
When you create a cluster, index, rollback segment, materialized view, materialized view 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, then Oracle uses the value of that parameter specified for the tablespace in which the object resides.
When you alter a cluster, index, rollback segment, materialized view, materialized view log, table, or partition, you can change the values of storage parameters. The new values affect only future extent allocations.
storage_clause is part of the
physical_attributes_clause, so you can specify this clause in any of the statements where you can specify the physical attributes clause (see
In addition, you can specify the
storage_clause in the following statements:
CLUSTER: to set or change the storage characteristics of the cluster and all tables in the cluster (see CREATE CLUSTER and ALTER CLUSTER).
INDEX: to set or change the storage characteristics of an index or index partition (see CREATE INDEX and ALTER INDEX).
VIEW: to set or change the storage characteristics of a materialized view, one of its partitions, or the index Oracle generates to maintain the materialized view (see CREATE MATERIALIZED VIEW and ALTER MATERIALIZED VIEW).
LOG: to set or change the storage characteristics of the materialized view log (see CREATE MATERIALIZED VIEW LOG and ALTER MATERIALIZED VIEW LOG).
SEGMENT: to set or change the storage attributes of a rollback segment (see CREATE ROLLBACK SEGMENT and ALTER ROLLBACK SEGMENT).
TABLE: to set the storage characteristics of a LOB data segment of the table or one of its partitions or subpartitions (see CREATE TABLE and ALTER TABLE).
TABLESPACE: to set or change the default storage characteristics for objects created in the tablespace (see CREATE TABLESPACE and ALTER TABLESPACE).
constraints: to specify storage for the index (and its partitions, if it is a partitioned index) used to enforce the constraint (see
To change the value of a
STORAGE parameter, you must have the privileges necessary to use the appropriate
This section describes the parameters of the
storage_clause. For additional information, refer to the SQL statement in which you set or reset these parameters for a particular database object.
The storage_clause is interpreted differently for locally managed tablespaces. At creation, Oracle ignores
Specify in bytes the size of the object's first extent. Oracle allocates space for this extent when you create the schema object. Use
M to specify this size in kilobytes or megabytes.
The default value is the size of 5 data blocks. In tablespaces with manual segment-space management, the minimum value is the size of 2 data blocks plus one data block for each free list group you specify. In tablespaces with automatic segment-space management, the minimum value is 5 data blocks. The maximum value depends on your operating system.
In dictionary-managed tablespaces, if
EXTENT was specified for the tablespace when it was created, then Oracle rounds the value of
INITIAL up to the specified
EXTENT size if necessary. If
EXTENT was not specified, then Oracle rounds the
INITIAL extent size for segments created in that tablespace up to the minimum value (see preceding paragraph), or to multiples of 5 blocks if the requested size is greater than 5 blocks.
In locally managed tablespaces, Oracle uses the value of
INITIAL in conjunction with the size of extents specified for the tablespace to determine the object's first extent. For example, in a uniform locally managed tablespace with 5
M extents, if you specify an
INITIAL value of 1
M, then Oracle creates five 1
Restriction on INITIAL: You cannot specify
INITIAL in an
FREELIST GROUPS for information on freelist groups
Specify in bytes the size of the next extent to be allocated to the object. Use
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 Oracle9i Database Administrator's Guide.
If you change the value of the
NEXT parameter (that is, if you specify it in an
ALTER statement), then the next allocated extent will have the specified size, regardless of the size of the most recently allocated extent and the value of the
Oracle9i Database Administrator's Guide for information on how Oracle minimizes fragmentation
Specify 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), then Oracle calculates the size of the next extent using this new value and the size of the most recently allocated extent.
If you wish to keep all extents the same size, you can prevent
Restriction on PCTINCREASE: You cannot specify
PCTINCREASE for rollback segments. Rollback segments always have a
PCTINCREASE value of 0.
Specify the total number of extents to allocate when the object is created. This parameter lets you 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.
MINEXTENTS value is greater than 1, then Oracle calculates the size of subsequent extents based on the values of the
PCTINCREASE storage parameters.
When changing the value of
MINEXTENTS (that is, in an
ALTER statement), you can reduce the value from its current value, but you cannot increase it. Resetting
MINEXTENTS to a smaller value might be useful, for example, before a
STORAGE statement, if you want to ensure that the segment will maintain a minimum number of extents after the
Restriction on MINEXTENTS: You cannot change the value of
MINEXTENTS for an object that resides in a locally managed tablespace.
Specify 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.
Restriction on MAXEXTENTS: You cannot change the value of
MAXEXTENTS for an object that resides in a locally managed tablespace.
UNLIMITED if you want extents to 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.
A rollback segment that you create without specifying the
Specify 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 Real Application Clusters instances to map each instance to one free list group.
Each free list group uses one database block. Therefore:
INITIALto cover the minimum value plus one data block for each free list group, then Oracle increases the value of
INITIALthe necessary amount.
Oracle ignores a setting of
Restriction on FREELIST GROUPS: You can specify the
GROUPS parameter only in
For objects other than tablespaces, specify 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, then Oracle returns an error indicating the maximum value.
Oracle ignores a setting of
Restriction on FREELISTS: You can specify
FREELISTS in the
storage_clause of any statement except when creating or altering a tablespace or rollback segment.
The OPTIMAL keyword is relevant only to rollback segments. It specifies an optimal size in bytes for a rollback segment. Use
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
The value of
OPTIMAL cannot be less than the space initially allocated by the
PCTINCREASE parameters. The maximum value depends on your operating system. Oracle rounds values up to the next multiple of the data block size.
NULL for no optimal size for the rollback segment, meaning that Oracle never deallocates the rollback segment's extents. This is the default behavior.
BUFFER_POOL clause lets you specify a default buffer pool (cache) for a schema object. All blocks for the object are stored in the specified cache.
Restrictions on BUFFER_POOL:
KEEP to put blocks from the segment into the
KEEP buffer pool. Maintaining an appropriately sized
KEEP buffer pool lets Oracle retain the schema object in memory to avoid I/O operations.
KEEP takes precedence over any
NOCACHE clause you specify for a table, cluster, materialized view, or materialized view log.
RECYCLE to put blocks from the segment into the
RECYCLE pool. An appropriately sized
RECYCLE pool reduces the number of objects whose default pool is the
RECYCLE pool from taking up unnecessary cache space.
DEFAULT to indicate the default buffer pool. This is the default for objects not assigned to
Oracle9i Database Performance Tuning Guide and Reference for more information about using multiple buffer pools
The following statement creates a table and provides storage parameter values:
CREATE TABLE divisions (div_no NUMBER(2), div_name VARCHAR2(14), location 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:
MINEXTENTSvalue is 1, so Oracle allocates 1 extent for the table upon creation.
INITIALvalue is 100K, so the first extent's size is 100 kilobytes.
NEXTvalue is 50K, so the second extent's size would be 50 kilobytes.
PCTINCREASEvalue is 5, so the calculated size of the third extent is 5% larger than the second extent, or 52.5 kilobytes. If the data block size is 2 kilobytes, then Oracle rounds this value to 52 kilobytes.
If the table data continues to grow, then Oracle allocates more extents, each 5% larger than the previous one.
MAXEXTENTSvalue is 50, so Oracle can allocate as many as 50 extents for the table.
The following statement creates a rollback segment and provides storage parameter values:
CREATE ROLLBACK SEGMENT rs_store 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:
MINEXTENTSvalue is 2, so Oracle allocates 2 extents for the rollback segment upon creation.
INITIALvalue is 10K, so the first extent's size is 10 kilobytes.
NEXTvalue is 10K, so the second extent's size is 10 kilobytes.
PCTINCREASEvalue for rollback segments is always 0, so the third and subsequent extents are the same size as the second extent, 10 kilobytes.
MAXEXTENTSvalue is 25, so Oracle can allocate as many as 25 extents for the rollback segment.
OPTIMALvalue is 50K, so Oracle deallocates extents if the rollback segment exceeds 50 kilobytes. Oracle deallocates only extents that contain data for transactions that are no longer active.