Oracle8i SQL Reference Release 3 (8.1.7) Part Number A85397-01 |
|
SQL Statements:
ALTER CLUSTER to ALTER SYSTEM, 6 of 19
Use the ALTER
INDEX
statement to change or rebuild an existing 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.
storage_clause
: See storage_clause.
compression_clause
::=
modify_default_attributes_clause::=
rename_partition / subpartition_clause::=
index_partition_description
::=
schema
Specify the schema containing the index. If you omit schema
, Oracle assumes the index is in your own schema.
index
Specify the name of the index to be altered.
Restrictions:
index
is a domain index, you can specify only the PARAMETERS
clause, the RENAME
clause, or the rebuild_clause
(with or without the PARAMETERS
clause). No other clauses are valid.
LOADING
or FAILED
. If an index is marked FAILED
, the only clause you can specify is REBUILD
.
deallocate_unused_clause
The deallocate_unused_clause
lets you explicitly deallocate 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:
rebuild_clause
.
|
The
|
allocate_extent_clause
The allocate_extent_clause
lets you explicitly allocate 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.
parallel_clause
Use the PARALLEL
clause to change the default degree of parallelism for queries and DML on the index.
Restriction: You cannot specify this clause for an index on a temporary table.
physical_attributes_clause
Use the physical_attributes_clause
to 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.
Restrictions:
PCTUSED
parameter when altering an index.
PCTFREE
parameter for the index as a whole (ALTER
INDEX
) or for a partition (ALTER
INDEX
... MODIFY
PARTITION
). You can specify PCTFREE
in all other forms of the ALTER
INDEX
statement.
|
Use the |
|
|
Use |
|
|
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.
|
|
|
These keywords are deprecated and have been replaced with |
|
|
|
rebuild_clause
Use the rebuild_clause
to re-create 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:
deallocate_unused_clause
in this statement.
PCTFREE
parameter for the index as a whole (ALTER
INDEX
) or for a partition (ALTER
INDEX
... MODIFY
PARTITION
). You can specify PCTFREE
in all other forms of the ALTER
INDEX
statement.
|
Use the
Restriction: You cannot specify this clause for a local index on a composite-partitioned table. Instead, use the
|
|
|
Use the
Restrictions: The only parameters you can specify for a subpartition are |
|
|
Indicate whether the bytes of the index block are stored in reverse order:
|
|
|
Restrictions: |
|
|
Specify 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. |
|
|
Specify
Oracle compresses only nonpartitioned indexes that are nonunique or unique indexes of at least two columns.
Restriction: You cannot specify |
|
|
Specify |
|
|
Specify Restrictions: |
|
|
Specify The types of statistics collected depend on the type of index you are rebuilding. |
|
|
||
|
Additional methods of collecting statistics are available in PL/SQL packages and procedures. |
|
|
Specify whether the |
PARAMETERS
The PARAMETERS
clause 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.
Restrictions:
UNUSABLE
.
See Also:
ENABLE
ENABLE
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 these conditions are true:
DETERMINISTIC
Restriction: You cannot specify any other clauses of ALTER
INDEX
in the same statement with ENABLE
.
DISABLE
DISABLE
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 ALTER
INDEX
statement with the ENABLE
keyword.
UNUSABLE
Specify UNUSABLE
to mark the index or index partition(s) or index subpartition(s) UNUSABLE
. An unusable index must be rebuilt, or dropped and re-created, before it can be used. While one partition is marked UNUSABLE
, the other partitions of the index are still valid. You can execute statements that require the index if the statements do not access the unusable partition. You can also split or rename the unusable partition before rebuilding it.
Restriction: You cannot specify this clause for an index on a temporary table.
RENAME
TO
Use the RENAME
clause to rename index
to new_index_name
. The new_index_name
is a single identifier and does not include the schema name.
COALESCE
Specify COALESCE
to instruct 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 partitioning clauses of the ALTER
INDEX
statement are valid only for partitioned indexes.
Restrictions:
ALTER
INDEX
statement (except RENAME
and REBUILD
), but you cannot combine partition operations with other partition operations or with operations on the base index.
modify_default_attributes_clause
Specify 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 TABLESPACE
.
modify_partition_clause
Use the modify_partition_clause
to modify 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.
rename_partition
/ subpartition_clause
Use the rename_partition
or rename_subpartition
to rename index partition or subpartition to new_name
.
drop_partition_clause
Use the drop_partition_clause
to remove 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 UNUSABLE
. You cannot drop the highest partition of a global index.
split_partition_clause
Use the split_partition_clause
to split a partition of a global partitioned index into two partitions, adding a new partition to the index.
Splitting a partition marked UNUSABLE
results in two partitions, both marked UNUSABLE
. You must rebuild the partitions before you can use them.
Splitting a usable partition results in two partitions populated with index data. Both new partitions are usable.
modify_subpartition_clause
Use the modify_subpartition_clause
to mark UNUSABLE
or allocate or deallocate storage for a subpartition of a local index on a composite-partitioned table. All other attributes of such a subpartition are inherited from partition-level default attributes.
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_antarctica
:
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 odx_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;
MAXEXTENTS
Example
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.
PARALLEL
Example
The following statement causes the index to be rebuilt from the existing index by using parallel execution processes to scan the old and to build the new index:
ALTER INDEX emp_idx REBUILD PARALLEL;
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|