Oracle8i SQL Reference Release 2 (8.1.6) A76989-01 |
|
SQL Statements (continued), 6 of 17
storage_clause: See "storage_clause".
compression_clause::=
partitioning_clauses::=
modify_default_attributes_clause::=
rename_partition/ subpartition_clause::=
partition_description::=
To change or rebuild an existing index.
For information on creating an index, see "CREATE INDEX".
The index must be in your own schema or you must have ALTER
ANY
INDEX
system privilege.
Schema object privileges are granted on the parent index, not on individual index partitions or subpartitions.
You must have tablespace quota to modify, rebuild, or split an index partition or to modify or rebuild an index subpartition.
schema |
is the schema containing the index. If you omit schema, Oracle assumes the index is in your own schema. |
|
index |
is the name of the index to be altered. |
|
|
Restrictions:
|
|
deallocate_unused_clause |
explicitly deallocates unused space at the end of the index and makes the freed space available for other segments in the tablespace. Only unused space above the high water mark can be freed. If index is range-partitioned or hash-partitioned, Oracle deallocates unused space from each index partition. If index is a local index on a composite-partitioned table, Oracle deallocates unused space from each index subpartition. Restrictions:
See Also: "ALTER TABLE" for more information on this clause. |
|
|
|
specifies the number of bytes above the high water mark that the index will have after deallocation. If the number of remaining extents are less than |
|
See Also: "ALTER TABLE" for a complete description of this clause. |
|
allocate_extent_clause |
explicitly allocates a new extent for the index. For a local index on a hash-partitioned table, Oracle allocates a new extent for each partition of the index. Restriction: You cannot specify this clause for an index on a temporary table or for a range-partitioned or composite-partitioned index. |
|
|
|
specifies the size of the extent in bytes. Use K or M to specify the extent size in kilobytes or megabytes. If you omit |
|
|
specifies one of the datafiles in the index's tablespace to contain the new extent. If you omit |
|
|
makes the new extent available to the specified instance. An instance is identified by the value of its initialization parameter |
|
Explicitly allocating an extent with this clause does not change the values of the |
|
parallel_clause |
changes the default degree of parallelism for queries and DML on the index. For additional information, see the Notes to the parallel_clause of "CREATE TABLE". |
|
|
|
specifies serial execution. This is the default. |
|
|
causes Oracle to select a degree of parallelism equal to the number of CPUs available on all participating instances multiplied by the value of the |
|
|
specifies the degree of parallelism, which is the number of parallel threads used in the parallel operation. Each parallel thread may use one or two parallel execution processes. Normally Oracle calculates the optimum degree of parallelism, so it is not necessary for you to specify integer. |
|
Restriction: You cannot specify this clause for an index on a temporary table. |
|
physical_attributes_clause |
lets you change the values of parameters for a nonpartitioned index, all partitions and subpartitions of a partitioned index, a specified partition, or all subpartitions of a specified partition. See these parameters in "CREATE TABLE". Restrictions:
|
|
|
storage_clause |
changes the storage parameters for a nonpartitioned index, index partition, or all partitions of a partitioned index, or default values of these parameters for a partitioned index. See the "storage_clause". |
|
|
|
|
In |
|
|
If the database is run in |
|
|
An index segment can have logging attributes different from those of the base table and different from those of other index segments for the same base table. Restriction: You cannot specify this clause for an index on a temporary table. |
|
|
See Also: Oracle8i Concepts and the Oracle8i Parallel Server Concepts for more information about |
|
|
These keywords are deprecated and have been replaced with |
|
|
|
|
rebuild_clause |
re-creates an existing index or one of its partitions or subpartitions. For a function-based index, this clause also enables the index. If the function on which the index is based does not exist, the rebuild statement will fail. |
|
|
Restrictions:
|
|
|
|
rebuilds one partition of an index. You can also use this clause to move an index partition to another tablespace or to change a create-time physical attribute.
Restriction: You cannot specify this clause for a local index on a composite-partitioned table. Instead, use the See Also: Oracle8i Administrator's Guide for more information about partition maintenance operations. |
|
|
rebuilds one subpartition of an index. You can also use this clause to move an index subpartition to another tablespace. If you do not specify
Restrictions: The only parameters you can specify for a subpartition are |
|
|
specifies whether the bytes of the index block are stored in reverse order.
|
|
|
Restrictions: |
|
|
specifies the tablespace where the rebuilt index, index partition, or index subpartition will be stored. The default is the default tablespace where the index or partition resided before you rebuilt it. |
|
|
enables key compression, which eliminates repeated occurrence of key column values. Use integer to specify the prefix length (number of prefix columns to compress).
Oracle compresses only nonpartitioned indexes that are nonunique or unique indexes of at least two columns.
Restriction: You cannot specify |
|
|
disables key compression. This is the default. |
|
|
specifies that DML operations on the table or partition are allowed during rebuilding of the index.
Restriction: Parallel DML is not supported during online index building. If you specify |
|
|
enables you to collect statistics at relatively little cost during the rebuilding of an index. These statistics are stored in the data dictionary for ongoing use by the optimizer in choosing a plan of execution for SQL statements. The types of statistics collected depend on the type of index you are rebuilding. |
|
|
Note: If you create an index using another index (instead of a table), the original index might not provide adequate statistical information. Therefore, Oracle generally uses the base table to compute the statistics, which will improve the statistics but may negatively affect performance. |
|
. |
Additional methods of collecting statistics are available in PL/SQL packages and procedures. See Oracle8i Supplied PL/SQL Packages Reference. |
|
|
specifies whether |
|
applies only to domain indexes. This clause specifies the parameter string for altering the index (or, in the rebuild_clause, rebuilding the index). The maximum length of the parameter string is 1000 characters. This string is passed uninterpreted to the appropriate indextype routine. See Also:
|
|
|
Restrictions: |
|
|
applies only to a function-based index that has been disabled because a user-defined function used by the index was dropped or replaced. This clause enables such an index if
Restriction: You cannot specify any other clauses of |
|
|
applies only to a function-based index. This clause enables you to disable the use of a function-based index. You might want to do so, for example, while working on the body of the function. Afterward you can either rebuild the index or specify another |
|
|
marks the index or index partition(s) or index subpartition(s) Restriction: You cannot specify this clause for an index on a temporary table. |
|
|
renames index to new_index_name. The new_index_name is a single identifier and does not include the schema name. |
|
|
instructs Oracle to merge the contents of index blocks where possible to free blocks for reuse. Restriction: You cannot specify this clause for an index on a temporary table. See Also: Oracle8i Administrator's Guide for more information on space management and coalescing indexes. |
|
partitioning_clauses: The remainder of the clauses of the |
||
|
Restrictions:
|
|
modify_default_attributes_clause |
specifies new values for the default attributes of a partitioned index.
Restriction: The only attribute you can specify for an index on a hash-partitioned or composite-partitioned table is |
|
|
|
specifies the default tablespace for new partitions of an index or subpartitions of an index partition. |
|
|
specifies the default logging attribute of a partitioned index or an index partition. |
|
|
specifies the default attributes for the subpartitions of a partition of a local index on a composite-partitioned table. |
modify_partition_clause |
modifies the real physical attributes, logging attribute, or storage characteristics of index partition partition or its subpartitions. Restriction: You cannot specify the physical_attributes_clause for an index on a hash-partitioned table. |
|
|
Note: If the index is a local index on a composite-partitioned table, the changes you specify here will override any attributes specified earlier for the subpartitions of index, as well as establish default values of attributes for future subpartitions of that partition. To change the default attributes of the partition without overriding the attributes of subpartitions, use |
|
rename_partition/ subpartition_clause |
renames index partition or subpartition to new_name. |
|
drop_partition_clause |
removes a partition and the data in it from a partitioned global index. When you drop a partition of a global index, Oracle marks the index's next partition |
|
split_partition_clause |
splits a partition of a global partitioned index into two partitions, adding a new partition to the index.
Splitting a partition marked |
|
|
Splitting a usable partition results in two partitions populated with index data. Both new partitions are usable. |
|
|
|
specifies the new noninclusive upper bound for split_partition_1. The value_list must evaluate to less than the presplit partition bound for partition_name_old and greater than the partition bound for the next lowest partition (if there is one). |
|
|
describes the two partitions resulting from the split. |
partition_description |
specifies (optionally) the name and physical attributes of each of two partitions resulting from a split. |
|
modify_subpartition_clause |
lets you mark |
This statement alters SCOTT
's CUSTOMER
index so that future data blocks within this index use 5 initial transaction entries and an incremental extent of 100 kilobytes:
ALTER INDEX scott.customer INITRANS 5 STORAGE (NEXT 100K);
If the SCOTT.CUSTOMER
index is partitioned, this statement also alters the default attributes of future partitions of the index. New partitions added in the future will use 5 initial transaction entries and an incremental extent of 100K.
The following statement drops index partition IX_ANTARTICA
:
ALTER INDEX sales_area_ix DROP PARTITION ix_antarctica;
This statement alters the default attributes of local partitioned index SALES_IX3
. New partitions added in the future will use 5 initial transaction entries and an incremental extent of 100K:
ALTER INDEX sales_ix3 MODIFY DEFAULT ATTRIBUTES INITRANS 5 STORAGE ( NEXT 100K );
The following statement marks the IDX_ACCTNO
index as UNUSABLE
:
ALTER INDEX idx_acctno UNUSABLE;
The following statement marks partition IDX_FEB96
of index IDX_ACCTNO
as UNUSABLE
:
ALTER INDEX idx_acctno MODIFY PARTITION idx_feb96 UNUSABLE;
The following statement changes the maximum number of extents for partition BRIX_NY
and changes the logging attribute:
ALTER INDEX branch_ix MODIFY PARTITION brix_ny STORAGE( MAXEXTENTS 30 ) LOGGING;
The following statement sets the parallel attributes for index ARTIST_IX
so that scans on the index will not be parallelized:
ALTER INDEX artist_ix NOPARALLEL;
The following statement rebuilds partition P063
in index ARTIST_IX
. The rebuilding of the index partition will not be logged:
ALTER INDEX artist_ix REBUILD PARTITION p063 NOLOGGING;
The following statement renames an index:
ALTER INDEX emp_ix1 RENAME TO employee_ix1;
The following statement renames an index partition:
ALTER INDEX employee_ix1 RENAME PARTITION emp_ix1_p3 TO employee_ix1_p3;
The following statement splits partition PARTNUM_IX_P6
in partitioned index PARTNUM_IX
into PARTNUM_IX_P5
and PARTNUM_IX_P6
:
ALTER INDEX partnum_ix SPLIT PARTITION partnum_ix_p6 AT ( 5001 ) INTO ( PARTITION partnum_ix_p5 TABLESPACE ts017 LOGGING, PARTITION partnum_ix_p6 TABLESPACE ts004 );
The second partition retains the name of the old partition.
The following statement rebuilds index EMP_IX so that the bytes of the index block are stored in REVERSE
order:
ALTER INDEX emp_ix REBUILD REVERSE;
The following statement collects statistics on the nonpartitioned EMP_INDX
index:
ALTER INDEX emp_indx REBUILD COMPUTE STATISTICS;
The type of statistics collected depends on the type of index you are rebuilding.
The following statement causes the index to be rebuilt from the existing index by using parallel parallel execution processes to scan the old and to build the new index:
ALTER INDEX emp_idx REBUILD PARALLEL;
|
Copyright © 1999 Oracle Corporation. All Rights Reserved. |
|