概述:
归档日志是非活动的重做日志备份,通过归档日志,可以保留所有重做历史记录,当数据库处于归档模式并进行日志切换式,后台进程ARCH会将重做日志的内容保存到归档日志中,当数据库出现介质失败时,使用数据文件备份,归档日志和重做日志可以完全恢复数据库。
1、开启归档
shutdown immediate; startup mount; alter database archivelog; alter database open;
注意:
开启归档后,如果不配置删除脚本,文件会越来越大,最终导致数据库挂起。
2、rman 全备脚本
run { allocate channel c1 type disk connect 'sys/2018@erpdb2'; allocate channel c2 type disk connect 'sys/2018@erpdb2'; backup as compressed backupset incremental level=0 database format='/bak/backuprman/db_inc0_%d_%T_%s_%p_%t' plus archivelog format '/bak/backuprman/arch_%d_%T_%s_%p_%t'; crosscheck archivelog all; crosscheck backupset; crosscheck copy; delete noprompt expired backup; delete noprompt expired copy; delete noprompt obsolete; release channel c1; release channel c2; }
3、配置rman备份时自动对配置文件备份,保留7天,配置如下
CONFIGURE RETENTION POLICY TO REDUNDANCY 7; CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/bak/backuprman/bak/%F';
4、配置定时任务,搞定
喜欢的可以点关注,我将分享更多的Oracle实战项目经验,谢谢。