ITPub博客

首页 > 数据库 > Oracle > 使用RMAN增量更新备份实现快速还原

使用RMAN增量更新备份实现快速还原

原创 Oracle 作者:hooca 时间:2016-03-31 16:49:34 0 删除 编辑
OS:Oracle Linux
DB: Oracle 11.2.0.4.0

增量更新备份:先做一个完整的映像备份,然后定期做增量更新备份,并将其应用到之前的完整映像备份,以获得更新版备份。还原时直接切换到映像备份。

备份前最好设置RMAN的autobackup,可能需要恢复控制文件。

在归档模式下的操作:

第一次备份:

RMAN下执行

点击(此处)折叠或打开

  1. backup incremental level 1 for recover of copy with tag 'FLASH' database plus archivelog;
# 备份映像默认在FRA中的datafile目录下
第一次将会做完整映像备份。

第二次:

点击(此处)折叠或打开

  1. backup incremental level 1 for recover of copy with tag 'FLASH' database plus archivelog;
  2. recover copy of database with tag 'FLASH';

测试还原:
先启动到mount模式,再切换数据库,进入RMAN

点击(此处)折叠或打开

  1. shutdown immediate
  2. startup mount
  3. switch database to copy;
接下来,因为是在归档模式下,所以需要对数据库recover,相关参考:http://blog.itpub.net/22621861/viewspace-1685967/

点击(此处)折叠或打开

  1. run {
    set until sequence 7 thread 1;
    recover database;
    alter database open resetlogs;
    }
此时,如果在RMAN下reporte obsolete,原来的数据文件将作为过期的映像备份,可以delete obsolete删除。


重新切换回原来的数据文件路径

先做映像备份

点击(此处)折叠或打开

  1. RMAN> backup as copy database format '/u01/app/oracle/oradata/prod/%U.dbf'
启动到mount模式,切换数据库

点击(此处)折叠或打开

  1. RMAN> shutdown immediate
  2. RMAN> startup mount
  3. RMAN> switch database to copy;
recover,open

点击(此处)折叠或打开

  1. RMAN> recover database;
  2. RMAN> alter database open;
另外,建议验证备份

点击(此处)折叠或打开

  1. RMAN> validate datafilecopy all;
Starting validate at 2016-04-01 10:50:03
using channel ORA_DISK_1
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: including datafile copy of datafile 00005 in backup set
input file name=/u01/app/oracle/flash_recovery_area/PROD/datafile/o1_mf_sh_chspst8m_.dbf
channel ORA_DISK_1: including datafile copy of datafile 00004 in backup set
input file name=/u01/app/oracle/flash_recovery_area/PROD/datafile/o1_mf_users_chspy1xh_.dbf
channel ORA_DISK_1: including datafile copy of datafile 00001 in backup set
input file name=/u01/app/oracle/flash_recovery_area/PROD/datafile/o1_mf_system_chspzhjs_.dbf
channel ORA_DISK_1: including datafile copy of datafile 00002 in backup set
input file name=/u01/app/oracle/flash_recovery_area/PROD/datafile/o1_mf_sysaux_chsq095k_.dbf
channel ORA_DISK_1: including datafile copy of datafile 00003 in backup set
input file name=/u01/app/oracle/flash_recovery_area/PROD/datafile/o1_mf_undotbs1_chsq12rn_.dbf
channel ORA_DISK_1: validation complete, elapsed time: 00:00:26
List of Datafile Copies
=======================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
1    OK     0              16052        41600           4410291   
  File Name: /u01/app/oracle/flash_recovery_area/PROD/datafile/o1_mf_system_chspzhjs_.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              16866           
  Index      0              5514            
  Other      0              3168            


File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
2    OK     0              4459         41600           4410083   
  File Name: /u01/app/oracle/flash_recovery_area/PROD/datafile/o1_mf_sysaux_chsq095k_.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              16335           
  Index      0              15214           
  Other      0              5592            


File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
3    OK     0              1            34816           4410289   
  File Name: /u01/app/oracle/flash_recovery_area/PROD/datafile/o1_mf_undotbs1_chsq12rn_.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              0               
  Index      0              0               
  Other      0              34815           


File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
4    OK     0              63873        64000           3153      
  File Name: /u01/app/oracle/flash_recovery_area/PROD/datafile/o1_mf_users_chspy1xh_.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              0               
  Index      0              0               
  Other      0              127             


File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
5    OK     0              19125        239232          4409306   
  File Name: /u01/app/oracle/flash_recovery_area/PROD/datafile/o1_mf_sh_chspst8m_.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              179405          
  Index      0              38502           
  Other      0              2200            


Finished validate at 2016-04-01 10:50:29
最后,可以delete obsolete,删除过期备份。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22621861/viewspace-2073201/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-09-29

  • 博文量
    215
  • 访问量
    402973