#!/bin/ksh
export RMAN_LOGFILE=crosscheck.and.rm.arc.logs.log
(
echo "connect target /"
echo "delete noprompt archivelog until time 'sysdate -1' ;"
echo "crosscheck archivelog all ;"
echo "exit ;"
) |
$ORACLE_HOME/bin/rman LOG $RMAN_LOGFILE
# rman returns nonzero result for any errors encountered in command set
export ERRORCODE=$?
if [ "$ERRORCODE" = "0" ]
then
echo "RMAN SUCCESSFUL completion of crosscheck"
else
echo "RMAN FAILED completing crosscheck"
fi
courtesy of Gerald Bowers