天天看點

Oracle-Rman validate

11g rman validate驗證資料庫

 

  

 

 ==========================

 

  

 

 11g rman中增加validate來檢查資料庫狀況
 
 可以針對全庫、控制檔案、參數檔案等進行驗證
 

 
 validate database;
 
 validate datafile 3;
 
 validate spfile;
 
 validate current controlfile;
 
 validate backupset xxx;
 

 validate tablespace system;

 

  

 

 ======================

 

 
 [oracle@localhost 2011_11_08]$ rman target /
 
 Recovery Manager: Release 11.2.0.1.0 - Production on Tue Nov 8 11:08:39 2011
 
 Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
 
 connected to target database: DB11 (DBID=1298141643)
 

  

 

 --全庫驗證
 
 --結果包括所有檔案的狀态、是否有壞塊、空塊、使用量、以及scn
 
 --同時還有檔案中資料和索引各占用的塊等資訊
 
 --全庫驗證的結果預設包含參數檔案和控制檔案
  

 RMAN> validate database;

 

  

 

 Starting validate at 08-NOV-11
 
 using target database control file instead of recovery catalog
 
 allocated channel: ORA_DISK_1
 
 channel ORA_DISK_1: SID=41 device type=DISK
 
 channel ORA_DISK_1: starting validation of datafile
 
 channel ORA_DISK_1: specifying datafile(s) for validation
 
 input datafile file number=00001 name=/oracle/oradata/db11/db11/system01.dbf
 
 input datafile file number=00002 name=/oracle/oradata/db11/db11/sysaux01.dbf
 
 input datafile file number=00003 name=/oracle/oradata/db11/db11/undotbs01.dbf
 
 input datafile file number=00004 name=/oracle/oradata/db11/db11/users01.dbf
 
 channel ORA_DISK_1: validation complete, elapsed time: 00:00:35
 
 List of Datafiles
 
 =================
 
 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
 
 ---- ------ -------------- ------------ --------------- ----------
 
 1    OK     0              13729        87041           877449    
 
   File Name: /oracle/oradata/db11/db11/system01.dbf
 
   Block Type Blocks Failing Blocks Processed
 
   ---------- -------------- ----------------
 
   Data       0              58037           
 
   Index      0              12168           
 
   Other      0              3106           
 

 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
 
 ---- ------ -------------- ------------ --------------- ----------
 
 2    OK     0              17402        60183           877455    
 
   File Name: /oracle/oradata/db11/db11/sysaux01.dbf
 
   Block Type Blocks Failing Blocks Processed
 
   ---------- -------------- ----------------
 
   Data       0              10067           
 
   Index      0              7025            
 
   Other      0              25666          
 

 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
 
 ---- ------ -------------- ------------ --------------- ----------
 
 3    OK     0              112          9600            877455    
 
   File Name: /oracle/oradata/db11/db11/undotbs01.dbf
 
   Block Type Blocks Failing Blocks Processed
 
   ---------- -------------- ----------------
 
   Data       0              0               
 
   Index      0              0               
 
   Other      0              9488           
 

 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
 
 ---- ------ -------------- ------------ --------------- ----------
 
 4    OK     0              481          640             749391    
 
   File Name: /oracle/oradata/db11/db11/users01.dbf
 
   Block Type Blocks Failing Blocks Processed
 
   ---------- -------------- ----------------
 
   Data       0              15              
 
   Index      0              2               
 
   Other      0              142            
 

 channel ORA_DISK_1: starting validation of datafile
 
 channel ORA_DISK_1: specifying datafile(s) for validation
 
 including current control file for validation
 
 including current SPFILE in backup set
 
 channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
 
 List of Control File and SPFILE
 
 ===============================
 
 File Type    Status Blocks Failing Blocks Examined
 
 ------------ ------ -------------- ---------------
 
 SPFILE       OK     0              2               
 
 Control File OK     0              594             
 
 Finished validate at 08-NOV-11
 

 RMAN> validate datafile 3;

 

 Starting validate at 08-NOV-11
 
 using channel ORA_DISK_1
 
 channel ORA_DISK_1: starting validation of datafile
 
 channel ORA_DISK_1: specifying datafile(s) for validation
 
 input datafile file number=00003 name=/oracle/oradata/db11/db11/undotbs01.dbf
 
 channel ORA_DISK_1: validation complete, elapsed time: 00:00:03
 
 List of Datafiles
 
 =================
 
 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
 
 ---- ------ -------------- ------------ --------------- ----------
 
 3    OK     0              112          9600            877455    
 
   File Name: /oracle/oradata/db11/db11/undotbs01.dbf
 
   Block Type Blocks Failing Blocks Processed
 
   ---------- -------------- ----------------
 
   Data       0              0               
 
   Index      0              0               
 
   Other      0              9488           
 

 Finished validate at 08-NOV-11

 

 
 --驗證參數檔案
 
 --比較簡單
  

 RMAN> validate spfile;

 

  

 

 Starting validate at 08-NOV-11
 
 using channel ORA_DISK_1
 
 channel ORA_DISK_1: starting validation of datafile
 
 channel ORA_DISK_1: specifying datafile(s) for validation
 
 including current SPFILE in backup set
 
 channel ORA_DISK_1: validation complete, elapsed time: 00:00:00
 
 List of Control File and SPFILE
 
 ===============================
 
 File Type    Status Blocks Failing Blocks Examined
 
 ------------ ------ -------------- ---------------
 
 SPFILE       OK     0              2               
 
 Finished validate at 08-NOV-11
 

 
  
 

 --驗證控制檔案
 
 --與參數檔案類似
  

 RMAN> validate current controlfile;

 

  

 

 Starting validate at 08-NOV-11
 
 using channel ORA_DISK_1
 
 channel ORA_DISK_1: starting validation of datafile
 
 channel ORA_DISK_1: specifying datafile(s) for validation
 
 including current control file for validation
 
 channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
 
 List of Control File and SPFILE
 
 ===============================
 
 File Type    Status Blocks Failing Blocks Examined
 
 ------------ ------ -------------- ---------------
 
 Control File OK     0              594             
 
 Finished validate at 08-NOV-11
 

  

 

 --使用list指令可以将現存在catalog中的backupset列出
 
 --根據列出的backupset key可以對backupset進行驗證
 

  

 

 RMAN> list backupset;

 

 
 List of Backup Sets
 
 ===================
 

 
 BS Key  Type LV Size       Device Type Elapsed Time Completion Time
 
 ------- ---- -- ---------- ----------- ------------ ---------------
 
 4       Full    954.85M    DISK        00:01:26     08-NOV-11      
 
         BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20111108T112236
 
         Piece Name: /oracle/flash_recovery_area/DB11/backupset/2011_11_08/o1_mf_nnndf_TAG20111108T112236_7ck83wn9_.bkp
 
   List of Datafiles in backup set 4
 
   File LV Type Ckp SCN    Ckp Time  Name
 
   ---- -- ---- ---------- --------- ----
 
   1       Full 878265     08-NOV-11 /oracle/oradata/db11/db11/system01.dbf
 
   2       Full 878265     08-NOV-11 /oracle/oradata/db11/db11/sysaux01.dbf
 
   3       Full 878265     08-NOV-11 /oracle/oradata/db11/db11/undotbs01.dbf
 
   4       Full 878265     08-NOV-11 /oracle/oradata/db11/db11/users01.dbf
 

 BS Key  Type LV Size       Device Type Elapsed Time Completion Time
 
 ------- ---- -- ---------- ----------- ------------ ---------------
 
 5       Full    9.36M      DISK        00:00:02     08-NOV-11      
 
         BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20111108T112236
 
         Piece Name: /oracle/flash_recovery_area/DB11/backupset/2011_11_08/o1_mf_ncsnf_TAG20111108T112236_7ck86x1h_.bkp
 
   SPFILE Included: Modification time: 08-NOV-11
 
   SPFILE db_unique_name: DB11
 
   Control File Included: Ckp SCN: 878298       Ckp time: 08-NOV-11
 

  

 

  

 

 RMAN> validate backupset 5;

 

  

 

  

 

 Starting validate at 08-NOV-11
 
 using channel ORA_DISK_1
 
 channel ORA_DISK_1: starting validation of datafile backup set
 
 channel ORA_DISK_1: reading from backup piece /oracle/flash_recovery_area/DB11/backupset/2011_11_08/o1_mf_ncsnf_TAG20111108T112236_7ck86x1h_.bkp
 
 channel ORA_DISK_1: piece handle=/oracle/flash_recovery_area/DB11/backupset/2011_11_08/o1_mf_ncsnf_TAG20111108T112236_7ck86x1h_.bkp tag=TAG20111108T112236
 
 channel ORA_DISK_1: restored backup piece 1
 
 channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
 
 Finished validate at 08-NOV-11
  

  

 

  

 

  

 

 RMAN> validate tablespace system;

 

  

 

  

 

 Starting validate at 08-NOV-11
 
 using channel ORA_DISK_1
 
 channel ORA_DISK_1: starting validation of datafile
 
 channel ORA_DISK_1: specifying datafile(s) for validation
 
 input datafile file number=00001 name=/oracle/oradata/db11/db11/system01.dbf
 
 channel ORA_DISK_1: validation complete, elapsed time: 00:00:15
 
 List of Datafiles
 
 =================
 
 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
 
 ---- ------ -------------- ------------ --------------- ----------
 
 1    OK     0              13729        87041           878568    
 
   File Name: /oracle/oradata/db11/db11/system01.dbf
 
   Block Type Blocks Failing Blocks Processed
 
   ---------- -------------- ----------------
 
   Data       0              58037           
 
   Index      0              12168           
 
   Other      0              3106           
 

 channel ORA_DISK_1: starting validation of datafile
 
 channel ORA_DISK_1: specifying datafile(s) for validation
 
 including current control file for validation
 
 including current SPFILE in backup set
 
 channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
 
 List of Control File and SPFILE
 
 ===============================
 
 File Type    Status Blocks Failing Blocks Examined
 
 ------------ ------ -------------- ---------------
 
 SPFILE       OK     0              2               
 
 Control File OK     0              594             
 
 Finished validate at 08-NOV-11