📅  最后修改于: 2022-03-11 15:05:24.889000             🧑  作者: Mango
-- UNDO tablespace current usage / available space
SELECT a.TABLESPACE_NAME, SIZEMB, USAGEMB, (SIZEMB - USAGEMB) AS FREEMB
FROM (SELECT round(sum(BYTES) / 1e6) AS SIZEMB, b.TABLESPACE_NAME
FROM DBA_DATA_FILES a, DBA_TABLESPACES b
WHERE a.TABLESPACE_NAME = b.TABLESPACE_NAME AND b.CONTENTS LIKE 'UNDO'
GROUP BY b.TABLESPACE_NAME) a,
(SELECT c.TABLESPACE_NAME, sum(BYTES) / 1e6 AS USAGEMB
FROM DBA_UNDO_EXTENTS c
WHERE STATUS <> 'EXPIRED'
GROUP BY c.TABLESPACE_NAME) b
WHERE a.TABLESPACE_NAME = b.TABLESPACE_NAME;