rman restore preview 和validate ,preview可以查找到archivelog的范围

Summary

How to check/validate backup of datafile and archivelogs are good to restore and recover ?

Solution

To check the backups are good or not there are two options :

Option 1: Restore the database on a server and recover it using the backups. This you accomplish using RMAN duplicate command.

View the below note for more information on RMAN duplicate :

<Note 228257.1> RMAN 'Duplicate Database' Feature in Oracle9i / Oracle 10G

Option 2 : Run RMAN validate command. The validate command will not restore any file it just reads and gives confirmation that the backups are good.

Example:

Want to restore and recover the database till time '10:23, 05-November-2007 then you have to use the below command to accomplish this :

Step 1: The below command just gives the report of backups that are used to do the restore and recover :

run

{

set until time "to_date('2007-05-10:23:00:00','yyyy-dd-mm:hh24:mi:ss')";

restore database preview;

}

The Restore ... Preview identifies the backups (backup sets or image copies, on disk or sequential media like tapes) required to carry out a given restore operation, based on the information in the RMAN repository. Use RESTORE... PREVIEW when planning your restore and recovery operation, to ensure that all required backups are available or to identify situations.

The restore database preview gives a report of all the backup pieces and archivelogs that are required to restore/recover the database. Make a note of the start sequence and end sequence of archivelogs and the same will be used in the next step

Step 2: Then run the below command to check the backup pieces are good :

run

{

allocate channel c1 type disk;

set until time "to_date('2007-05-10:23:00:00','yyyy-dd-mm:hh24:mi:ss')";

restore database validate;

}

The above command will read the backup pieces/Copies which has datafiles and if finds any error it will report at the RMAN prompt.

RMAN> run

{

allocate channel c1 type disk;
restore archivelog from sequence xxx until sequence yyy validate;

}

Replace the xxx, yyy with the start and end archivelog sequence reported by restore database preview command ran in the step 1.

The RESTORE ... VALIDATE command test whether you can restore from your backups. You can test the availability of usable backups for any desired RESTORE operation, or test the contents of a specific backup for use in RESTORE operations. The contents of the backups are actually read and validated for corruption to ensure that the objects to be restored can be restored from them.

Few Known issues with Restore database validate

RMAN "restore... Validate [header]" Lists Full Or L0 Backups Only KB90449


Summary

Two RMAN commands were run:

  1. restore database until time 'sysdate' preview

  2. restore database until time 'sysdate' validate header

According to Oracle doc, they both should produce the same output, but VALIDATE HEADER shows full or level 0 backups only.

Validate header does Reports and validates---but does not restore---the backups that RMAN could use to restore to the specified time.

According to Oracle Documentation:


http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmcomre.htm#CFADHADH

Oracle® Database Backup and Recovery User's Guide

11g Release 2 (11.2)

Part Number E10642-05

.

17 Performing Complete Database Recovery

..

Preparing for Complete Database Recovery

...

Previewing Backups Used in Restore Operations

..

As an alternative to RESTORE ... PREVIEW, you can use the RESTORE ... VALIDATE HEADER command.

In addition to listing the files needed for restore and recovery, the RESTORE ... VALIDATE HEADER command

validates the backup file headers to determine whether the files on disk

or in the media management catalog correspond to the metadata in the RMAN repository.

..


Solution

Behaviour


RMAN> restore datafile 1 until time 'sysdate' validate header;

Starting restore at 02-AUG-12

using channel ORA_DISK_1

using channel ORA_DISK_2

using channel ORA_DISK_3

List of Backup Sets

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

BS Key Type LV Size Device Type Elapsed Time Completion Time


305 Incr 0 199.48M DISK 00:03:28 02-AUG-12

BP Key: 335 Status: AVAILABLE Compressed: YES Tag: TAG20120802T10294

3

Piece Name: xxxxxx

List of Datafiles in backup set 305

File LV Type Ckp SCN Ckp Time Name


1 0 Incr 8517814048117 02-AUG-12 <path>\SYSTEM01.DBF

validation succeeded for backup piece

Finished restore at 02-AUG-12

Did an internal test ,seems validate header does not list level 1 and archivelog files.

For the same below documentation defect has been raised ,

Bug 14402141 - DOCUMENTATION BUG:VALIDATE HEADER DOES NOT LIST ARCHIVELOG OR LEVEL 1 BACKUP

Options we can used to validate the required backuppiece are given below

Option 1 :-

Rman> Restore database validate ; ---------->This would just check Level 0 or Full backup.

Once done you Can run

Rman> restore database preview ; ---------------> Preview command just lists out the backuppiece needed .

Individually run Rman validate backupset command on the Incremental level 1 or Archivelog backupset

Rman> Validate backupset <backupset no> ;

Option 2 :-

Rman> Restore database preview validate header ;

This command should do the functionality of both the preview and validate header.

However due to below Bug it just performs functionality of preview but ignore the valdiate header

<BUG 15997297> - RESTORE DATABASE PREVIEW VALIDATE NOT WORKING AS EXPECTED

Fixed :- 12.1

Check for availability of one off patch for the Above bug

相关推荐
jnrjian2 小时前
DBA_RECYCLEBIN purge指定日期前的表
oracle
jnrjian2 小时前
只有dba_objects 试图显示 回收站中的对象
oracle·dba
smchaopiao21 小时前
数据库优化技巧详解:从LIMIT到索引的提升策略
数据库·oracle
时光追逐者1 天前
一款免费、简单、高效的在线数据库设计工具
数据库·mysql·oracle·sql server
syinfo1 天前
oracle使用PLSQL导出表数据
数据库·oracle
老苏畅谈运维1 天前
Oracle AI Database 26ai 安装实战
数据库·oracle·oracle 26ai
雷工笔记1 天前
Navicat 备份与还原 PostgreSQL 数据库
数据库·postgresql·oracle
kgduu2 天前
js之客户端存储
javascript·数据库·oracle
Ricky_Theseus2 天前
SQL Server 的五种约束类型
数据库·sql·oracle