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

相关推荐
人生苦短12815 分钟前
Oracle RAC 日常管理+排错命令大全
数据库·oracle
镜舟科技15 分钟前
从 DBA 经验到 Agent:镜舟如何构建生产级智能排障体系
数据库·agent·dba·skill·devops agent·mirrorship
额额额对了3 小时前
Linux 数据库开发实战:使用 C 语言与 SQLite3 构建轻量级终端词典
linux·数据库·oracle
养生技术人5 小时前
Oracle OCP认证考试题目详解082系列第17题
运维·数据库·sql·oracle·ocp
xx~t5 小时前
嵌入式——Linux软件编程——数据库
linux·c语言·数据库·oracle·sqlite
oradh6 小时前
Oracle普通表改造分区表的方法总结
数据库·oracle·普通表改造分区表
知行合一。。。14 小时前
RAG--03--Milvus基本用法
数据库·oracle·milvus
袋鼠云数栈1 天前
整库迁移与分库分表同步:批量数据搬迁的配置简化思路
jvm·数据库·oracle
cfm_29141 天前
Spring事务
数据库·spring·oracle
倔强的石头1061 天前
连接数失控排查:从数据库会话、应用线程池到连接池泄漏
数据库·oracle