SELECT A.FILE_ID "파일아이디",
A.TABLESPACE_NAME "테이블스페이스명",
A.FILE_NAME "파일경로",
round((A.BYTES - B.FREE)/1024/1024/1024,2)||'G' "사용공간",
round(B.FREE/1024/1024/1024,2)||'G' "여유 공간",
round(A.BYTES/1024/1024/1024,2)||'G' "총크기",
TO_CHAR((B.FREE / A.BYTES * 100) , '999.99')||'%' "여유율",
to_char((a.bytes-b.free) , '99.99')||'%' "사용율"
FROM
(
SELECT FILE_ID,
TABLESPACE_NAME,
FILE_NAME,
SUBSTR(FILE_NAME,1,200) FILE_NM,
SUM(BYTES) BYTES
FROM DBA_DATA_FILES
GROUP BY FILE_ID,TABLESPACE_NAME,FILE_NAME,SUBSTR(FILE_NAME,1,200)
) A,
(
SELECT TABLESPACE_NAME,
FILE_ID,
SUM(NVL(BYTES,0)) FREE
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME,FILE_ID
) B
WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME
AND A.FILE_ID = B.FILE_ID
order by a.filE_id;
위 쿼리 실행하면 다음과 같이 나오는데... 사용율값 계산이 이상해요...
도움좀 주세요.
파일아이디 테이블스페이스면 파일경로 사용공간 여유공간 총크기 여유율 사용율
1 SYSTEM /app/oracle/oradata/orcl/system01.dbf .66G .01G .66G 1.13% ######%
2 SYSAUX /app/oracle/oradata/orcl/sysaux01.dbf .48G .03G .51G 5.43% ######%
3 UNDOTBS1 /app/oracle/oradata/orcl/undotbs01.dbf .09G .01G .1G 11.50% ######%
4 USERS /app/oracle/oradata/orcl/users01.dbf 0G 0G 0G 73.75% ######%
5 ORATEST /app/oracle/oradata/orcl/oratest000.dbf 0G 2G 2G 99.95% ######%
6 ORATEST /app/oracle/oradata/orcl/oratest001.dbf 0G 1G 1G 99.90% ######%
|