4.2.4 完全备份

完全备份不同于完整数据库备份。完全备份可以包含单个数据文件或表空间,而完整数据库备份包括数据库中的所有数据文件。对于表空间或归档重做日志文件的完全备份,RMAN会将所有数据块复制到备份集中;会忽略从未用过的块。而对于映像副本而言,无论块是否用过,都会将所有块包含在内。

提示:

单个数据库对象的完全备份是完整数据库备份的逻辑子集。在执行数据库恢复时,RMAN可能使用更新的表空间完全备份,而不使用最新备份段(来自完整数据库备份的更早版本)。其原因在于,完整数据库备份是整个数据库的快照。插入数据文件,并使自动恢复过程重新同步数据文件、重做日志条目和控制文件中的数据。

对单个数据库对象进行完全备份与完整数据库备份十分相似,但是在BACKUP命令中使用TABLESPACE关键字替代DATABASE关键字。这样做的原因是正在单独备份表空间。

练习4-2

执行两个表空间的完全备份

在本练习中,将在同一个BACKUP命令中执行USERS和SYSAUX表空间的完全备份。

(1)连接到RMAN并运行BACKUP命令,命令中的表空间通过逗号分隔:

        RMAN> backup tablespace sysaux, users;

        Starting backup at 25-FEB-14
        using channel ORA_DISK_1
        using channel ORA_DISK_2
        using channel ORA_DISK_3
        using channel ORA_DISK_4
        channel ORA_DISK_1: starting compressed full datafile backup set
        channel ORA_DISK_1: specifying datafile(s) in backup set
        input datafile file number=00003
            name=+DATA/RPT12C/DATAFILE/sysaux.257.826650753
        channel ORA_DISK_1: starting piece 1 at 25-FEB-14
        channel ORA_DISK_2: starting compressed full datafile backup set
        channel ORA_DISK_2: specifying datafile(s) in backup set
        input datafile file number=00005
            name=+DATA/RPT12C/DATAFILE/users.269.826931347
        channel ORA_DISK_2: starting piece 1 at 25-FEB-14
        channel ORA_DISK_3: starting compressed full datafile backup set
        channel ORA_DISK_3: specifying datafile(s) in backup set
        input datafile file number=00006
            name=+DATA/RPT12C/DATAFILE/users.259.826650843
        channel ORA_DISK_3: starting piece 1 at 25-FEB-14
        channel ORA_DISK_2: finished piece 1 at 25-FEB-14
        piece handle=+RECOV/RPT12C/BACKUPSET/2014_02_25/
            nnndf0_tag20140225t092602_0.286.840446763 tag=TAG20140225T092602
            comment=NONE
        channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01
        channel ORA_DISK_3: finished piece 1 at 25-FEB-14
        piece handle=+RECOV/RPT12C/BACKUPSET/2014_02_25/
            nnndf0_tag20140225t092602_0.285.840446763 tag=TAG20140225T092602
            comment=NONE
        channel ORA_DISK_3: backup set complete, elapsed time: 00:00:01
        channel ORA_DISK_1: finished piece 1 at 25-FEB-14
        piece handle=+RECOV/RPT12C/BACKUPSET/2014_02_25/
            nnndf0_tag20140225t092602_0.287.840446763 tag=TAG20140225T092602
            comment=NONE
        channel ORA_DISK_1: backup set complete, elapsed time: 00:01:35
        Finished backup at 25-FEB-14

        RMAN>

注意,除非将CONTROLFILE AUTOBACKUP设置为ON,或在备份中添加了datafile #1,否则备份中不包含控制文件和SPFILE;默认情况下,将其设置为OFF,如本例所示。

增量备份策略不涉及完全备份;也就是说,完全备份独立于为同一对象执行的其他增量备份。下一节将介绍如何制定增量备份策略。