Index recovery
DB2® UDB for iSeries™ provides several functions to deal with index recovery.
- System managed index protection
The EDTRCYAP CL command allows a user to instruct DB2 UDB for iSeries to guarantee that in the event of a system or power failure, the amount of time required to recover all indexes on the system is kept below a specified time. The system automatically journals enough information in a system journal to limit the recovery time to the specified amount.
- Journaling of indexes
DB2 UDB for iSeries supplies an index journaling function that makes it unnecessary to rebuild an entire index due to a power or system failure. If the index is journaled, the system database support automatically makes sure the index is in synchronization with the data in the tables without having to rebuild it from scratch. SQL indexes are not journaled automatically. You can, however, use the CL command Start Journal Access Path (STRJRNAP) to journal any index created by DB2 UDB for iSeries.
- Index rebuild
All indexes on the system have a maintenance option that specifies when an index is maintained. SQL indexes are created with an attribute of *IMMED maintenance.
In the event of a power failure or an abnormal system failure, if indexes are not protected by one of the previously described techniques, those indexes in the process of change might need to be rebuilt by the database manager to make sure that they agree with the actual data. All indexes on the system have a recovery option that specifies when an index should be rebuilt if necessary. All SQL indexes with an attribute of UNIQUE are created with a recovery attribute of *IPL (this means that these indexes are rebuilt before the i5/OS® operating system is started). All other SQL indexes are created with the *AFTIPL recovery option (this means that after the operating system is started, indexes are asynchronously rebuilt). During an IPL, the operator can see a display showing the indexes that need to be rebuilt and their recovery options. The operator can override the recovery options.
- Save and restore of indexes
The save/restore function allows you to save indexes when a table is saved by using ACCPTH(*YES) on the Save Object (SAVOBJ) or Save Library (SAVLIB) CL commands. In the event of a restore when the indexes have also been saved, there is no need to rebuild the indexes. Any indexes not previously saved and restored are automatically and asynchronously rebuilt by the database manager.
Parent topic:
Data integrity