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
LVL 5
manzoor_dbaAsked:
Who is Participating?
 
sdstuberCommented:
I don't know of an exact calculation

you can estimate based on the size of the columns  rows
something like this should put you in the ballpark

select sum(vsize(col1) + vsize(col2) + vsize(col3)) from your_table

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

0
 
manzoor_dbaAuthor Commented:
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..
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
sdstuberCommented:
yes, that's for temp but again, it's just an estimate

0
 
sdstuberCommented:
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
0
 
schwertnerCommented:
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.
0
 
sdstuberCommented:
>>>  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
0
 
manzoor_dbaAuthor Commented:
Thanks... i got the answers partially
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.