Purpose
The ALTER INDEX statement is used to change the name, parallelism, or tablespace of an existing index.
Privilege requirements
To execute the ALTER INDEX statement, the current user must have the ALTER ANY INDEX system privilege. For more information about OceanBase Database privileges, see Privilege classification in Oracle mode.
Syntax
ALTER INDEX [ schema.]index_name
{ RENAME TO new_name
| parallel_option
| TABLESPACE tablespace_name
};
parallel_option:
PARALLEL [COMP_EQ] integer
| NOPARALLEL
Parameters
| Parameter | Description |
|---|---|
| schema. | Specifies the schema where the index is located. If you omit schema., the index is created in your own schema. |
| index_name | Specifies the name of the index to be changed. |
| new_name | Specifies the new name of the index. |
| parallel_option | Specifies the parallelism for queries on the index.
|
| tablespace_name | Specifies the name of the tablespace where the index is stored. |
Examples
Assume that there is an index named index1 in the database. To rename it to index2, execute the following statement:
obclient> ALTER INDEX index1 RENAME TO index2;Assume that there is an index named index3 in the database, and the parallelism level for queries on this index is 3. To change the parallelism level to 1, execute the following statement:
obclient> ALTER INDEX index3 NOPARALLEL;
