chg_awr_days() { db_id=$1 ret=$2 echo "Change the AWR number of days" sqlplus -s "/ as sysdba" <<EOF -- retention=>value in minutes so (45 days * 24 (hours per day) * 60 minutes per hour = 64800) -- retention=>value in minutes so (30 days * 24 (hours per day) * 60 minutes per hour = 43200) -- max value can be set by passing a value of 0 which means forever -- . internal=>60min (snap at this interval), a value of 0 will turn off AWR -- . topnsql . top N sql size, specify value of NULL will keep the current setting exec dbms_workload_repository.modify_snapshot_settings(retention=>${ret}, interval=>60, topnsql=>100, dbid=>${db_id}); EOF }