You are on page 1of 1

Temporary Tablespace Shrink

Database operations may require unusually large amounts of temporary tablespace usage. This
can lead to large tempfiles. It would nice to be able to shrink those tempfiles down to some
smaller size. Oracle 11g provides two options to deal with large temporary tablespaces. !T"#
T$!"%&'" %(#I)* %&'" will cause Oracle to reduce the overall size of the temporary
tablespace to its originally defined size. !T"# T$!"%&'" %(#I)* T"+&,I!" will
shrink a given tempfile to its originally defined size. $oth commands come with a *""& option-
which allows you to indicate that you want the temporary tablespace or data file to be a
minimum of the *""& size.
These commands will resize the T"+& tablespace to its original size.
ALTER TABLESPACE temp shrink space;
ALTER TABLESPACE temp shrink tempfile '/oracle01/oradata/orcl/temp01d!f';
(ere is an e/ample of using the *""& parameter to manage how much space is left in the
tablespace or the tempfile. )ote that using the *""& parameter will not cause the size of the
temporary tablespace or tempfiles to grow if they are already smaller than the *""& size.
ALTER TABLESPACE temp shrink space keep 100m;
ALTER TABLESPACE temp shrink
tempfile '/oracle01/oradata/orcl/temp01d!f' keep 100m;
The %(#I)* %&'" command option will not try to deallocate e/tents that are allocated and in
use. The #"%I0" command will try to deallocate all the space- and will return an error if the
space is in use and cannot be deallocated.
The DBA_TEMP_FREE_SPACE View
D$1T"+&1,#""1%&'" has been added to Oracle 11g to make it easier to manage
temporary tablespaces. The view provides a single place to determine the total size of a
temporary tablespace- how much space is allocated- and how much is free. (ere is an e/ample of
a query against D$1T"+&1,#""1%&'".
SELECT " #R$% d!a&temp&free&space;
TABLESPACE&'A%E TABLESPACE&S()E ALL$CATE*&SPACE #REE&SPACE
+++++++++++++++ ++++++++++++++++++ ++++++++++++++++++ ++++++++++++++++++
T"+& 12-343-356 6-783-265 16-925-596

You might also like