oracle19c 查询表空间使用情况
可以通过以下SQL查询表空间使用情况:
SELECT tablespace_name,
sum(bytes) / 1024 / 1024 AS total_size_mb,
sum(bytes - decode(maxbytes, 0, bytes, maxbytes)) / 1024 / 1024 AS used_size_mb,
sum(decode(maxbytes, 0, bytes, maxbytes)) / 1024 / 1024 AS max_size_mb,
round((1 - sum(bytes - decode(maxbytes, 0, bytes, maxbytes)) / sum(decode(maxbytes, 0, bytes, maxbytes))) * 100, 2) AS used_pct
FROM dba_data_files
GROUP BY tablespace_name;
该查询会返回表空间名、总大小、已使用大小、最大大小、使用百分比等信息。其中,used_size_mb表示已使用大小,max_size_mb表示最大大小,used_pct表示已使用百分比
原文地址: https://www.cveoy.top/t/topic/gHYF 著作权归作者所有。请勿转载和采集!