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

相关推荐
wytraining42 分钟前
快速入门 FastAPI 项目
jvm·oracle·fastapi
安当加密4 小时前
SQL Server 数据库安全新范式:TDE 透明加密+ DBG数据库安全网关 双重装甲
数据库·oracle
Irene19915 小时前
Oracle 21c XE 安装后默认不包含HR等示例表,CO 模式、SCOTT 模式安装过程记录
数据库·oracle
oradh5 小时前
Oracle数据库序列和同义词概述
数据库·oracle·数据库基础·数据库入门·oracle序列·oracle同义词
你觉得脆皮鸡好吃吗5 小时前
SQL注入 高权限注入(引入概念)
网络·数据库·sql·oracle·网络安全学习
m0_737539377 小时前
数据库主从复制和读写分离
数据库·oracle
Irene19918 小时前
(AI总结版)完整操作流程:从零配置 Oracle 21c XE 开发环境(安装 CO 示例、安装 SCOTT 教学示例)
数据库·oracle
唐骁虎8 小时前
使用SQLAlchemy查询Pandas DataFrame
数据库·oracle·pandas
杨云龙UP9 小时前
Oracle / ODA环境TRACE、alert日志定位与ADRCI清理 SOP_20260423
linux·运维·服务器·数据库·oracle
colofullove9 小时前
推导中异常处理
数据库·oracle