1、Rman 全备与 0、1 级增量备份时间: 2013-10-9 分类: ORACLE 备份恢复 作者: Dennis 450 次浏览TAGS: RMAN 增量备份 rman 全备与 0、1 级增量备份1、简单来说, rman 全库备份只需要 backup database;(未压缩),或者 backup as compressed backupset database; (压缩)。即可完全备份,如下:RMAN backup database;Starting backup at 08-OCT-13using target database control file instead of rec
2、overy catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=34 device type=DISKchannel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbfinput datafile file number=
3、00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbfinput datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbfinput datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbfchannel ORA_DISK_1: starting piece 1 at 08-OCT-13channel ORA_DISK_1: finished piece 1 at 0
4、8-OCT-13piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_nnndf_TAG20131008T221828_95851ofr_.bkp tag=TAG20131008T221828 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:55channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: sp
5、ecifying datafile(s) in backup setincluding current control file in backup setincluding current SPFILE in backup setchannel ORA_DISK_1: starting piece 1 at 08-OCT-13channel ORA_DISK_1: finished piece 1 at 08-OCT-13piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_ncsnf_
6、TAG20131008T221828_95853fmr_.bkp tag=TAG20131008T221828 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 08-OCT-13RMAN可以看出备份集以及备份保存路径等信息,这部分信息都在 show all;的参数中进行设置,这里都是默认的参数;由于是 nocatalog 模式,备份信息都存在控制文件中.可以使用操作系统命令查看相关的控制文件信息:oracleoracledba $strings /u01/
7、app/oracle/oradata/orcl/control01.ctlDISK/u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_nnndf_TAG20131008T221828_95851ofr_.bkpTAG20131008T221828DISK/u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_ncsnf_TAG20131008T221828_95853fmr_.bkpTAG20131008T221828DISK/u01/
8、app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_nnndf_TAG20131008T221828_95851ofr_.bkpTAG20131008T221828使用 list backupset;命令查看备份信息:RMAN list backupset;using target database control file instead of recovery catalogList of Backup Sets=BS Key Type LV Size Device Type Elapsed Time Completi
9、on Time- - - - - - -1 Full 1.03G DISK 00:00:50 08-OCT-13 BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20131008T221828Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_nnndf_TAG20131008T221828_95851ofr_.bkpList of Datafiles in backup set 1File LV Type Ckp SCN Ckp Ti
10、me Name- - - - - -1 Full 1059012 08-OCT-13 /u01/app/oracle/oradata/orcl/system01.dbf2 Full 1059012 08-OCT-13 /u01/app/oracle/oradata/orcl/sysaux01.dbf3 Full 1059012 08-OCT-13 /u01/app/oracle/oradata/orcl/undotbs01.dbf4 Full 1059012 08-OCT-13 /u01/app/oracle/oradata/orcl/users01.dbfBS Key Type LV Siz
11、e Device Type Elapsed Time Completion Time- - - - - - -2 Full 9.36M DISK 00:00:01 08-OCT-13 BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20131008T221828Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_ncsnf_TAG20131008T221828_95853fmr_.bkpSPFILE Included: Modifica
12、tion time: 08-OCT-13SPFILE db_unique_name: ORCLControl File Included: Ckp SCN: 1059037 Ckp time: 08-OCT-13RMAN可以看出有两个备份集,每个备份集有一个备份片,恢复的时候需要用到这两个备份,可以把文件拷贝到其他目录或者磁带上保存,需要恢复的时候拷贝到原始备份的目录(即控制文件中记录的目录)即可恢复!如果需要压缩备份全库及归档日志可以执行如下命令:backup as compressed backupset database plus archivelog;2、rman 0 级增量备份:其实
13、全备和 0 级增量备份都是全备,但是也是有区别的,0 级增量备份可以用于增量备份恢复的基础,而单独的全备不能用于增量备份的恢复基础!0 级增量备份的命令如下:RMAN backup incremental level 0 database;或者RMAN backup incremental level= 0 database;RMAN backup incremental level 0 database;Starting backup at 08-OCT-13using channel ORA_DISK_1channel ORA_DISK_1: starting incremental le
14、vel 0 datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbfinput datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbfinput datafile file number=00003 name=/u01/app/oracle/oradata
15、/orcl/undotbs01.dbfinput datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbfchannel ORA_DISK_1: starting piece 1 at 08-OCT-13channel ORA_DISK_1: finished piece 1 at 08-OCT-13piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_nnnd0_TAG20131008T225334_
16、95873gfh_.bkp tag=TAG20131008T225334 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:45channel ORA_DISK_1: starting incremental level 0 datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setincluding current control file in backup setincluding current SP
17、FILE in backup setchannel ORA_DISK_1: starting piece 1 at 08-OCT-13channel ORA_DISK_1: finished piece 1 at 08-OCT-13piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_ncsn0_TAG20131008T225334_95874wqs_.bkp tag=TAG20131008T225334 comment=NONEchannel ORA_DISK_1: backup set
18、 complete, elapsed time: 00:00:01Finished backup at 08-OCT-13RMAN list backupset;List of Backup Sets=BS Key Type LV Size Device Type Elapsed Time Completion Time- - - - - - -4 Incr 0 1.03G DISK 00:00:43 08-OCT-13 BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20131008T225334Piece Name: /u01/app/
19、oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_nnnd0_TAG20131008T225334_95873gfh_.bkpList of Datafiles in backup set 4File LV Type Ckp SCN Ckp Time Name- - - - - -1 0 Incr 1060153 08-OCT-13 /u01/app/oracle/oradata/orcl/system01.dbf2 0 Incr 1060153 08-OCT-13 /u01/app/oracle/oradata/orcl/sy
20、saux01.dbf3 0 Incr 1060153 08-OCT-13 /u01/app/oracle/oradata/orcl/undotbs01.dbf4 0 Incr 1060153 08-OCT-13 /u01/app/oracle/oradata/orcl/users01.dbfBS Key Type LV Size Device Type Elapsed Time Completion Time- - - - - - -5 Incr 0 9.36M DISK 00:00:01 08-OCT-13 BP Key: 5 Status: AVAILABLE Compressed: NO
21、 Tag: TAG20131008T225334Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_ncsn0_TAG20131008T225334_95874wqs_.bkpSPFILE Included: Modification time: 08-OCT-13SPFILE db_unique_name: ORCLControl File Included: Ckp SCN: 1060170 Ckp time: 08-OCT-13list backupset 结果可以看出,全备和 0
22、级增量备份在 type 上的区别!同理,可以对数据库做 1 级增量备份,命令如下:RMAN backup incremental level 1 database;此时 rman 需要对比 0 级增量备份后到执行 1 级增量备份时候的数据变化情况,备份出来的备份大小由数据更改的多少而定!RMAN backup incremental level 1 database;Starting backup at 08-OCT-13using channel ORA_DISK_1channel ORA_DISK_1: starting incremental level 1 datafile backu
23、p setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbfinput datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbfinput datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbfi
24、nput datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbfchannel ORA_DISK_1: starting piece 1 at 08-OCT-13channel ORA_DISK_1: finished piece 1 at 08-OCT-13piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_nnnd1_TAG20131008T230442_9587rd4t_.bkp tag=TA
25、G20131008T230442 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:35channel ORA_DISK_1: starting incremental level 1 datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setincluding current control file in backup setincluding current SPFILE in backup setch
26、annel ORA_DISK_1: starting piece 1 at 08-OCT-13channel ORA_DISK_1: finished piece 1 at 08-OCT-13piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_ncsn1_TAG20131008T230442_9587shm2_.bkp tag=TAG20131008T230442 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed t
27、ime: 00:00:01Finished backup at 08-OCT-13RMAN list backupset;List of Backup Sets=BS Key Type LV Size Device Type Elapsed Time Completion Time- - - - - - -4 Incr 0 1.03G DISK 00:00:43 08-OCT-13 BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20131008T225334Piece Name: /u01/app/oracle/fast_recovery
28、_area/ORCL/backupset/2013_10_08/o1_mf_nnnd0_TAG20131008T225334_95873gfh_.bkpList of Datafiles in backup set 4File LV Type Ckp SCN Ckp Time Name- - - - - -1 0 Incr 1060153 08-OCT-13 /u01/app/oracle/oradata/orcl/system01.dbf2 0 Incr 1060153 08-OCT-13 /u01/app/oracle/oradata/orcl/sysaux01.dbf3 0 Incr 1
29、060153 08-OCT-13 /u01/app/oracle/oradata/orcl/undotbs01.dbf4 0 Incr 1060153 08-OCT-13 /u01/app/oracle/oradata/orcl/users01.dbfBS Key Type LV Size Device Type Elapsed Time Completion Time- - - - - - -5 Incr 0 9.36M DISK 00:00:01 08-OCT-13 BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20131008T22
30、5334Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_ncsn0_TAG20131008T225334_95874wqs_.bkpSPFILE Included: Modification time: 08-OCT-13SPFILE db_unique_name: ORCLControl File Included: Ckp SCN: 1060170 Ckp time: 08-OCT-13BS Key Type LV Size Device Type Elapsed Time Com
31、pletion Time- - - - - - -6 Incr 1 8.53M DISK 00:00:26 08-OCT-13 BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20131008T230442Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_nnnd1_TAG20131008T230442_9587rd4t_.bkpList of Datafiles in backup set 6File LV Type Ckp SCN
32、 Ckp Time Name- - - - - -1 1 Incr 1060699 08-OCT-13 /u01/app/oracle/oradata/orcl/system01.dbf2 1 Incr 1060699 08-OCT-13 /u01/app/oracle/oradata/orcl/sysaux01.dbf3 1 Incr 1060699 08-OCT-13 /u01/app/oracle/oradata/orcl/undotbs01.dbf4 1 Incr 1060699 08-OCT-13 /u01/app/oracle/oradata/orcl/users01.dbfBS
33、Key Type LV Size Device Type Elapsed Time Completion Time- - - - - - -7 Incr 1 9.36M DISK 00:00:01 08-OCT-13 BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20131008T230442Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2013_10_08/o1_mf_ncsn1_TAG20131008T230442_9587shm2_.bkpSPFILE Included: Modification time: 08-OCT-13SPFILE db_unique_name: ORCLControl File Included: Ckp SCN: 1060711 Ckp time: 08-OCT-13RMAN以上 3 种备份生成的文件,可以通过 list backupset 命令查看相关区别!同样备份信息可以在控制文件中查看!