Friday, May 16, 2014

Validate the datafiles and archivelogs for physical corruption and logical corruption


1.Script for integrity testing of database and archivelog for physical and logical corruption.The validate clause will not perform actual backup.

$ cat rman_15.cmd
backup
validate   #integrity testing
database # checking database and archivelog for physical and logical corruption
archivelog  all;

2.Call the script from the rman command line

$ rman target ="/" @ rman_15.cmd | tee -a rman_15.log

Recovery Manager: Release 11.2.0.4.0 - Production on Sat May 17 02:04:21 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CVRMAN (DBID=657566608)

RMAN> backup
2> validate   #integrity testing
3> database # checking database and archivelog for physical and logical corruption
4> archivelog  all;
5>
6>
Starting backup at 17-MAY-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=23 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=24 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=30 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=54 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=40 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/cvrman/datafile/system.256.847354793
input datafile file number=00004 name=+DATA/cvrman/datafile/users.259.847354795
channel ORA_DISK_2: starting archived log backup set
channel ORA_DISK_2: specifying archived log(s) in backup set
input archived log thread=1 sequence=12 RECID=51 STAMP=847713373
channel ORA_DISK_3: starting full datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00002 name=+DATA/cvrman/datafile/sysaux.257.847354793
input datafile file number=00006 name=+DATA/cvrman/datafile/tbs1.294.847433665
channel ORA_DISK_4: starting full datafile backup set
channel ORA_DISK_4: specifying datafile(s) in backup set
input datafile file number=00005 name=+DATA/cvrman/datafile/example.308.847525493
input datafile file number=00003 name=+DATA/cvrman/datafile/undotbs1.258.847354795
channel ORA_DISK_5: starting archived log backup set
channel ORA_DISK_5: specifying archived log(s) in backup set
input archived log thread=1 sequence=13 RECID=52 STAMP=847713376
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:03
List of Archived Logs
=====================
Thrd Seq     Status Blocks Failing Blocks Examined Name
---- ------- ------ -------------- --------------- ---------------
1    12      OK     0              84538           +DATA/cvrman/archivelog/2014_05_16/thread_1_seq_12.319.847713369
channel ORA_DISK_2: starting archived log backup set
channel ORA_DISK_2: specifying archived log(s) in backup set
input archived log thread=1 sequence=14 RECID=53 STAMP=847715050
channel ORA_DISK_5: backup set complete, elapsed time: 00:00:03
List of Archived Logs
=====================
Thrd Seq     Status Blocks Failing Blocks Examined Name
---- ------- ------ -------------- --------------- ---------------
1    13      OK     0              28027           +DATA/cvrman/archivelog/2014_05_16/thread_1_seq_13.284.847713369
channel ORA_DISK_5: starting archived log backup set
channel ORA_DISK_5: specifying archived log(s) in backup set
input archived log thread=1 sequence=15 RECID=54 STAMP=847753256
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01
List of Archived Logs
=====================
Thrd Seq     Status Blocks Failing Blocks Examined Name
---- ------- ------ -------------- --------------- ---------------
1    14      OK     0              15661           +DATA/cvrman/archivelog/2014_05_16/thread_1_seq_14.310.847715049
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_5: backup set complete, elapsed time: 00:00:02
List of Archived Logs
=====================
Thrd Seq     Status Blocks Failing Blocks Examined Name
---- ------- ------ -------------- --------------- ---------------
1    15      OK     0              84349           +DATA/cvrman/archivelog/2014_05_16/thread_1_seq_15.314.847753253
channel ORA_DISK_5: starting full datafile backup set
channel ORA_DISK_5: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:02
List of Control File and SPFILE
===============================
File Type    Status Blocks Failing Blocks Examined
------------ ------ -------------- ---------------
Control File OK     0              612
channel ORA_DISK_5: backup set complete, elapsed time: 00:00:00
List of Control File and SPFILE
===============================
File Type    Status Blocks Failing Blocks Examined
------------ ------ -------------- ---------------
SPFILE       OK     0              2
channel ORA_DISK_4: backup set complete, elapsed time: 00:01:04
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
3    OK     0              385          6400            1216392
  File Name: +DATA/cvrman/datafile/undotbs1.258.847354795
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              0
  Index      0              0
  Other      0              6015

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
5    OK     0              33702        44240           1112415
  File Name: +DATA/cvrman/datafile/example.308.847525493
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              6582
  Index      0              1149
  Other      0              2807

channel ORA_DISK_1: backup set complete, elapsed time: 00:01:17
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
1    OK     0              15266        96072           1216363
  File Name: +DATA/cvrman/datafile/system.256.847354793
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              64002
  Index      0              13273
  Other      0              3459

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
4    OK     0              18           667             993125
  File Name: +DATA/cvrman/datafile/users.259.847354795
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              91
  Index      0              39
  Other      0              492

channel ORA_DISK_3: backup set complete, elapsed time: 00:01:14
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
2    OK     0              20096        70448           1216392
  File Name: +DATA/cvrman/datafile/sysaux.257.847354793
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              13891
  Index      0              10094
  Other      0              26319

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
6    OK     0              1153         1280            1013566
  File Name: +DATA/cvrman/datafile/tbs1.294.847433665
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              0
  Index      0              0
  Other      0              127

Finished backup at 17-MAY-14

Recovery Manager complete.


3.checking for any block corruption from the database tables

$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sat May 17 02:08:54 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> desc v$database_block_corruption;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 FILE#                                              NUMBER
 BLOCK#                                             NUMBER
 BLOCKS                                             NUMBER
 CORRUPTION_CHANGE#                                 NUMBER
 CORRUPTION_TYPE                                    VARCHAR2(9)

SQL> select * from v$database_block_corruption;

no rows selected

No comments: