Script to tidy archivelogs from ASM and RMAN
Posted by John Hallas on July 17, 2008
We have a pre-production RAC cluster that is kept in archivelog mode to allow true performance monitoring (and to be used for Streams and DataGuard testing). However we do not need the archivelogs for recovery purposes and as we perform high-volume testing the +FRA diskgroup (on solid-state disk) gets full very quickly.
I wrote a script that can be run to quickly free up space. It connects to the ASM instance and removes the logfiles.
It sets the SID and ORACLE_HOME to that of the RAC instance then runs RMAN to perform a crosscheck and delete of the archivelogs.
Not particularly complex but efficient.
asmcmd -p << EOF
rm -rf FRA/RACCLUSTER/ARCHIVELOG/*
rman target / catalog username/password@catdb << EOF1
CHANGE ARCHIVELOG ALL VALIDATE;
DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;