Oracle-查询表大小
原创
©著作权归作者所有:来自51CTO博客作者小宝大人的原创作品,请联系作者获取转载授权,否则将追究法律责任
--查找特定表大小
set linesize 200;
col owner for a18;
col segment_name for a28;
select owner,segment_name,sum(bytes / 1024 / 1024) segment_size
from dba_segments
where segment_name = upper('table_name')
group by owner,segment_name;
--查找数据库中占用空间较大的对象
select owner, segment_name, sum(bytes / 1024 / 1024 / 1024) segment_size
from dba_segments
group by owner, segment_name
having sum(bytes / 1024 / 1024 / 1024) > 1
order by 3 desc;
--统计oracle数据库用户所有表的大小
select owner, sum(bytes / 1024 / 1024 / 1024) segment_size
from dba_segments
where segment_name in (select d.object_name
from dba_objects d
where d.object_type = 'TABLE')
group by owner
order by 2 desc;
--查看每个表空间的大小
select tablespace_name, sum(bytes / 1024 / 1024 / 1024) tablespace_size
from dba_segments
group by tablespace_name
order by 2 desc;