본문 바로가기

Oracle/admin

tablespace 사용량 80% resize

SELECT V.FILE_NAME,V.TOT_MB,V.FREE_MB,V.FREE_RAT
        ,ROUND((((0.2*V.TOT_MB)-V.FREE_MB) + V.TOT_MB)+40,-2)    RESIZE_GB
        ,'ALTER DATABASE DATAFILE '''||V.FILE_NAME||''' RESIZE '||ROUND((((0.2*V.TOT_MB)-V.FREE_MB) + V.TOT_MB)+40,-2)||'M;'
 FROM (
     SELECT A.FILE_NAME,A.BYTES/1024/1024 TOT_MB,TRUNC(B.BYTES/1024/1024) FREE_MB
            ,TRUNC((B.BYTES/1024/1024)/(A.BYTES/1024/1024)*100)         FREE_RAT
     FROM DBA_DATA_FILES A,
          (SELECT FILE_ID,SUM(BYTES) BYTES FROM DBA_FREE_SPACE GROUP BY FILE_ID) B
     WHERE A.FILE_ID = B.FILE_ID
     AND TRUNC((B.BYTES/1024/1024)/(A.BYTES/1024/1024)*100) <20
     )V
where V.TOT_MB != ROUND((((0.2*V.TOT_MB)-V.FREE_MB) + V.TOT_MB)+40,-2)
ORDER BY 1 ;

 

'Oracle > admin' 카테고리의 다른 글

partition pruning test  (0) 2017.09.07
리스너 내용  (0) 2017.05.12
opt_param  (0) 2017.03.14
Mlog 삭제 아키텍처  (0) 2017.03.12
Metadata DDL 추출  (0) 2017.03.12