Rebuild indexes


Job details

Name: Rebuild indexes
Platform: Oracle
Category: Maintenance
Premium package: Maintenance package
Description: Rebuild indexes automatically.
Long description: Rebuild indexes based on structural statistics to improve performance
Version: 1.6
Default schedule: 15 2 * *
Requires engine install: Yes
Compatibility tag: .[type=‘instance’ & databasetype=‘oracle’]/.[hasengine=‘YES’ & eleven_and_above=‘1′]

Parameters

Name Default value Description
history threshold 180 Defines how many days we keep data for in the dbw_rebuild_index_hist table.
calculate time 1 Defines how long time we can use to rebuild indexes in hours. (approximately)
Index min rows 10000 Indexes with less rows than this value will not be checked and rebuilt
Index max height 3 Indexes with a height above this level will be checked
Index max del leaf pct 20 Indexes with more deleted leaf rows vs leaf rows than this level will be checked (in percent)
Block gets per index access 4 Indexes with more block gets per access than this level will be checked
Min time between index rebuild 30 The minimum time between index rebuild of a given index.

Job Summary

SELECT index_name, table_name, last_analyzed, blevel, leaf_blocks, distinct_keys, num_rows, avg_leaf_blocks_per_key, avg_data_blocks_per_key
FROM all_indexes
WHERE owner = 'YourSchema';

Job Description and Details

This monitoring job specifically targets instances where the Oracle database version is 11g or above. It carefully profiles these instances to ensure that the indexes needing attention are highlighted and processed.

Features:

Dependencies

The job has several dependencies, which must be successfully managed for the operation to complete:

Parameters
(Key configuration settings influencing job execution; their actual descriptions and values are excluded by request.)

SQL Code Implementation Details

Code segments crucial for the job include creating necessary tables and procedures that ensure detailed tracking and logging of rebuild operations:

The procedure dbw_rebuild_index_proc orchestrates the entire process:

Output Reports

The report is formatted into a table layout, ensuring readability and easy access to historical performance data, which aids in continuous monitoring and tuning decisions.

Conclusion

This monitoring job is a critical component of Oracle database performance tuning. Its automatic scheduling, detailed parameterization, and thorough logging mechanism make it a valuable tool for database administrators aiming to achieve optimal performance through proactive index management.