Archive

Temporary Datafiles

Temporary tablespaces are used to manage space for database sort and joining operations and for storing global temporary tables.

For joining two large tables or sorting a bigger result set, Oracle cannot do in memory by using SORT_AREA_SIZE in PGA (Programmable Global Area).

Space will be allocated in a temporary tablespace for doing these types of operations.

Other SQL operations that might require disk sorting are: CREATE INDEX, ANALYZE, SELECT DISTINCT, ORDER BY, GROUP BY, UNION, INTERSECT, MINUS, Sort-Merge joins, etc.
Note that a temporary tablespace cannot contain permanent objects and therefore doesn’t need to be backed up. A temporary tablespace contains schema objects only for the duration of a session.

Tempfiles (Temporary Datafiles)

Unlike normal datafiles, tempfiles are not fully allocated. When you create a tempfiles, Oracle only writes to the header and last block of the file. This is why it is much quicker to create a tempfiles than to create a normal datafile.