프로그래밍/SQL

오라클의 각 테이블 사이즈 조회 쿼리

빨강토끼 2012. 8. 31. 14:41

SELECT A.SEGMENT_NAME,
              ROUND(SUM(A.BYTES)/1024/1024) "SIZE_MB",
              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 = '유저아이디'
GROUP BY A.SEGMENT_NAME, A.SEGMENT_TYPE
ORDER BY 2 DESC;