手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Oracle增量和全量备份方案

[日期:2020-03-23] 来源:Linux社区  作者:zhijiancanxue [字体: ]

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

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

本文永久更新链接地址https://www.linuxidc.com/Linux/2020-03/162665.htm

linux
相关资讯       Oracle备份 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款