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位

posted @ 2018-06-26 11:34  Fly_9K  阅读(1703)  评论(0)    收藏  举报