大家好,我是考100分的小小码 ,祝大家学习进步,加薪顺利呀。今天说一说oracle备份方案[通俗易懂],希望您对编程的造诣更进一步.
oracle生产备份方案
crontab 配置
周末全量备份,其他日期增量备份,清除15天以前文件
0 5 * * * find /app/oracle11g/product/11.2.0/archdir/ecudb/* -mtime +6 |xargs rm -fr
#rmanbackup
30 4 * * 6 sh /backup/feikong/scripts/rman_backup_0.sh
30 4 * * 0,1,2,3,4,5 sh /backup/feikong/scripts/rman_backup_1.sh
30 4 * * * find /backup/data -ctime +15 -type f |grep -E "DB_0|DB_1|arch_" |xargs -L 1 rm -rf
代码100分
rman_backup_0.sh
代码100分#!/bin/bash
source ~/.bash_profile
rq=`date +%Y%m%d`
rman target / log /backup/log/rmanbackup_${rq}.log append<<EOF
set encryption on identified by "u9j04hkUvfRu" only;
run{
ALLOCATE CHANNEL ch1 TYPE disk;
ALLOCATE CHANNEL ch2 TYPE disk;
BACKUP INCREMENTAL LEVEL 0 TAG "DB0" DATABASE FORMAT "/backup/data/DB_0_%T%U.bkp";
CROSSCHECK ARCHIVELOG ALL;
DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;
sql "alter system archive log current";
backup archivelog all format "/backup/data/arch_%T%U.arc";
delete noprompt backup of archivelog until time "sysdate-8";
backup current controlfile format "/backup/data/ctl_%T%U.ctl";
CROSSCHECK BACKUP;
CROSSCHECK backupset;
DELETE NOPROMPT EXPIRED BACKUP;
DELETE NOPROMPT EXPIRED BACKUPSET;
REPORT OBSOLETE;
delete NOPROMPT obsolete device type disk;
RELEASE CHANNEL ch1;
RELEASE CHANNEL ch2;
}
exit
EOF
rman_backup_1.sh
#!/bin/bash
source ~/.bash_profile
rq=`date +%Y%m%d`
rman target / log /backup/log/rmanbackup_${rq}.log append<<EOF
set encryption on identified by "u9j04hkUvfRu" only;
run{
ALLOCATE CHANNEL ch1 TYPE disk;
ALLOCATE CHANNEL ch2 TYPE disk;
BACKUP INCREMENTAL LEVEL 1 TAG "DB1" DATABASE FORMAT "/backup/data/DB_1_%T%U.bkp";
CROSSCHECK ARCHIVELOG ALL;
DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;
sql "alter system archive log current";
backup archivelog all format "/backup/data/arch_%T%U.arc";
delete noprompt backup of archivelog until time "sysdate-8";
backup current controlfile format "/backup/data/ctl_%T%U.ctl";
CROSSCHECK BACKUP;
CROSSCHECK backupset;
DELETE NOPROMPT EXPIRED BACKUP;
DELETE NOPROMPT EXPIRED BACKUPSET;
REPORT OBSOLETE;
delete NOPROMPT obsolete device type disk;
RELEASE CHANNEL ch1;
RELEASE CHANNEL ch2;
}
exit
EOF
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/9493.html