Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

RMAN Validate Backup Tips

Expert Oracle Database Tips by Donald BurlesonMarch 25, 2015

RMAN Validating Backups and Recovery

To check the datafiles for any physical or logical corruption and verify whether a datafile is in the correct directory, use the backup validate command.  This command does not create a backup of any datafile; it checks for validity of the datafiles and updates the v$database_block_corruption view in case it finds any corruption.  After getting the list of corrupted data blocks, use the Block Media Recovery feature of RMAN to recover the corrupted blocks.  This feature is explained in more detail in Chapter 4.

It should be mentioned that by default, RMAN checks for physical corruption.  By using check logical syntax, we can check for logical corruptionas well.  Here, we provide an example of checking and validating a datafile by first manually corrupting it.

To begin, create a tablespace and table by assigning it to that tablespace.  Then insert data in the table as follows:

SQL>
create
tablespace tbs_test datafile 'c:\tbs_test.dbf' size 1m;
Tablespace created.

SQL>
create
table tbl_test (name varchar2(20)) tablespace tbs_test;
Table created.

SQL>
insert into
tbl_test values('oracle');
1 row created.

SQL>
commit;
Commit complete.

Then query the v$database_block_corruption view.  As we have not validated the datafile, it must be empty:

SQL>
select * from
v$database_block_corruption;
no rows selected

Bring the tablespace to the offline mode, and then corrupt the datafile using the manual corruption methods that is described in Chapter 4.  Then bring the tablespace to the online mode and query the table.  The following error will occur:

SQL>
alter
tablespace tbs_test offline;
Tablespace altered.

SQL>
alter
tablespace tbs_test online;
Tablespace altered.

SQL>
select * from
tbl_test;
select * from
tbl_test
              *
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 8, block # 13)
ORA-01110: data file 8: 'C:\tbs_test.dbf'

Now use the backup validate command to check that datafile for any corruption.  Then query the v$database_block_recovery view:

RMAN> backup validate tablespace tbs_test;

SQL>
select * from
v$database_block_corruption;
 

     FILE#     BLOCK#     BLOCKS CORRUPTION_CHANGE# CORRUPTION
---------- ---------- ---------- ------------------ ---------
         8         13          1                  0 CHECKSUM
SQL>

This shows that datafile number 8 has a block corruption in block number 13.   Only one block has been corrupted.  This information will help us to recover that block using Block Media Recovery.

To validate the tablespace, use the following command:  

RMAN> backup validate tablespace tbs_test;

To validate a specific datafile, use the following command:

RMAN> backup validate datafile 8;

To check the whole database, use the following command:

RMAN> backup validate database;

To check all archived redo log files, use the following command:

RMAN> backup validate archivelog all;

To check the spfile, use the following command:

RMAN> backup validate spfile;

To check the current control file, use the following command:

RMAN> backup validate current control file;

Just as a datafile can be validated for a backup operation, a backup of a datafile can be validated for a restore.  To check if a backup is valid and available for a restore operation, use the restore ?. validate command.

To check backup of the control file, use the following command:

RMAN> restore control file validate;

To check backup of the spfile, use the following command:

RMAN> restore spfile validate;

To check backup of tablespace users, use the following command:

RMAN> restore tablespace users validate;

To check backup of a datafile, use the following command:

RMAN> restore datafile 4 validate;

To check backup of all archived redo log files, use the following command:

RMAN> restore archivelog all validate;

To check backup of the whole database, use the following command:

RMAN> restore database validate;

If RMAN is unable to find the backup file, it returns an error as follows:

RMAN> restore spfile validate; 

Starting restore at 22-AUG-09
using channel ORA_DISK_1
.......................Output omitted
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 3) The system cannot find the path specified
failover to previous backup

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/22/2009 19:49:51
RMAN-06026: some targets not found - aborting restore
RMAN-06729: no backup of the SPFILE found to restore 

RMAN>

In 10g, it is possible to check only backup sets for any corruptions by using the validate backupset - command. To check a backup set, use:

RMAN> validate backupset 2;

In Oracle 11g, the validate command was expanded with new features.   The syntax of the new validate commandis the same as the syntax of the backup validate command.  With the new validate command, almost everything that needs to be checked can be done.  For example, to check validity of the backup of the spfile, use the following command:

RMAN> validate spfile

Moreover, parallelizing the validity process can be done by dividing it into specified section sizes using the section size command.  It should be used when different channels have been allocated and the validity needs to be spread over those channels.  In the following scenario, we open three different channels and parallelize the validity over these three channels with 300M per channel:

 RMAN> run
{
allocate channel c1 devide type disk;
allocate channel c2 devide type disk;
allocate channel c3 devide type disk;
validate database section size 300m;
}

 

 

 
 
 
Get the Complete
Oracle Backup & Recovery Details 

The landmark book "Oracle Backup & Recovery: Expert secrets for using RMAN and Data Pump " provides real world advice for resolving the most difficult Oracle performance and recovery issues. Buy it for 40% off directly from the publisher.
 


 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster