← Space Management
Oracle · Space Management

How to check undo tablespace usage in Oracle

Check Oracle undo tablespace usage by status and undo health from V$UNDOSTAT.

Tested on11g12c19c21c23ai26ai

Undo space by extent status (active, unexpired, expired), plus undo health over the retention window from V$UNDOSTAT: block usage, transactions, longest query, and any out-of-space errors.

-- Undo space by status
SELECT tablespace_name, status,
       ROUND(SUM(bytes)/1024/1024) AS mb,
       COUNT(*)                    AS extents
FROM   dba_undo_extents
GROUP  BY tablespace_name, status
ORDER  BY tablespace_name, status;

-- Undo health over the retention window
SELECT * FROM (
  SELECT begin_time, end_time, undoblks, txncount,
         maxquerylen AS max_query_sec, nospaceerrcnt, tuned_undoretention
  FROM   v$undostat
  ORDER  BY begin_time DESC
)
WHERE ROWNUM <= 24;
spaceundov$undostat