分类: Oracle
2012-02-16 14:30:39
先了解一下数据库的内容与结构
计划采用rman备份, 准备一下如果开始备份, 给备份内容的建议和需要修改的配置清单.
一、 修为服务器为归档日志模式
二、修改rman的配置
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 15 DAYS;
备份保存15天
CONFIGURE CONTROLFILE AUTOBACKUP ON;
备份时自动备份控制文件
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/orarecover/backup/control/%F';
控制文件备份位置为:'/orarecover/backup/control/%F
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/orarecover/backup/tp_%u_%s_%p';
数据备份位置为:/orarecover/backup/tp_%u_%s_%p
创建/orarecover/backup/control,/orarecover/backup/archivelog目录
三、3个等级的备份脚本存放位置:/rman/script/baklevel0 ,baklevel1,baklevel2
每周的0级备份:
crosscheck backupset of archivelog all ;
delete noprompt expired archivelog all; 检查删除过期的归档日志
backup
incremental level 0
tag backup_inc0
database
include current controlfile ; 开始0级备份包括现在的控制文件
sql "alter system archive log current"; 切换当前日志并且自动归档
backup format='/orarecover/backup/archivelog/%d_%s.arc' archivelog all delete all input;
备份现在归档日志,并且删除已经备份的归档日志
alter database backup controlfile to trace;
备份可以重建的控制文件脚本
重建控制文件脚本目录
/u01/app/diag/rdbms/site2/site
2/trace
每周的1级和2级备份:
backup
incremental level 1
tag backup_inc1
database
include current controlfile ;
3个等级执行脚本存放位置:/rman/script/rmanlevel0.sh,rmanlevel2.sh,rmanlevel1.sh
export ORACLE_HOME='/u01/app/oracle/product/10.2.0.1';
export ORACLE_SID='site2';
/u01/app/oracle/product/10.2.0.1/bin/rman target / cmdfile=/rman/script/baklevel0 log=/rman/script/archivelog/bakl0.log append
计划任务:
0 2 * * * find /u01/app/oracle/flash_recovery_area/TEST/archivelog -mtime +2 -exec rm -f {} \;
45 2 * * 0 /home/oracle/script/rmanlevel0.sh
45 2 * * 1 /home/oracle/script/rmanlevel2.sh
45 2 * * 2 /home/oracle/script/rmanlevel2.sh
45 2 * * 3 /home/oracle/script/rmanlevel1.sh
45 2 * * 4 /home/oracle/script/rmanlevel2.sh
45 2 * * 5 /home/oracle/script/rmanlevel2.sh
45 2 * * 6 /home/oracle/script/rmanlevel2.sh
四、数据闪回
create flashback archive default fbda_1 tablespace USERS quota 800M retention 1 year;