select df.tablespace_name
,format_bytes(df.total_space) as total_space
,format_bytes(df.total_space - fs.free_space) as used_space
,format_bytes(fs.free_space) as free_space
from (select tablespace_name, sum(bytes) as total_space
from dba_data_files
group by tablespace_name
) df,
(select tablespace_name, sum(bytes) as free_space
from dba_free_space
group by tablespace_name
) fs
where df.tablespace_name = fs.tablespace_name
order by df.tablespace_name
;
Oracle query table space statistics
最新推荐文章于 2025-11-24 14:21:40 发布
本文提供了一段SQL脚本,用于查询Oracle数据库中各表空间的总空间、已用空间和剩余空间,通过整合dba_data_files和dba_free_space视图的数据,帮助数据库管理员有效监控和管理数据库存储。
661

被折叠的 条评论
为什么被折叠?



