티스토리 뷰

SELECT A.TABLESPACE_NAME AS "테이블스페이스명"

     , A.BYTES / 1024  AS "전체(MB)"

     , (A.BYTES - NVL(B.FREEBYTES,0)) / 1024 AS "사용량(MB)"

     , NVL(B.FREEBYTES,0) / 1024 AS "잔여량(MB)"

     , ROUND(NVL(B.FREEBYTES,0)*100/A.BYTES,2) AS "%"

FROM (

      SELECT TABLESPACE_NAME

           , SUM(BYTES) BYTES 

        FROM DBA_DATA_FILES 

       GROUP BY TABLESPACE_NAME

      ) A

   , (

      SELECT TABLESPACE_NAME

           , SUM(NVL(BYTES,0)) FREEBYTES 

        FROM DBA_FREE_SPACE 

       GROUP BY TABLESPACE_NAME

      ) B

WHERE A.TABLESPACE_NAME = B.TABLESPACE_NAME(+)

ORDER BY 5 ASC;



=========================================================================




select   substr(a.tablespace_name,1,30) tablespace,

         round(sum(a.total1)/1024/1024,1) "TotalMB",

         round(sum(a.total1)/1024/1024,1)-round(sum(a.sum1)/1024/1024,1) "UsedMB",

         round(sum(a.sum1)/1024/1024,1) "FreeMB",

         round((round(sum(a.total1)/1024/1024,1)-round(sum(a.sum1)/1024/1024,1))/round(sum(a.total1)/1024/1024,1)*100,2) "Used%"

from

         (select   tablespace_name,0 total1,sum(bytes) sum1,max(bytes) MAXB,count(bytes) cnt

          from     dba_free_space

          group by tablespace_name

          union

          select   tablespace_name,sum(bytes) total1,0,0,0

          from     dba_data_files

          group by tablespace_name) a

group by a.tablespace_name

order by tablespace;

'DATABASE' 카테고리의 다른 글

[Oracle] 계정관련 명령어  (0) 2013.12.02
[Oracle] 해당 테이블 사용량  (0) 2013.11.29
[Oracle] 테이블의 소유자 / 테이블스페이스명 보기  (0) 2013.11.29
[Oracle] Import  (0) 2013.11.29
[Oracle] Export  (0) 2013.11.29
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/01   »
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
글 보관함