Professional Documents
Culture Documents
Creating and Assigning New Temp TB
Creating and Assigning New Temp TB
Tablespace created.
Database altered.
Tablespace dropped.
Tablespace created.
Database altered.
Tablespace dropped.
Large sort operations performed by the database may result in a temporary tablespace growing
and occupying a considerable amount of disk space. After the sort operation completes, the extra
space is not released; it is just marked as free and available for reuse. Therefore, a single large
sort operation might result in a large amount of allocated temporary space that remains unused
after the sort operation is complete. For this reason, the database enables you to shrink locally
managed temporary tablespaces and release unused space.
You use the SHRINK SPACE clause of the ALTER TABLESPACE statement to shrink a temporary
tablespace, or the SHRINK TEMPFILE clause of the ALTER TABLESPACE statement to shrink a
specific tempfile of a temporary tablespace. Shrinking frees as much space as possible while
maintaining the other attributes of the tablespace or tempfile. The optional KEEP clause defines a
minimum size for the tablespace or tempfile.
Shrinking is an online operation, which means that user sessions can continue to allocate sort
extents if needed, and already-running queries are not affected.
The following example shrinks the locally managed temporary tablespace lmtmp1 to a size of
20M.
The following example shrinks the tempfile lmtemp02.dbf of the locally managed temporary
tablespace lmtmp2. Because the KEEP clause is omitted, the database attempts to shrink the
tempfile to the minimum possible size.