📜  purge undo tablespace oracle 11g - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:58.504000             🧑  作者: Mango

代码示例1
-- 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;