首先:设置归档
1.
sql>alter system set log_archive_dest_1='location=/oracle/oradata/log/archive_log';
2.关闭数据库
SQL> shutdown immediate
3.启动数据mount状态:
SQL> startup mount;
4、修改数据库为归档模式:
SQL> alter database archivelog;
5、打开数据库,查询:
SQL> alter database open;
修改日志文件命名格式:
SQL> alter system set log_archive_max_processes = 5;
SQL> alter system set log_archive_format = "archive_%t_%s_%r.log" scope=spfile; --修改后需重启数据库
alter system switch logfile; --归档当前日志
删除归档日志-- 一般RMAN后删除
delete archivelog all completed before 'SYSDATE-7';
---添加联机日志
alter database add logfile group 5 ('/oracle/oradata/log/online_log/redo05_01.log','/oracle/oradata/tsh1/redo05_02.log') size 100m;
alter database add logfile group 6 ('/oracle/oradata/log/online_log/redo06_01.log','/oracle/oradata/tsh1/redo06_02.log') size 100m;
alter database add logfile group 7 ('/oracle/oradata/log/online_log/redo07_01.log','/oracle/oradata/tsh1/redo07_02.log') size 100m;
alter database add logfile group 8 ('/oracle/oradata/log/online_log/redo08_01.log','/oracle/oradata/tsh1/redo08_02.log') size 100m;
alter database add logfile group 1 ('/oracle/oradata/log/online_log/redo01_01.log','/oracle/oradata/tsh1/redo01_02.log') size 50m;
alter database add logfile group 2 ('/oracle/oradata/log/online_log/redo02_01.log','/oracle/oradata/tsh1o/redo02_02.log') size 50m;
alter database add logfile group 3 ('/oracle/oradata/log/online_log/redo03_01.log','/oracle/oradata/tsh1/redo03_02.log') size 50m;
alter database add logfile group 4 ('/oracle/oradata/log/online_log/redo04_01.log','/oracle/oradata/tsh1/redo04_02.log') size 50m;
delete archivelog all completed before 'SYSDATE+1';
--配置RMAN
configure default device type to disk; --配置为磁盘备份
configure device type disk parallelism 2; --配置两个通道进行备份
--配置各个通道备份存储的地方
configure channel 1 device type disk format '/oracle/oradata/backup1/backup_%U';
configure channel 2 device type disk format '/oracle/oradata/backup2/backup_%U';
configure controlfile autobackup on; --控制文件自动备份
configure controlfile autobackup format for device type disk to '/oracle/oradata/backup2/controlfile_backup/ctl_%F';
configure retention policy to recovery window of 7 days;
--recover window是保持所有足够的备份,可以将数据库系统恢复到最近七天内的任意时刻。任何超过最近七天的数据库备份将被标记为obsolete。
configure retention policy to redundancy 5;
--redundancy 是为了保持可以恢复的最新的5份数据库备份,任何超过最新5份的备份都将被标记为redundancy。它的默认值是1份。
configure retention policy clear;
-- 保存策略重置为默认值(冗余为1)
CONFIGURE RETENTION POLICY TO NONE;
创建恢复目录
如果只有很少的一些数据库,则恢复目录就可能不值得花费额外的时间和精力在它上面了
---详细参考 :
RMAN 系列(二) ---- RMAN 设置和配置
http://blog.csdn.net/tianlesoftware/article/details/5674309
如何 搭建 RMAN 备份平台
http://blog.csdn.net/tianlesoftware/article/details/5740896
在此感谢 tianlesoftware