重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛
标题:
检查表空间各个数据文件使用情况的语句
[打印本页]
作者:
Inkcup
时间:
2026-2-11 09:52
标题:
检查表空间各个数据文件使用情况的语句
SELECT a.tablespace_name "tbs_name",
b.file_name "tbs_file",
total "tbs_size",
free "tbs_free",
(total - free) "tbs_used_size",
total / (1024 * 1024 * 1024) "tbs_size(G)",
free / (1024 * 1024 * 1024) "tbs_free(G)",
(total - free) / (1024 * 1024 * 1024) "tbs_can(G)",
round((total - free) / total, 4) * 100 "pct_used %"
FROM (SELECT tablespace_name, SUM(bytes) free
FROM dba_free_space
GROUP BY tablespace_name) a,
(SELECT tablespace_name,file_name, SUM(bytes) total
FROM dba_data_files
GROUP BY tablespace_name,file_name) b
WHERE a.tablespace_name = b.tablespace_name;
欢迎光临 重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛 (http://bbs.cqsztech.com/)
Powered by Discuz! X3.2