Professional Documents
Culture Documents
Usage of The Temporary Table Space
Usage of The Temporary Table Space
This is very useful to monitor if you are getting ORA-1652: unable to extend tem
p segment errors, as well as for monitoring the use of space in your temp tables
pace.
select sess.USERNAME, sess.sid, sess.OSUSER, su.segtype,
su.segfile#, su.segblk#, su.extents, su.blocks
from v$sort_usage su, v$session sess
where sess.sql_address=su.sqladdr and sess.sql_hash_value=su.sqlhash ;
You can compare the EXTENTS and BLOCKS columns above to the total available segm
ents and blocks by querying V$TEMP_EXTENT_POOL.
select * from v$temp_extent_pool;
The EXTENTS_CACHED are the total number of extents cached -- following an ora-16
52, this will be the max number of extents available. The EXTENTS_USED column le
ts you know the total number of extents currently in use.
In a TEMPORARY temporary tablespace (ie. one with a TEMPORARY datafile), all the
space in the datafile is reserved for temporary sort segments. (In a well-manag
ed database, this is of course true for non-TEMPORARY temp tablespaces as well).