Link to home
Start Free TrialLog in
Avatar of manzoor_dba
manzoor_dba

asked on

How much temp space required to rebuid index

Hi,
Oracle Version : 8.1.7.4.0

I have an index which is currently sized around 20GB,  I need to rebuild this index, before that i need to calcuate how much temporary space will be requied inorder to rebuild this index, currently my temporary tablespace is sized 5GB.

Can anybody suggest on this.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sean Stuber
Sean Stuber

use NVL on the vsize output if there might be any null columns

Avatar of manzoor_dba

ASKER

Hi,

is the above formula is to calculate the estimated size of the index or for the space required in the temporary tablespace to rebuild the index?

I need to calcuate the estimated tempory tablespace space required to redbuild the index..

Thanks..
yes, that's for temp but again, it's just an estimate

oracle will attempt to do as much of the sorting in memory as it can.

your sort area size can be subtracted from the total above to determine how much of the sorting will have to be done in TEMP vs memory.  still an estimate but a little closer
In such cases I investigate the temporary tablespaces size every 5 minutes using the query:

select TABLESPACE_NAME, BYTES_USED/1024/1024 MEGS_USED, BYTES_FREE/1024/1024 MEGS_FREE from V$TEMP_SPACE_HEADER;

If the tablespace gets used I do two things:

1. Try to activate SMON to clean the tablespace (this is complex action)
2. Increase the size of the tablespace:

ALTER DATABASE TEMPFILE '/oracle/OMIS/oradata7/tempOMIS.dbf5' RESIZE 10000M;

OR

add aditional datafiles to the temporary tablespace.

After the rebuild fibishes it is possible to resize the tablespace.
>>>  Try to activate SMON to clean the tablespace (this is complex action)

If the temp segments are in use to hold the index key data being sorted, this won't work because there is nothing to be cleaned.

>>> Increase the size of the tablespace:

 or , possibly better, create a new dedicated temp space and assign that temp to the user that is doing the rebuild

this way your rebuild won't impact or be impacted by other processes consuming temp in your normal TEMP space.

allow the new temp space to grow as needed then drop it when the rebuild is done
Thanks... i got the answers partially