티스토리 뷰

반응형

SELECT TABLESPACE_NAME, FILE_NAME, BYTES/1024/1024/1024, MAXBYTES/1024/1024 FROM DBA_DATA_FILES

UNION ALL

SELECT TABLESPACE_NAME, FILE_NAME, BYTES/1024/1024/1024, MAXBYTES/1024/1024 FROM DBA_TEMP_FILES;



  SELECT TO_CHAR(SYSDATE,'YYYYMMDD')  YMD,

         DDF.TABLESPACE_NAME   TABLESPACE_NAME,

         ROUND(DDF.MAXBYTES/1024/1024/1024,0)   MAXMAXBYTES_GB,

         ROUND(DDF.BYTES/1024/1024/1024,0)   BYTES_GB,

         ROUND((DDF.BYTES - DFS.BYTES)/1024/1024/1024,0)  USED_GB,

         ROUND(((DDF.BYTES - DFS.BYTES) / DDF.BYTES) * 100, 2)  USED_PERCENT,

         ROUND(DFS.BYTES/1024/1024/1024,0)  FREE_GB,

         ROUND((1 - ((DDF.BYTES - DFS.BYTES) / DDF.BYTES)) * 100, 2)  FREE_RATE

    FROM (

           SELECT TABLESPACE_NAME,

                  SUM(BYTES) BYTES,

                  SUM(MAXBYTES) MAXBYTES

             FROM DBA_DATA_FILES

            GROUP BY TABLESPACE_NAME

           UNION ALL

           SELECT TABLESPACE_NAME,

                  SUM(BYTES) BYTES,

                  SUM(MAXBYTES) MAXBYTES

             FROM DBA_TEMP_FILES

            GROUP BY TABLESPACE_NAME

         ) DDF,

         (

           SELECT TABLESPACE_NAME,

                  SUM(BYTES) BYTES

             FROM DBA_FREE_SPACE

            GROUP BY TABLESPACE_NAME

           UNION ALL

           SELECT TABLESPACE_NAME,

                  SUM(FREE_SPACE) BYTES

             FROM DBA_TEMP_FREE_SPACE

            GROUP BY TABLESPACE_NAME            

         ) DFS

   WHERE DDF.TABLESPACE_NAME = DFS.TABLESPACE_NAME(+)

   order by 2;

반응형
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
글 보관함