This script will run on standby database.
It will basically check for applied archives on standby database and it will keep last 100's number of archives present and will delete rest of the archives that have been already applied. I have personally tested this script on my environment which is running on RHEL 7 and Database Ver 11.2.0.4.
Warning:- Before running the script directly into Production Environment , please test it on a non production environment.
#Schedule this script on standby database server.
#!/bin/bash ARCHLOG_DIR=/arch/prodtest/archivelog echo "Oracle applied LogNo is $LogNo" let SecLogNo=${LogNo}-100 echo "Archivelog is present from number : $SecLogNo" echo "*****************************" cd $ARCHLOG_DIR for i in `ls *.arc` do Newi=`echo $i | cut -d "_" -f 2` if [ "$Newi" -lt "$SecLogNo" ]; then echo "$i to be deleted..." rm -r $i fi done |
Schedule to run for every 4 hours
[oracle@ccuine103 ~]$ crontab -l
0 */4 * * * /home/oracle/archive_del.sh
No comments:
Post a Comment