统计用户下的表的大小排行(包含大字段统计)

来源:互联网 发布:吉他调音软件app 编辑:程序博客网 时间:2024/09/21 09:02
select *
  from (select owner, segment_name, sum(GB)
          from (select OWNER, SEGMENT_NAME, BYTES / 1024 / 1024 / 1024 GB
                  from dba_segments
                 where owner = 'USERNAME'
                   and segment_type = 'TABLE'
                   and segment_name not LIKE '%LOG%'
                union all
                select A.OWNER, B.TABLE_NAME, A.BYTES / 1024 / 1024 / 1024 GB
                  from dba_segments a, dba_lobs b
                 where a.owner = 'USERNAME'
                   and b.owner = 'USERNAME'
                   AND A.segment_name = B.SEGMENT_NAME
                   and a.segment_type = 'LOBSEGMENT'
                   AND b.table_name not like '%LOG%') a
         group by owner, segment_name
         order by 3 desc) bb
 where rownum < 21


原创粉丝点击