Oracle 10g:Backup archives on hourly basis



Backup archives on hourly basis



To get full recovery of database,We backup archives on hourly basis.

For this,

Use this script for backup.

Check comments for better understanding...

#!/usr/bin/ksh

# Go to backup location.
cd /rmanbck/arch

ddy=`date +%a`
dt=`date +%Y%m%d`

#last archive was backed up sequence
lastredono=`ls -rt *arch*.log|tail -1|sed 's/^.*arch_//;s/[.]log//'|awk -F_ '{print $2}'`
fno=`expr ${lastredono} \- 2`
#From Archive destination, Find the max sequence generations
tno=`find /oracle/arch -name "*.arch" -print|sort|tail -1|sed 's@/oracle/arch/@@'|awk -F_ '{print $1}'`
FNAME=${dt}_${ddy}_arch_${fno}_${tno}
echo $FNAME
rman target / trace /rmanbck/arch/$FNAME.log << EOF
run
{
ALLOCATE CHANNEL disk3 DEVICE TYPE DISK;
backup as compressed backupset FORMAT '/rmanbck/arch/%T_${ddy}_arch_${fno}_${tno}_%U.set' archivelog from sequence ${fno} until sequence ${tno};
release channel disk3;
}
EOF
exit;


Comments

Popular posts from this blog

Agent Installation on Windows Server. SQL Server (Failover Cluster) target addition in OEM 12c

Oracle 10g/11g Linux:SMS the alert logs ORA- errors generated in timestamp

Oracle 11g: Install Instant Client 11.2.0.3.0 on Linux x86_64 Server.