REQUIREMENT:
Configure shell script to take rman Full backup .
SCRIPT: ( rman_full_bkp.sh)
# $Header: rman_full_bkp.sh # *====================================================================================+ # | Author - DBACLASS ADMIN TEAM # | | # +====================================================================================+ # | # | DESCRIPTION # | Take rman full backup(incremental level 0 ) # | PLATFORM # | Linux/Solaris/HP-UX # +===========================================================================+ #!/bin/bash RMANBACKUP_MOUNTPOINT1=/u01/oracle/rman_bkp PARALLELISM=4 MAXPIECESIZE=3g export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1 export ORACLE_SID=TESTDB export PATH=$ORACLE_HOME/bin:$PATH fullBackup () { rman log=/u01/oracle/rman_bkp/LOG/RMANFULLincr.log << EOF connect target / set echo on; configure backup optimization on; configure controlfile autobackup on; configure controlfile autobackup format for device type disk to '$RMANBACKUP_MOUNTPOINT1/%F'; configure maxsetsize to unlimited; configure device type disk parallelism $PARALLELISM; run { allocate channel c1 type disk format '${RMANBACKUP_MOUNTPOINT1}/%I-%Y%M%D-%U' maxpiecesize ${MAXPIECESIZE}; allocate channel c2 type disk format '${RMANBACKUP_MOUNTPOINT1}/%I-%Y%M%D-%U' maxpiecesize ${MAXPIECESIZE}; allocate channel c3 type disk format '${RMANBACKUP_MOUNTPOINT1}/%I-%Y%M%D-%U' maxpiecesize ${MAXPIECESIZE}; allocate channel c4 type disk format '${RMANBACKUP_MOUNTPOINT1}/%I-%Y%M%D-%U' maxpiecesize ${MAXPIECESIZE}; backup as compressed backupset incremental level 0 check logical database plus archivelog; release channel c1 ; release channel c2 ; release channel c3 ; release channel c4 ; } configure backup optimization clear; configure controlfile autobackup clear; sql 'alter system archive log current'; exit EOF } # Main fullBackup
Give 755 permission
chmod 755 rman_full_bkp.sh
Configure script in crontab:
00 22 * * * "/u01/app/oracle/rman_full_bkp.sh" > /tmp/rmanarch.log
For taking incremental backup,Just update the backup command with the below one.
backup as compressed backupset incremental level 1 check logical database plus archivelog;
Hi-
I am new to the scripting and database world and I was hoping someone has time to breakdown this script.
{
allocate channel c1 type disk format ‘${RMANBACKUP_MOUNTPOINT1}/%I-%Y%M%D-%U’ maxpiecesize ${MAXPIECESIZE};
allocate channel c2 type disk format ‘${RMANBACKUP_MOUNTPOINT1}/%I-%Y%M%D-%U’ maxpiecesize ${MAXPIECESIZE};
allocate channel c3 type disk format ‘${RMANBACKUP_MOUNTPOINT1}/%I-%Y%M%D-%U’ maxpiecesize ${MAXPIECESIZE};
allocate channel c4 type disk format ‘${RMANBACKUP_MOUNTPOINT1}/%I-%Y%M%D-%U’ maxpiecesize ${MAXPIECESIZE};
backup as compressed backupset incremental level 0 check logical database plus archivelog;
release channel c1 ;
release channel c2 ;
release channel c3 ;
release channel c4 ;
}