DBAtlas · Database operations atlas

ORA-01652: Unable to extend temp segment by N in tablespace

Oracle

What does it mean?

Oracle could not find enough free space in the tablespace to extend a temporary (temp) segment. Usually occurs during sorts, hash joins or global temporary table operations.

Why does it happen?

The TEMP tablespace is full; large ORDER BY, GROUP BY, DISTINCT, hash join or index creation operations do not fit in PGA memory and spill to disk; datafiles have AUTOEXTEND off, or disk space runs out.

How to fix it

Monitor TEMP usage: SELECT * FROM v$sort_usage / v$tempseg_usage. Add a file to or enlarge the TEMP tablespace: ALTER TABLESPACE temp ADD TEMPFILE '...' SIZE 2G AUTOEXTEND ON. If a permanent tablespace is full, add a datafile. Reduce disk sorts by optimizing the query (appropriate index, larger PGA_AGGREGATE_TARGET).

Open in DBAtlas →

More from this engine