How much temp space required to rebuid index

Oracle Version :

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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
use NVL on the vsize output if there might be any null columns

manzoor_dbaAuthor Commented:

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..

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

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:


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;


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
manzoor_dbaAuthor Commented:
Thanks... i got the answers partially
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.