상세 컨텐츠

본문 제목

테이블별 적재 Size 조회 쿼리

Oracle/DB

by 야솔아빠 2013. 5. 21. 17:13

본문

반응형

Oracle 기준 테이블별 적재 Size 조회 쿼리


select table_name, num_rows, num_rows*avg_row_len, round((num_rows*avg_row_len/1024/1024),2) "SIZE(MB)", round((num_rows*avg_row_len/1024/1024/1024),2) "SIZE(GB)"

from user_tables;



또는


SELECT A.SEGMENT_NAME,

       SUM(A.BYTES) AS SIZE_BYTES,

       ROUND(SUM(A.BYTES)/1024) AS SIZE_KB,

       ROUND(SUM(A.BYTES)/1024/1024) AS SIZE_MB,

       ROUND(SUM(A.BYTES)/1024/1024/1024) AS SIZE_GB,

       A.SEGMENT_TYPE

  FROM DBA_SEGMENTS A,

       DBA_TABLES B

WHERE A.SEGMENT_NAME = B.TABLE_NAME

   AND A.SEGMENT_TYPE IN ('TABLE', 'TABLE_PARTITION')

   AND A.OWNER = 'PIP_ODS'

-- AND A.SEGMENT_NAME = ''

GROUP BY A.SEGMENT_NAME, A.SEGMENT_TYPE

ORDER BY SUM(A.BYTES) DESC;

반응형

관련글 더보기

댓글 영역