阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Oracle增量和全量备份方案

256次阅读
没有评论

共计 1813 个字符,预计需要花费 5 分钟才能阅读完成。

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

rman_backup_0.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 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

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计1813字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中