oracle查询2G以上的表
SELECT a.*, b.comments
FROM (SELECT OWNER,
SEGMENT_NAME,
SEGMENT_TYPE,
round(SUM(BYTES / 1024 / 1024 / 1024), 3) GB
FROM DBA_SEGMENTS
WHERE OWNER IN ('TEST') --and segment_type LIKE 'TABLE%'
GROUP BY OWNER, SEGMENT_NAME, SEGMENT_TYPE) a,
dba_tab_comments b
where a.SEGMENT_NAME = b.table_name
AND B.owner = A.OWNER
and a.GB > 2
ORDER BY 1, 4 DESC;
----取前几个表
SELECT *
FROM (SELECT a.*, b.comments, ROWNUM RN
FROM (SELECT OWNER,
SEGMENT_NAME,
SEGMENT_TYPE,
round(SUM(BYTES / 1024 / 1024 / 1024), 3) GB
FROM DBA_SEGMENTS
WHERE OWNER IN ('PTS') --and segment_type LIKE 'TABLE%'
GROUP BY OWNER, SEGMENT_NAME, SEGMENT_TYPE) a,
dba_tab_comments b
where a.SEGMENT_NAME = b.table_name
AND B.owner = A.OWNER
and a.GB > 2) DD
WHERE DD.RN < 5
ORDER BY 1, 4 DESC;