要求计算某个表所占表空间的大小,网上查了些资料用到了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位