1. 有两种含义的表大小。一种是分配给一个表的物理空间数量,而不管空间是否被使用。可以这样查询获得字节数:
方法一:
select t.owner,t.segment_name,t.tablespace_name,sum(bytes/1024/1024/1024) gb
from dba_segments t
where t.tablespace_name='&TBS_NAME'
group by t.owner,t.segment_name,t.tablespace_name
order by 4 desc;
或者
Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name
方法二:
select *
from (select t.owner,
t.segment_name,
round(table_bytes / 1024 / 1024 / 1024, 0) TAB_GB,
round(index_bytes / 1024 / 1024 / 1024, 0) IDX_GB
from (select OWNER, SEGMENT_NAME, bytes table_bytes
from dba_SEGMENTS
where segment_type = 'TABLE') t,
(select ui.table_name, sum(us.bytes) index_bytes
from dba_indexes ui, dba_segments us