表空间使用情况查询
set pages 999
set linesize 999
SELECT a.tablespace_name “表空间名称”,
100-ROUND((NVLSQL> SQL> 2 (b.bytes_free,0)/a.bytes_alloc)*100,2) “占用率(%)”,
ROUND(a.bytes_alloc/1024/1024,2 3 ) “容量(M)”,
ROUND(NVL(b.bytes_free,0)/1024/1024,2) “空闲(M)”,
ROUND((a.bytes_alloc-NVL(b.bytes_free,0))/1024/1024,2) “使用(M)”,
TO_CHAR(SYSDATE,‘yyyy-mm-dd hh24:mi: 4 5 6 ss’) “采样时间”
FROM (SELECT f.tablespace_name,
SUM(f.bytes) bytes_alloc,
SUM(DECODE(f.autoextensible,‘YES’,f.maxbytes,‘NO’,f.bytes)) maxbytes
FROM dba_data_files f GROUP BY tablespace_name) a,
(SELECT f.tablespace_name, SUM(f.bytes) bytes_free
FROM dba_free_space f GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name;
7 8 9 10 11 12 13
表空间名称 占用率(%) 容量(M) 空闲(M) 使用(M) 采样时间
SYSAUX 44.39 16384 9111.38 7272.63 2020-10-09 16:00:04
UNDOTBS1 1.02 37204 36824.69 379.31 2020-10-09