oracle查看表空间使用率
时间: 2023-06-04 11:08:29 浏览: 54
可以使用如下SQL语句来查询表空间的使用率:
SELECT tablespace_name,
ROUND((1 - free_space / total_space) * 100, 2) usage_pct
FROM
(SELECT tablespace_name,
SUM(bytes) total_space,
SUM(decode(autoextensible, 'YES', maxbytes, bytes)) total_max,
SUM(bytes) - SUM(decode(autoextensible, 'YES', maxbytes, bytes)) used_space,
SUM(decode(autoextensible, 'YES', maxbytes, bytes)) free_space
FROM dba_data_files
GROUP BY tablespace_name
UNION ALL
SELECT tablespace_name,
SUM(bytes) total_space,
SUM(decode(autoextensible, 'YES', maxbytes, bytes)) total_max,
SUM(bytes) - SUM(decode(autoextensible, 'YES', maxbytes, bytes)) used_space,
SUM(decode(autoextensible, 'YES', maxbytes, bytes)) free_space
FROM dba_temp_files
GROUP BY tablespace_name
)
ORDER BY usage_pct DESC;
阅读全文