Synchronizing the Index

Synchronizing the index involves processing all pending updates and inserts to the base table. You can do this in PL/SQL with the CTX_DDL.SYNC_INDEX procedure. The following sections describe how you can control the duration and locking behavior for synchronizing an index:

Synchronizing the Index With SYNC_INDEX

The following example synchronizes the index with 2 megabytes of memory:

begin
ctx_ddl.sync_index('myindex', '2M');
end;

See Also:

Oracle Text Reference to learn more about the CTX_DDL.SYNC_INDEX statement syntax

Maxtime Parameter for SYNC_INDEX

The sync_index procedure includes a maxtime parameter that, like optimize_index, indicates a suggested time limit in minutes for the operation. The sync_index will process as many documents in the queue as possible within the given time limit.

  • NULL maxtime is equivalent to CTX_DDL.MAXTIME_UNLIMITED.

  • The time limit is approximate. The actual time taken may be somewhat less than, or greater than what you specify.

  • There is no change to the ALTER INDEX... sync command, which is deprecated.

  • The maxtime parameter is ignored when sync_index is invoked without an index name.

  • The maxtime parameter cannot be communicated for automatic synchronizations (for example, sync on commit or sync every).

Locking Parameter for SYNC_INDEX

The locking parameter of sync_index enables you to configure how the synchronization deals with the scenario where another sync is already running on the index.

  • The locking parameter is ignored when sync_index is invoked without an index name.

  • The locking parameter cannot be communicated for automatic syncs (i.e. sync on commit/sync every).

  • When locking mode is LOCK_WAIT, in the event of not being able to get a lock, it will wait forever and ignore the maxtime setting.

The options are as follows:


Option Description

CTX_DDL.LOCK_WAIT

If another sync is running, wait until the running sync is complete, then begin new sync.

CTX_DDL.LOCK_NOWAIT

If another sync is running, immediately return without error.

CTX_DDL.LOCK_NOWAIT_ERROR

If another sync is running, immediately raise an error (DRG-51313: timeout while waiting for DML or optimize lock).