Oracle 数据库表、表空间大小统计

1、查找特定表大小

select round(BYTES/1024/1024,2)||'M' from Dba_Segments where segment_name=upper('表名');

2、查找数据库中占用空间较大的对象

SELECT OWNER,SEGMENT_NAME,SUM(bytes/1024/1024/1024 ) sum from Dba_Segments group by owner,segment_name having sum(bytes/1024/1024/1024 )>2 order by 3 desc; 

3、统计Oracle数据库用户所有表的大小

 SELECT OWNER as "用户名", sum(BYTES) / 1024 / 1024 / 1024 as "所有表的大小(GB)"
  FROM DBA_SEGMENTS
 WHERE SEGMENT_NAME in (select t2.OBJECT_NAME
                          from dba_objects t2
                         where t2.OBJECT_TYPE = 'TABLE')
 group by OWNER order by 2 desc;

4、查看每个表空间的大小

 Select Tablespace_Name,Sum(bytes)/1024/1024 From Dba_Segments Group By Tablespace_Name order by 2 desc;

上一篇:2021计算机保研夏令营、预推免英语问答


下一篇:GNU Linux Boot ID Machine ID