11.07.2015 Views

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

490 CHAPTER <strong>11</strong> ■ APPLICATION DEVELOPMENTLet’s examine how asynchronous (ASYNC) maintenance can be implemented. The ASYNCoption is part of the PARAMETERS clause of the CREATE INDEX or ALTER INDEX syntax. The ASYNCoption has several possible values:• (ALWAYS)• (ON COMMIT)• (EVERY "repeat_interval")• (MANUAL)• (STALE)The default value for the ASYNC option is ALWAYS. The ON COMMIT option can be compared tothe two-phased commit. The commit command will not return the “Commit Complete” statusmessage until the synchronization is complete. You may encounter a small delay in responsesince the synchronization is performed as a separate transaction. The EVERY option withrepeat_interval is the same as the repeat_interval specification for DBMS_SCHEDULER. You canhave complete control over when to refresh the XMLIndex. One thing to note is that to use theEVERY option, you must have the CREATE JOB system-level privilege. MANUAL implies that theresynchronization will never occur automatically. A manual resync of the index will happenonly with the DBMS_XMLINDEX.SYNCINDEX command.The STALE value should not be changed. It is provided only for future use. The only thingyou will have to know is that the staleness is set to TRUE when synchronization is set to ALWAYS;otherwise, this value is set to FALSE. Setting this value incorrectly will cause an error message tobe generated.Earlier, the XMLIndex was created with the ASYNC(SYNC MANUAL) clause. This implies thatyou have to manually synchronize the index with the DBMS_XMLINDEX package like you see here:SQL> begin2 dbms_xmlindex.syncindex('JJONES', 'EDBA_SECURITY_XMLINDEX');3 end;4 /PL/SQL procedure successfully completed.You can re-create this index and have it refresh when commits occur with the ON COMMIT value:SQL> create index edba_security_xmlindex2 on edba_security v (value(v))3 indextype is xdb.xmlindex4 parameters('path table edba_security_path_table( tablespace tools) async (sync on commit)')5* parallel 8SQL> /Index created.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!