#!/bin/bash ################################# # DBAHero # # Author: Leonardo Lopes # # Date: 06/12/2023 # # v1 # ################################# vORASID=`ps -ef | grep pmon | grep -v "grep" | awk '{print $8}' | cut -d '_' -f3` vRET=1440 for db in ${vORASID}; do ORAENV_ASK=NO ORACLE_SID=${db} . oraenv > /dev/null vADRCI=${ORACLE_HOME}/bin/adrci vADRHOME=`echo -e "show homes" | ${vADRCI} | grep -Eiv "adrci|ADR|Copy" | awk NF` for home in ${vADRHOME};do echo "Purging the following path: [ ${home} ], retention period in minutes: [ ${vRET} ]" echo -e "set homepath ${home}; purge -age ${vRET}" | $vADRCI | grep -Eiv "adrci|ADR|Copy" | awk NF; done done