ORACLE/ADMIN2008. 12. 30. 16:09
반응형
SELECT A.tablespace_name                                    As "TableSpace",
Round(A.bytes / 1024 / 1024, 0)                             As "Total(MB)",
Round(((A.bytes-Sum(Nvl(B.bytes,0)))) / 1024 / 1024, 0)     As "Used(MB)",
Round((Sum(Nvl(B.bytes,0))) / 1024 / 1024 ,0)               As "Free(MB)",
Round((Sum(Nvl(B.bytes,0)) / (A.bytes)) *100 ,0)            As "Free(%)",
A.file_name                                                 As "DataFIle",
sysdate                                                     As "CheckTime"
FROM DBA_DATA_FILES A, DBA_FREE_SPACE B
WHERE A.file_id  = B.file_id (+)
GROUP BY A.tablespace_name, A.file_name, A.bytes
ORDER BY A.tablespace_name;


------------------------------------------------------------------------------------
SELECT NVL(SUM(B.BYTES/1048576),0) / A.BYTES/1048576 c0,
         A.tablespace_name,
         A.file_name,
         to_char(TRUNC(NVL(SUM(B.BYTES/1048576),0) /
(A.BYTES/1048576),4)*100)||'%' pct_free,
       NVL(TRUNC(SUM(B.BYTES/1048576),2),0)||'MB' FREE_SPACE,
       TRUNC((A.BYTES/1048576)-NVL(SUM(B.BYTES/1048576),2),0)||'MB'
USED_SPACE,
       TRUNC(A.BYTES/1048576,2)||'MB' FILE_SIZE,
         autoextensible,
         status
FROM   DBA_DATA_FILES A, DBA_FREE_SPACE B
WHERE  A.FILE_ID=B.FILE_ID (+)
GROUP BY A.tablespace_name, A.file_name,
A.bytes/1048576,autoextensible,status,A.BYTES
UNION
SELECT NVL(SUM(BB.BYTES/1048576),0) / AA.BYTES/1048576 c0,
         AA.tablespace_name,
         AA.file_name,
         to_char(TRUNC(NVL(SUM(BB.BYTES/1048576),0) / (AA.BYTES/1048576),4)*100)||'%' pct_free,
       NVL(TRUNC(SUM(BB.BYTES/1048576),2),0)||'MB' FREE_SPACE,
         TRUNC((AA.BYTES/1048576)-NVL(SUM(BB.BYTES/1048576),2),0)||'MB' USED_SPACE,
         TRUNC(AA.BYTES/1048576,2)||'MB' FILE_SIZE,
       autoextensible,
         status
FROM     DBA_TEMP_FILES AA, DBA_FREE_SPACE BB
WHERE    AA.FILE_ID=BB.FILE_ID (+)
GROUP BY
AA.tablespace_name,AA.FILE_NAME,AA.BYTES/1048576,autoextensible,status,AA.BYTES
ORDER BY 1


반응형

'ORACLE > ADMIN' 카테고리의 다른 글

Materialized View  (0) 2009.02.05
ALTER ~ SHRINK SPACE  (0) 2009.02.05
Oracle Flashback  (0) 2008.12.18
DICTIONARY(DICT) 뷰  (0) 2008.12.03
oracle유저 이외의 유저가 sqlplus등을 사용하는 방법  (0) 2008.11.27
Posted by [PineTree]