Sunday, December 13, 2020

SCHEMA SIZE

 Schema Size 

SELECT
  (SELECT NVL(SUM(S.BYTES),0)/1024/1024/1024                                                                                                -- The Table Segment size
   FROM DBA_SEGMENTS S
   WHERE S.OWNER = UPPER('&SCHEMA')) +
  (SELECT NVL(SUM(S.BYTES),0)/1024/1024/1024                                                                                              -- The Lob Segment Size
   FROM DBA_SEGMENTS S, DBA_LOBS L
   WHERE S.OWNER = UPPER('&SCHEMA') AND
        (L.SEGMENT_NAME = S.SEGMENT_NAME AND L.OWNER = UPPER('&SCHEMA'))) +
  (SELECT NVL(SUM(S.BYTES),0)/1024/1024/1024                                                                                              -- The Lob Index size
   FROM DBA_SEGMENTS S, DBA_INDEXES I
   WHERE S.OWNER = UPPER('&SCHEMA') AND
        (I.INDEX_NAME = S.SEGMENT_NAME AND INDEX_TYPE = 'LOB' AND I.OWNER = UPPER('&SCHEMA')))
   "TOTAL TABLE SIZE"
 FROM DUAL;


No comments: