cancel
Showing results for 
Search instead for 
Did you mean: 

Temp tablespace

SOLVED
Go to solution
ericfjchen
Regular Advisor

Temp tablespace

Hi,

How to judge a suitable size for temporary tablespace? Can we reduce the temporary tablespace?

Thanks

FJ
5 REPLIES
Eric Antunes
Honored Contributor

Re: Temp tablespace

Hi Eric,

The temp tablespace is to save temporary data to sort for example. So there is not a standard size: you must observe if your current TEMP tablespace is suitable for your environment or not. Here I have 1 Gb allocated to temp datafiles...

What is more important is to follow Oracle processes that uses lots of TEMP space and verify why they are using it, tuning there SQL if they are doing heavy sorts and/or full table scans.

Best Regards,

Eric Antunes
Each and every day is a good day to learn.
renarios
Trusted Contributor

Re: Temp tablespace

Hi FJ,

I think this question is about an Oracle database?
The size of the temporary tablespace depends on:
1 Size of the database
2 The application which uses the database (is the software in the database or is it just for data)
3 The number of concurrent users on the database
4 Parameters like sort_area_size (<9i) pga_aggregate_size (8i>)

So if you are going to create a small database, begin with 64MB, but is it a multibyte gig database, make it bigger (512mb >)

Hope it helps,

Renarios
Nothing is more successfull as failure
Indira Aramandla
Honored Contributor
Solution

Re: Temp tablespace

Hi Ericfjchen,

A temporary segment will be used by the user sessions for any kind of sort activities like ORDER BY, GROUP BY and some execution plans like SORT MERGE. The TEMP space used by the session will not be released back until that user session logs out of the database. Normally user sessions are responsible for cleaning up the temp segment, otherwise SMON will do the job, if the user session fails to complete. In 8i on wards you can set an event to force cleanup

The temporary (sort) segment of a given temporary tablespace is created at the time of the first sort operation, which has to write to disk to free up sort space in memory. The first disk sort (after
instance startup) creates a sort segment in the temporary tablespace.

The background process SMON actually de-allocates the sort segment after the instance has been started and the database has been opened. Thus, after the database has been opened, SMON may be seen to consume large amounts of CPU as it first de-allocates the (extents from the) temporary segment, and after that performs free space coalescing of the free extents created by the temporary segment cleanup. This behavior will be exaggerated if the temporary tablespace, in which the sort segment resides, has inappropriate (small) default NEXT
storage parameters.

From 8i onwards you can create a locally-managed temporary tablespace for temporary segments with uniform extent-size:

Yes you can decreasde the temporaty datafile (tablespace).

To decrease the size of a datafile, you use the same command, but specify a size smaller than the existing datafile. For example, we could reduce the file above back to 1MB with the command:

ALTER DATABASE DATAFILE '/databases/oracle/test.dbf' RESIZE 1MB;

Attached is a document explains the guidelines fro temporary tablespace.

Indira A
Never give up, Keep Trying
Jean-Luc Oudart
Honored Contributor

Re: Temp tablespace

Hi,

cf. attached Metalink note on Temporary segment : 102339.1

Check Guidelines (7)

Regards
Jean-Luc
fiat lux
Yogeeraj_1
Honored Contributor

Re: Temp tablespace

hi,

to add to what indira said above:
By using a true TEMPORARY tablespace, the database will allocate an extent ONCE and then keep it. These extents will be managed not via the data dictionary but in memory. This means the expensive recursive sql we do to allocate an extent and then free it is removed. This can dramatically increase performance if you use lots of temp space frequently.

hopw this helps too!

regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)