oracle计算某个表中数据所占表空间的比例

要求计算某个表所占表空间的大小,网上查了些资料用到了oracle的3个视图。具体sql如下

select segment_name as tablename,
       round(bytes /
             (select sum(a.bytes)
                from dba_data_files a, user_users b
                where a.tablespace_name = b.default_tablespace) * 100,3)
 from user_segments
 where segment_name = '表名'

该sql只保留了小数点后3位

猜你喜欢

转载自www.cnblogs.com/fly-9k-blog/p/9228306.html