要求計算某個表所占表空間的大小,網上查了些資料用到了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位