VALIDATE DATABASE

摘自:http://www.oracle.com/technetwork/cn/articles/sql/11g-rman-094332-zhs.html


主动的运行状况检查

知道数据库运行良好并且没有受损块,会让您晚上睡得更好。但是如何才能做到这一点?由于受损块仅在它们被访问时才会暴露出来,因此您希望提前识别它们并可以在用户收到错误消息之前使用简单的命令修复它们。

工具 dbverify 可以完成此工作,但是使用起来可能有点不方便,因为它需要编写一个包含所有数据文件和大量参数的脚本文件。输出还需要扫描和翻译。在 Oracle Database 11g 中,RMAN 中的一个新命令 VALIDATE DATABASE 通过检查数据库块中的物理损坏极大地简化了该操作。如果检测到损坏,将记录到自动诊断信息库中。然后,RMAN 将生成输出,下面显示了部分输出:

RMAN> validate database;
 
Starting validate at 09-SEP-07
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=110 device type=DISK
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00002 name=/home/oracle/oradata/ODEL11/sysaux01.dbf
input datafile file number=00001 name=/home/oracle/oradata/ODEL11/system01.dbf
input datafile file number=00003 name=/home/oracle/oradata/ODEL11/undotbs01.dbf
input datafile file number=00004 name=/home/oracle/oradata/ODEL11/users01.dbf
channel ORA_DISK_1: validation complete, elapsed time: 00:02:18
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
----   ------    --------------        ------------       ---------------        ----------
1    OK     0              12852        94720           5420717   
  File Name: /home/oracle/oradata/ODEL11/system01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- --------------          ----------------
  Data       0              65435           
  Index      0              11898           
  Other      0              4535            
 
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
----   ------    --------------        ------------ -     --------------         ----------
2    OK     0              30753        115848          5420730   
  File Name: /home/oracle/oradata/ODEL11/sysaux01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- --------------          ----------------
  Data       0              28042           
  Index      0              26924           
  Other      0              30129           
 
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
----   ------    --------------        ------------       ---------------        ----------
3    OK     0              5368         25600           5420730   
  File Name: /home/oracle/oradata/ODEL11/undotbs01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- --------------      ----------------
  Data       0              0               
  Index      0              0               
  Other      0              20232           
 
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
4    OK     0              2569         12256           4910970   

...  
                              
<snipped>
...
或者,如果出现故障,您将在上面的输出部分中看到:
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
----   ------    --------------        ------------       ---------------        ----------
7    FAILED 0              0            128             5556154   
  File Name: /home/oracle/oradata/ODEL11/test01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- --------------        ----------------
  Data       0              108             
  Index      0              0               
  Other      10             20              

您还可以验证特定的表空间:
RMAN> validate tablespace users;

或者,验证数据文件:
RMAN> validate datafile 1;

或者,还可以验证数据文件中的一个块:
RMAN> validate datafile 4 block 56;

但是, VALIDATE  命令的验证范围远远不只是数据文件。您可以验证 spfile、controlfilecopy、恢复文件、快速恢复区,等等。

你可能感兴趣的:(database,validate)