Friday 16 December 2011

RMAN - Delete Archives older than 14days from DR site

Script to delete archive files from standby database using RMAN.

We can schedule it in Cron like,

00 01 * * * sh /orabackup/delete_arch.sh > /orabackup/delete_arch.log

/orabackup/delete_arch.sh

export ORACLE_SID=orcl
export ORACLE_HOME=/orahome/app/oracle/product/11.2.0/dbhome_1
export PATH=${PATH}:${ORACLE_HOME}/bin
$ORACLE_HOME/bin/rman target / << EOF
run {
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
crosscheck archivelog all;
delete noprompt archivelog all completed before 'sysdate -14';
release channel ch1;
release channel ch2;
}
EOF

No comments:

Post a Comment