RMAN作为Oracle备份与恢复工具,为我们提供了强大的功能,其中包括对数据文件的物理和逻辑检测以及备份文件的有效性检测。
首先,来看一下RMAN对数据文件的检测。我们知道,RMAN在备份数据时,会将数据读入读缓存,然会将数据从读缓存写入写缓存并最终写入数据库。在从读缓存到写缓存的过程中,RMAN会进行物理一致性的检测(db_block_checksum未true)和逻辑一致性检测(使用了check logical选项)。例如:
SQL> show parameter db_block
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_block_buffers integer 0
db_block_checking string FALSE
db_block_checksum string TRUE
db_block_size integer 8192
SQL>
RMAN> backup tablespace test1;
Starting backup at 2014-11-06 15:12:49
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00005 name=/home/app/oraten/oradata/oraten/test01.dbf
channel ORA_DISK_1: starting piece 1 at 2014-11-06 15:12:50
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 11/06/2014 15:12:51
ORA-19566: exceeded limit of 0 corrupt blocks for file /home/app/oraten/oradata/oraten/test01.dbf
有时,我们仅仅希望验证一下数据文件是否可以备份,而不想进行真正的备份,这是我们就可以使用validate命令了,如
RMAN> backup validate database;
Starting backup at 2014-11-06 15:14:23
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/home/app/oraten/oradata/oraten/system01.dbf
input datafile fno=00003 name=/home/app/oraten/oradata/oraten/sysaux01.dbf
input datafile fno=00002 name=/home/app/oraten/oradata/oraten/undotbs01.dbf
input datafile fno=00005 name=/home/app/oraten/oradata/oraten/test01.dbf
input datafile fno=00004 name=/home/app/oraten/oradata/oraten/users01.dbf
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 2014-11-06 15:14:27
注意,这里并没有发现test01.dbf的物理损坏块,个人认为,rman仅仅只是将数据文件读入了读缓存,而没有进行下面的操作,也就是说对于物理块的检测其功能是有限的,但,我们可以用其来检测物理文件的可读性和位置等。
--------------------------------------推荐阅读 --------------------------------------
RMAN 配置归档日志删除策略
Oracle基础教程之通过RMAN复制数据库
RMAN备份策略制定参考内容
RMAN备份学习笔记
Oracle数据库备份加密 RMAN加密
--------------------------------------分割线 --------------------------------------
更多详情见请继续阅读下一页的精彩内容: