#!/bin/ksh # Richard Wilson - 30.03.2014 # Automatic Diagnostic Repository Cleanup.a # Hint: 7 days for trace and dump files, 1 month for the others. # --------------------------------------------------------------------------------------------------------------- export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 set -A HOMES "systst3/SYSTST3" "systst4/SYSTST4" "sit3/SIT3" "sit4/SIT4" "uat3/UAT3" "uat4/UAT4" "train2/TRAIN2" "pack3/PACK3" idx=0 days_90=129600 days_60=86400 days_30=43200 days_21=30240 days_14=20160 days_10=14400 days_7=10080 days_5=7200 while [ ${idx} -lt ${#HOMES[@]} ] do ${ORACLE_HOME}/bin/adrci <<- EOF # set homepath diag/rdbms/${HOMES[${idx}]} set home diag/rdbms/${HOMES[${idx}]} purge -age ${days_21} -type ALERT; purge -age ${days_14} -type CDUMP; purge -age ${days_21} -type INCIDENT; purge -age ${days_21} -type HM; purge -age ${days_14} -type TRACE; purge -age ${days_21} -type UTSCDMP; EOF (( idx+=1 )) done # ---------------------------------------------------------------------------------------------------------------