5.4 Re-creating an Index
This section describes the procedures for re-creating an index. During the re-creation process, you can query the index normally.
5.4.1 Re-creating a Global Index
Oracle Text provides RECREATE_INDEX_ONLINE
to re-create a CONTEXT
index with new preferences, while preserving inserts, updates, and deletes on the base table. You can use RECREATE_INDEX_ONLINE
in a single-step procedure to re-create a CONTEXT
index online for global indexes. Because the new index is created alongside the existing index, this operation requires storage that is roughly equal to the size of the existing index. Also, because the RECREATE_INDEX_ONLINE
operation is performed online, you can perform inserts, updates, and deletes on the base table during the operation. All insert, update, and delete operations that occur during the re-creation process are logged into an online pending queue.
-
After the re-creation operation is complete, new information may not be immediately reflected. As with creating an index online, you should synchronize the index after the re-creation operation is complete to bring it fully up-to-date.
-
Synchronizations issued against the index during the re-creation operation are processed against the existing data. Synchronizations are blocked when queries return errors.
-
Optimize commands issued against the index during the re-creation operation return immediately without error and without processing.
-
During
RECREATE_INDEX_ONLINE,
you can query the index normally most of the time. Queries return results based on the existing index and policy until after the final swap. Also, if you issue insert, update, and delete operations and synchronize them, then you will be able to see the new rows when you query the existing index.
Note:
Transactional queries are not supported with RECREATE_INDEX_ONLINE.
Re-creating a Global Index with Time Limit for Synch
You can control index re-creation to set a time limit for SYNC_INDEX
during nonbusiness hours and incrementally re-create the index. Use the CREATE_SHADOW_INDEX
procedure with POPULATE_PENDING
and maxtime.
Re-creating a Global Index with Scheduled Swap
With CTX_DDL.EXCHANGE_SHADOW_INDEX,
you can perform index re-creation during nonbusiness hours when query failures and DML blocking can be tolerated.
See Also:
-
Oracle Text Reference to learn more about the
RECREATE_INDEX_ONLINE
procedure -
Oracle Text Reference for information and examples for
CREATE_SHADOW_INDEX
-
Oracle Text Reference for information and examples for
CTX_DDL.EXCHANGE_SHADOW_INDEX
5.4.2 Re-creating a Local Partitioned Index
If the index is locally partitioned, you cannot re-create the index in one step. You must first create a shadow policy, and then run the RECREATE_INDEX_ONLINE
procedure for every partition. You can specify SWAP
or NOSWAP,
which indicates whether re-creating the index for the partition swaps the index partition data and index partition metadata.
You can also use this procedure to update the metadata (for example, the storage preference) of each partition when you specify NOPOPULATE
in the parameter string. This keyword is useful for incremental building of a shadow index through time-limited synchronization. If you specify NOPOPULATE,
then NOSWAP
is silently enforced.
-
When all partitions use
NOSWAP,
the storage requirement is approximately equal to the size of the existing index. During re-creation of the index partition, because no swapping is performed, queries on the partition are processed normally. Queries spanning multiple partitions return consistent results across partitions until the swapping stage is reached. -
When the partitions are rebuilt with
SWAP,
the storage requirement for the operation is equal to the size of the existing index partition. Because index partition data and metadata are swapped after re-creation, queries spanning multiple partitions do not return consistent results from partition to partition, but they will always be correct with respect to each index partition. -
If you specify
SWAP,
then insert, update, and delete operations and synchronization on the partition are blocked during the swap process.
Re-creating a Local Index with All-at-Once Swap
You can re-create a local partitioned index online to create or change preferences. The swapping of the index and partition metadata occurs at the end of the process. Queries spanning multiple partitions return consistent results across partitions when the re-creation is in process, except at the end when EXCHANGE_SHADOW_INDEX
is running.
Scheduling Local Index Re-creation with All-at-Once Swap
With RECREATE_INDEX_ONLINE
of the CTX.DDL
package, you can incrementally re-create a local partitioned index, where partitions are all swapped at the end.
Re-creating a Local Index with Per-Partition Swap
Instead of swapping all partitions at once, you can re-create the index online with new preferences, and each partition is swapped as it is completed. Queries across all partitions may return inconsistent results during this process. This procedure uses CREATE_SHADOW_INDEX
with RECREATE_INDEX_ONLINE.
See Also:
Oracle Text Reference for complete information about RECREATE_INDEX_ONLINE