This is an example of rman backup that connects to a catalog database and the whole database files are copied to disk.
1- Generate a .sh shell script with the following.
#!/bin/ksh
#
####Invokes the full backup of the database.
DATE=`date '+%d-%m-%y:%H:%M:%S'`
export DATE
ORACLE_HOME=/apps/ora11/product
export ORACLE_HOME
ORACLE_SID=test
export ORACLE_SID
BKPSCRIPTS=/backup/scripts_bkp/rman/$ORACLE_SID
export BKPSCRIPTS
PATH=/apps/ora11/product/bin:/usr/bin
export PATH
SERVIDOR=`hostname`
export SERVIDOR
ARCH_DEST=/backup/arch11/$ORACLE_SID
export ARCH_DEST
export PASSWD_CAT=`cat /backup/scripts_bkp/.catuser_passwd`
export PASSWD_LOCAL=`cat /backup/scripts_bkp/.dbpasswd_user`
echo "Running full backup RMAN, please wait ...";
$ORACLE_HOME/bin/rman target BACKUP/${PASSWD_LOCAL} catalog RMAN_CAT/${PASSWD_CAT}@CAT cmdfile=$BKPSCRIPTS/rman_full_test.rcv msglog $BKPSCRIPTS/logs/backup_full_RMAN_test_diario_$DATE.log;
/bin/mailx -s "Backup Diario RMAN test TST_SERVER" ora11@domain "user@e-mail" < $BKPSCRIPTS/logs/backup_full_RMAN_test_diario_$DATE.log
exit 0
2- Content rman_full_test.rcv file :
run{
allocate channel d1 type disk format '/backup/backup11/rman/test/rman_db_test_%T_%U.rman';
allocate channel d2 type disk format '/backup/backup11/rman/test/rman_db_test_%T_%U.rman';
backup as compressed backupset full database include current controlfile;
release channel d1;
release channel d2;
allocate channel d1 type disk format '/backup/backup11/rman/test/rman_arc_test_%T_%U.rman';
allocate channel d2 type disk format '/backup/backup11/rman/test/rman_arc_test_%T_%U.rman';
CROSSCHECK ARCHIVELOG ALL;
delete expired archivelog all;
sql "alter system archive log current";
backup as compressed backupset archivelog all;
backup archivelog all delete input;
sql "alter database backup controlfile to ''/backup/backup11/rman/test/rman_control_file.rman'' reuse";
release channel d1;
release channel d2;
}
Comments