澳门金沙viprman全库备份脚本

生龙活虎、增量备份脚本0级备份脚本:丁香紫部分为自定义的备份文件放置的目录复制代码
代码如下:#script.:BackupFull.sh#creater:xyh#date:2014-03-08#desc:backup
full database datafile in archive with rman#connect databaseexport
ORACLE_BASE=/u01/app/oracleexport ORACLE_SID=orclexport
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1export
PATH=$ORACLE_HOME/bin:$PATHrman target/ EOF_RMANrun{allocate channel
c1 type disk;backup incremental level 0 tag ‘db0′
format’/home/oracle/RmanBackup/db0_%d_%T_%s’ database include current
controlfile;sql ‘alter system archive log current’; backup filesperset 5
format ‘/home/oracle/RmanBackup/cf0_%d_%T_%s’ archivelog all delete
input; #filesperset 5意味备份集里面最多包涵5个文件 delete noprompt
obsolete;release channel c1;}# end

#!/bin/bash
#this is rman auto full backup script
#Copyright by 21og
#date 2012-03-21
export ORACLE_SID=orcl
export ORACLE_HOME=/opt/oracle/product/10.2/db_1
export ORACLE_BASE=/opt/oracle
export NLS_LANG=”SIMPLIFIED CHINESE_CHINA.ZHS16GBK”
backtime=`date +”20%y%m%d%H%M%S”`
cd $ORACLE_HOME/bin
rman target / catalog rman/rman
log=/opt/oracle/backup/log/backupall_$backtime.log <<EOF
run{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
allocate channel c5 device type disk;
crosscheck backup;
sql ‘alter system archive log current’;
backup database format ‘/opt/oracle/backup/dbback/db_%d_%T_%U’;
sql ‘alter system archive log current’;
backup archivelog all format ‘/opt/oracle/backup/logback/arc_%t_%s’
delete all input;
backup current controlfile format
‘/opt/oracle/backup/controlfileback/cntrl_%s_%p_%s’;
crosscheck archivelog all;
delete noprompt expired backup;
delete noprompt obsolete;
delete noprompt backup of database completed before ‘sysdate – 30’;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
}
EOF
echo “backup complete!”

1级备份脚本复制代码
代码如下:#script.:Incrl.sh#creater:xyh#date:2014-03-08#desc:backup
full database datafile in archive with rman#connect databaseexport
ORACLE_BASE=/u01/app/oracleexport ORACLE_SID=orclexport
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1export
PATH=$ORACLE_HOME/bin:$PATHrman target/ EOF_RMANrun{allocate channel
c1 type disk;backup incremental level 1 tag ‘db1′
format’/home/oracle/RmanBackup/db1_%d_%T_澳门金沙vip,%s’ database include current
controlfile;sql ‘alter system archive log current’; backup filesperset 5
format ‘/home/oracle/RmanBackup/cf1_%d_%T_%s’ archivelog all delete
input; #filesperset 5表示备份集里面最多带有5个文本 delete noprompt
obsolete;release channel
c1;}#end二、使用linux的crontab设置自动施行备份复制代码 代码如下:crontab
-e按Enter后,能够像vi编辑器相近输入下边内容复制代码 代码如下:0 1 * * 0
/home/oracle/BackupFull.sh /home/oracle/BackupFull.log0 1 * * 3
/home/oracle/BackupFull.sh /home/oracle/BackupFull.log30 1 * * 1-2
/home/oracle/Incrl.sh /home/oracle/Incr.log30 1 * * 4-6
/home/oracle/Incrl.sh /home/oracle/Incr.log查看crontab内容:crontab
-l注:上面意思是把全库备份日志写到/home/oracle/BackupFull.log文件中,而增量备份日志写到/home/oracle/Incr.log中星期天和星期一傍晚1:00实施0级全库备份,周后生可畏、二、四、五、六上午1:30施行增量备份

 

—crontab自动实践

   1)以root身份编辑cron.allow文件,手动增多oracle客商同意利用cron服务。

  启动cron服务 /etc/init.d/cron start

   2)以oracle身份实行crontab -e