#!/bin/csh #db0 level backup foldername=`date +%Y%m%d` cd /oradata1/backup if [ -d $foldername ] then echo ‘go on‘ else echo ‘need mkdir‘ mkdir $foldername fi set ORACLE_SID SHIRNOP set ORACLE_BASE /opt/app/oracle/ set ORACLE_HOME /opt/app/oracle/product/11.2.0/dbhome_1/ set NLS_LANG "simplified chinese_china.ZHS16GBK" set NLS_DATE_FORMAT "YYYY-MM-DD HH24:Mi:SS" set PATH /bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/bin/csh:/etc:/opt/app/oracle/product/11.2.0/dbhome_1//bin:. rman target / log=/oradata1/backup/$foldername/full_LOG_%U.log << RMAN_BACKUP run{ CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 8 DAYS; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘/oradata1/backup/$foldername/controlfile%F‘; allocate channel c1 device type disk; allocate channel c2 device type disk; backup incremental level 0 tag ‘db0‘ database format ‘/oradata1/backup/$foldername/db0_%d_%T_%s‘ include current controlfile; delete noprompt obsolete; release channel c1; release channel c2; } RMAN_BACKUP
#!/bin/csh #db1 level backup foldername=`date +%Y%m%d` cd /oradata1/backup if [ -d $foldername ] then echo ‘go on‘ else echo ‘need mkdir‘ mkdir $foldername fi set ORACLE_SID SHIRNOP set ORACLE_BASE /opt/app/oracle/ set ORACLE_HOME /opt/app/oracle/product/11.2.0/dbhome_1/ set NLS_LANG "simplified chinese_china.ZHS16GBK" set NLS_DATE_FORMAT "YYYY-MM-DD HH24:Mi:SS" set PATH /bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/bin/csh:/etc:/opt/app/oracle/product/11.2.0/dbhome_1//bin:. rman target / log=/oradata1/backup/$foldername/incr_LOG_%U.log << RMAN_BACKUP run{ CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 8 DAYS; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘/oradata1/backup/$foldername/controlfile%F‘; allocate channel c1 device type disk; allocate channel c2 device type disk; backup incremental level 1 tag ‘db1‘ database format ‘/oradata1/backup/$foldername/db1_%d_%T_%s‘ include current controlfile; delete noprompt obsolete; release channel c1; release channel c2; } RMAN_BACKUP
#!/bin/csh #arch backup foldername=`date +%Y%m%d` cd /oradata1/backup if [ -d $foldername ] then echo ‘go on‘ else echo ‘need mkdir‘ mkdir $foldername fi set ORACLE_BASE /opt/app/oracle/ set ORACLE_HOME /opt/app/oracle/product/11.2.0/dbhome_1/ set ORACLE_SID SHIRNOP set NLS_LANG "simplified chinese_china.ZHS16GBK" set NLS_DATE_FORMAT "YYYY-MM-DD HH24:Mi:SS" set PATH /bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/bin/csh:/etc:/opt/app/oracle/product/11.2.0/dbhome_1//bin:. rman target / log=/oradata1/backup/$foldername/arch_LOG_%U.log << RMAN_BACKUP run{ CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 8 DAYS; allocate channel c1 device type disk; allocate channel c2 device type disk; sql ‘alter system archive log current‘; backup archivelog all delete input format ‘/oradata1/backup/$foldername/arch_%d_%T_%s‘; release channel c1; release channel c2; } crosscheck archivelog all; delete expired archivelog all; RMAN_BACKUP
#!/bin/bash #del old folders cd /oradata1/backup find . -mtime +10 | xargs rm -rf
0 1 * * 0 /oradata1/backupsh/db0_backup.rman > /dev/null 2&>1# 0 1 * * 1-6 /oradata1/backupsh/db1_backup.rman > /dev/null 2&>1# 0 6,12,18 * * * /oradata1/backupsh/arch_backup.rman > /dev/null 2&>1# 0 3 * * * /oradata1/backupsh/del_old.sh > /dev/null 2&>1#
Oracle RMAN 备份一例,布布扣,bubuko.com
原文:http://www.cnblogs.com/jyzhao/p/3809099.html