oracle sql 表空間利用率
SELECT nvl(t.name, 'CDB$ROOT') as DB_NAME,
D.TABLESPACE_NAME,
TOTAL_SPACE,
(SPACE - NVL(FREE_SPACE, 0)),
ROUND((SPACE - NVL(FREE_SPACE, 0)) / TOTAL_SPACE * 100, 2) ratio,
FREE_SPACE
FROM (SELECT TABLESPACE_NAME,
con_id,
ROUND(SUM(BYTES) / (1024 * 1024), 2) SPACE,
ROUND(SUM(decode(maxbytes, 0, bytes, maxbytes)) /
(1024 * 1024),
2) TOTAL_SPACE,
SUM(BLOCKS) BLOCKS
FROM containers(DBA_DATA_FILES)
GROUP BY TABLESPACE_NAME, con_id) D,
(SELECT TABLESPACE_NAME,
con_id,
ROUND(SUM(BYTES) / (1024 * 1024), 2) FREE_SPACE
FROM containers(DBA_FREE_SPACE)
GROUP BY TABLESPACE_NAME, con_id) F,
v$pdbs t
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME(+)
and D.CON_ID = F.CON_ID
and F.con_id = t.CON_ID(+)
UNION ALL
SELECT nvl(t.name, 'CDB$ROOT') as DB_NAME,
D.TABLESPACE_NAME,
SPACE,
USED_SPACE,
ROUND(NVL(USED_SPACE, 0) / SPACE * 100, 2) ratio,
NVL(FREE_SPACE, 0)
FROM (SELECT TABLESPACE_NAME,
con_id,
ROUND(SUM(decode(maxbytes, 0, bytes, maxbytes)) /
(1024 * 1024),
2) SPACE,
SUM(BLOCKS) BLOCKS
FROM containers(DBA_TEMP_FILES)
GROUP BY TABLESPACE_NAME, con_id) D,
(SELECT TABLESPACE_NAME,
con_id,
ROUND(SUM(BYTES_USED) / (1024 * 1024), 2) USED_SPACE,
ROUND(SUM(BYTES_FREE) / (1024 * 1024), 2) FREE_SPACE
FROM containers(V$TEMP_SPACE_HEADER)
GROUP BY TABLESPACE_NAME, con_id) F,
v$pdbs t
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME(+)
and D.CON_ID = F.CON_ID
and F.con_id = t.CON_ID(+)
ORDER BY 1
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/309902/viewspace-2651323/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 表空間利用率及物件大小查詢Oracle物件
- Oracle SQL 基本操作之 表空間OracleSQL
- 表空間sqlSQL
- Oracle 表空間查詢相關sqlOracleSQL
- 【轉】查詢表空間中的資料檔案利用率的sqlSQL
- oracle筆記整理16——表空間利用率、鎖表、鎖包、dbms_job操作Oracle筆記
- Oracle表空間Oracle
- oracle 表空間Oracle
- oracle temp 表空間Oracle
- 增加oracle表空間Oracle
- oracle undo 表空間Oracle
- oracle users 表空間Oracle
- Oracle表空間管理Oracle
- oracle建立表空間Oracle
- Oracle 表空間管理Oracle
- oracle表空間操作Oracle
- ORACLE MOVE表空間Oracle
- ORACLE表空間概述Oracle
- Oracle表空間命令Oracle
- Oracle 表空間回收Oracle
- Oracle表移動表空間Oracle
- oracle 表移動表空間Oracle
- 表空間常用sql彙總SQL
- oracle表空間的整理Oracle
- Oracle 批量建表空間Oracle
- Oracle清理SYSAUX表空間OracleUX
- Oracle undo 表空間管理Oracle
- oracle表空間查詢Oracle
- Oracle 表空間傳輸Oracle
- oracle重建UNDO表空間Oracle
- oracle 臨時表空間Oracle
- Oracle各種表空間Oracle
- Oracle 表空間的管理Oracle
- oracle表空間傳輸Oracle
- Oracle傳輸表空間Oracle
- oracle 系統表空間Oracle
- Brtools擴oracle表空間Oracle
- oracle臨時表空間Oracle