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

相关推荐
曹牧10 小时前
Oracle EXPLAIN PLAN
数据库·oracle
贤时间10 小时前
codex 助力oracle ebs 开发
数据库·oracle
秉承初心10 小时前
PostgreSQL 数据性能瓶颈突破实战
数据库·postgresql·oracle
Curvatureflight13 小时前
MySQL 深分页越来越慢?从 LIMIT OFFSET 改成游标分页
数据库·oracle
XZ-07000114 小时前
MySQL事务
数据库·mysql·oracle
tiancaijiben14 小时前
阿里云函数计算FC如何实现网站的定时任务与自动化
数据库·oracle·dba
xfhuangfu14 小时前
Oracle 19c 多租户体系架构介绍
数据库·oracle·架构
杨云龙UP16 小时前
Spotlight 接入 Oracle 数据库监控操作指南 2026-06-16
数据库·oracle·性能监控·预警·阈值·spotlight·瓶颈分析
unique17 小时前
AI Coding 采集方案探索
jvm·人工智能·oracle
wangbing112517 小时前
Oracle的撤回功能
数据库·oracle