转载

RMAN_逻辑坏块物理坏块_VALIDATE/recover

逻辑坏块的理解:就是内容错乱了,文件没有任何问题,例如dbwr告诉操作系统IO要写1234,但是IO出现问题导致写成了0000。
DATAGUARD环境下主库有逻辑坏块,备库不会同时生成逻辑坏块,IO是操作系统层面的独立于数据库,因为主库的IO出了问题不代表备库的IO也出问题

interblock corruption:A type of block corruption in which the corruption occurs between blocks rather than within the block itself. This type of corruption can only be logical corruption.
intrablock corruption:A type of block corruption in which the corruption occurs within the block itself. this type of corruption can be either a physical corruption or logical corruption.


VALIDATE主要有以下三者模式
VALIDATE
BACKUP ... VALIDATE
RESTORE ... VALIDATE

VALIDATE单独使用会同时检查物理坏块和逻辑坏块,可以检查数据文件也可以检查备份文件
You can use the VALIDATE command to manually check for physical and logical corruptions in database files. This command performs the same types of checks as BACKUP VALIDATE, but VALIDATE can check a larger selection of objects. For example, you can validate individual blocks with the VALIDATE DATAFILE ... BLOCK command.

RMAN> VALIDATE DATABASE;--验证整个数据库
RMAN> VALIDATE BACKUPSET 22;--验证某个备份文件
RMAN> VALIDATE TABLESPACE USERS;--验证某个表空间
RMAN> VALIDATE DATAFILE 1;--验证某个数据文件
RMAN> VALIDATE DATAFILE 1 BLOCK 10;--验证某个数据文件中的某个块


BACKUP VALIDATE只是检查数据文件(不可检查备份文件),可以选择检查物理块或逻辑块,默认检查物理块,不会真正去做备份的动作
You can use the BACKUP VALIDATE command to do the following:
Check datafiles for physical and logical block corruption
Confirm that all database files exist and are in the correct locations

RMAN> BACKUP VALIDATE DATABASE ARCHIVELOG ALL;--This command checks for physical corruptions only.检查物理坏块,只检查不备份
RMAN> BACKUP VALIDATE CHECK LOGICAL DATABASE ARCHIVELOG ALL;--检查逻辑坏块,只检查不备份

RMAN> BACKUP DATABASE;--没有VILIDATE,表示做备份的动作,备份的同时检查物理坏块,RMAN备份时默认检查物理坏块
RMAN> BACKUP CHECK LOGICAL DATABASE;--没有VILIDATE,表示做备份的动作备份的同时检查逻辑坏块


RESTORE VALIDATE纯粹的检查备份文件
You can run RESTORE ... VALIDATE to test whether RMAN can restore a specific file or set of files from a backup.

RMAN> RESTORE VALIDATE DATABASE;--检查数据库,推荐使用这个命令,因为RESTORE VALIDATE可以模糊匹配后面跟什么参数。
RMAN> RESTORE DATABASE VALIDATE;--检查数据库,和上面效果一样
RMAN> RESTORE ARCHIVELOG ALL VALIDATE;--检查归档日志文件




Recover无法修复物理坏块
RMAN> recover datafile 1 block 5;--修复某个具体的逻辑坏块
RMAN> recover corruption list;--修复所有记录在V$DATABASE_BLOCK_CORRUPTION中的逻辑坏块
recover all blocks logged in V$DATABASE_BLOCK_CORRUPTION

V$DATABASE_BLOCK_CORRUPTION displays information about database blocks that were corrupted after the last backup.
V$DATABASE_BLOCK_CORRUPTION view records intrablock corruptions
个人疑惑:rman备份默认检查物理坏块,所以貌似感觉recover corruption list没啥大用啊



V$RMAN_BACKUP_JOB_DETAILS可以看出rman是否成功
select * from V$RMAN_BACKUP_JOB_DETAILS where status='FAILED'
正文到此结束
Loading...