ITPub博客

首页 > 数据库 > Oracle > 用增量备份定期恢复image copy backup

用增量备份定期恢复image copy backup

原创 Oracle 作者:warmbreeze 时间:2016-10-11 10:10:24 0 删除 编辑
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

备份脚本:
run {
      recover copy of database with tag 'copy_backup' until time 'SYSDATE-1';
      backup incremental level 1 for recover of copy with tag 'copy_backup' database;
      backup tag 'copy_backup' archivelog all not backed up delete all input;
      delete noprompt obsolete device type disk;
    }

recover copy of database with tag 'copy_backup' until time 'SYSDATE-1';
    恢复image copy到一天前,第一次执行此脚本的时候会生成一份level 0 的image copy
backup incremental level 1 for recover of copy with tag 'copy_backup' database;
   生成level 1的增量备份
backup tag 'copy_backup' archivelog all not backed up delete all input;
   备份归档
delete noprompt obsolete device type disk;
   删除过期备份

在dataguard环境下,如果用backup tag 'copy_backup' archivelog all delete all input; 
可能会报错:RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
如果用backup tag 'copy_backup' archivelog all not backed up delete all input; 不会报RMAN-08137
这是因为bug: 16692232

使用image copy backup:
RMAN> startup mount
connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area     768352256 bytes

Fixed Size                     2257072 bytes
Variable Size                532680528 bytes
Database Buffers             226492416 bytes
Redo Buffers                   6922240 bytes

RMAN> switch database to copy;


datafile 1 switched to datafile copy "/home/oracle/backup/full_data_D-DB1_I-1511824882_TS-SYSTEM_FNO-1_3jrgoj4p"
datafile 2 switched to datafile copy "/home/oracle/backup/full_data_D-DB1_I-1511824882_TS-SYSAUX_FNO-2_3krgoj6q"
datafile 3 switched to datafile copy "/home/oracle/backup/full_data_D-DB1_I-1511824882_TS-TBS1_FNO-3_3mrgoj8o"
datafile 4 switched to datafile copy "/home/oracle/backup/full_data_D-DB1_I-1511824882_TS-USERS_FNO-4_3irgoiqj"
datafile 5 switched to datafile copy "/home/oracle/backup/full_data_D-DB1_I-1511824882_TS-BWD_FNO-5_3orgoj96"
datafile 7 switched to datafile copy "/home/oracle/backup/full_data_D-DB1_I-1511824882_TS-UNDOTBS3_FNO-7_3lrgoj8h"
datafile 8 switched to datafile copy "/home/oracle/backup/full_data_D-DB1_I-1511824882_TS-AAA_FNO-8_3prgoj97"

RMAN>  recover database;
Starting recover at 26-SEP-16
configuration for DISK channel 2 is ignored
configuration for DISK channel 3 is ignored
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=129 device type=DISK
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /home/oracle/backup/full_data_D-DB1_I-1511824882_TS-SYSTEM_FNO-1_3jrgoj4p
destination for restore of datafile 00002: /home/oracle/backup/full_data_D-DB1_I-1511824882_TS-SYSAUX_FNO-2_3krgoj6q
destination for restore of datafile 00003: /home/oracle/backup/full_data_D-DB1_I-1511824882_TS-TBS1_FNO-3_3mrgoj8o
destination for restore of datafile 00004: /home/oracle/backup/full_data_D-DB1_I-1511824882_TS-USERS_FNO-4_3irgoiqj
destination for restore of datafile 00005: /home/oracle/backup/full_data_D-DB1_I-1511824882_TS-BWD_FNO-5_3orgoj96
destination for restore of datafile 00007: /home/oracle/backup/full_data_D-DB1_I-1511824882_TS-UNDOTBS3_FNO-7_3lrgoj8h
destination for restore of datafile 00008: /home/oracle/backup/full_data_D-DB1_I-1511824882_TS-AAA_FNO-8_3prgoj97
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/full_3srgojmi_1_1
channel ORA_DISK_1: piece handle=/home/oracle/backup/full_3srgojmi_1_1 tag=SNAPDB_INCR_BACKUP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01


starting media recovery


archived log for thread 1 with sequence 1738 is already on disk as file /home/oracle/arch/db1/1_1738_917961266.dbf
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=1731
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=1732
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/full_3urgok0c_1_1
channel ORA_DISK_1: piece handle=/home/oracle/backup/full_3urgok0c_1_1 tag=SNAPDB_INCR_BACKUP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
archived log file name=/home/oracle/arch/db1/1_1731_917961266.dbf thread=1 sequence=1731
archived log file name=/home/oracle/arch/db1/1_1732_917961266.dbf thread=1 sequence=1732
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=1733
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/full_3vrgok54_1_1
channel ORA_DISK_1: piece handle=/home/oracle/backup/full_3vrgok54_1_1 tag=SNAPDB_INCR_BACKUP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/home/oracle/arch/db1/1_1733_917961266.dbf thread=1 sequence=1733
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=1734
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/full_40rgok97_1_1
channel ORA_DISK_1: piece handle=/home/oracle/backup/full_40rgok97_1_1 tag=SNAPDB_INCR_BACKUP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/home/oracle/arch/db1/1_1734_917961266.dbf thread=1 sequence=1734
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=1735
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=1736
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/full_42rgokci_1_1
channel ORA_DISK_1: piece handle=/home/oracle/backup/full_42rgokci_1_1 tag=SNAPDB_INCR_BACKUP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/home/oracle/arch/db1/1_1735_917961266.dbf thread=1 sequence=1735
archived log file name=/home/oracle/arch/db1/1_1736_917961266.dbf thread=1 sequence=1736
media recovery complete, elapsed time: 00:00:09
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=1737
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/full_43rgokd3_1_1
channel ORA_DISK_1: piece handle=/home/oracle/backup/full_43rgokd3_1_1 tag=SNAPDB_INCR_BACKUP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished recover at 26-SEP-16

RMAN> alter database open;
database opened

SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/home/oracle/backup/full_data_D-DB1_I-1511824882_TS-SYSTEM_FNO-1_3jrgoj4p
/home/oracle/backup/full_data_D-DB1_I-1511824882_TS-SYSAUX_FNO-2_3krgoj6q
/home/oracle/backup/full_data_D-DB1_I-1511824882_TS-TBS1_FNO-3_3mrgoj8o
/home/oracle/backup/full_data_D-DB1_I-1511824882_TS-USERS_FNO-4_3irgoiqj
/home/oracle/backup/full_data_D-DB1_I-1511824882_TS-BWD_FNO-5_3orgoj96
/home/oracle/backup/full_data_D-DB1_I-1511824882_TS-UNDOTBS3_FNO-7_3lrgoj8h
/home/oracle/backup/full_data_D-DB1_I-1511824882_TS-AAA_FNO-8_3prgoj97




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

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

注册时间:2012-02-15

  • 博文量
    45
  • 访问量
    42515