Hi Igor,
First, what is your nmotive for rebuilding the indexes? To re-claim space or to improve performance?
Have you checked the Oracle segment advisor? That recommendes indexes for rebuilding.
>> another articles write that normally Oracle calculates the optimum degree of parallelism, so it is not necessary for you to specify integer.
Yes, but I don't agree! Setting parallelism at the system level or table level can be a mistake, because the optimizer starts thinking that full-scans are cheaper than they really are:
http://www.dba-oracle.com/art_par_ecom.htmCODE
alter index ITEM_IDX rebuild partition TEST_Q1_JAN tablespace PART1 parallel 3 nologging;
This should work fine, so long as there are enough contiguous extents in PART1 to hold the new index.
(Note that I specified "3" for the parallel degree.)
***********************************************************
>> I need to do analyse index to understand should I rebuild index or not.
That's one way, but thereare many. many approaches. Remember, not all indexes are accesed the same. Indexes that only access with "unique" scans will never need rebuilding. You need to see if the index experiences large range scans of full scans, to know for sure if a rebuild will help performance.
>> Collecting the index_stats information is very time consuming
No, you don't need that much analysis. Oracle MetaLink note 122008.1 has the officially authorized script to detect indexes that benefit from rebuilding. This script detects indexes for rebuilding using these rules: Rebuild the index when these conditions are true:
- deleted entries represent 20% or more of the current entries.
- the index depth is more then 4 levels.
See here:
http://www.dba-oracle.com/oracle_news/2005...es_bad_ugly.htm*************************************************************
>> And is it safe operation for database or not because I will do it on production database?
It can be made safe, IF you make a brand new tablespace to recieve the new index (PART1), and if you have enough TEMP to sort the keys. If it fails, the old index remains in-place.
Just make sure that you do it during a planned downtime, take a backup, and punch the index DDL with dbms_metadata before you start.