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

相关推荐
ZCBUS实时计算3 小时前
金融证券实时数仓建设实践:轻量化实时计算平台落地,实现交易数据端到端秒级处理
大数据·数据库·数据仓库·金融·flink·dba·etl
其实防守也摸鱼11 小时前
VS Code Git 工作树:解锁多分支并行开发新体验
数据库·git·安全·oracle·架构·自动化
ERD Online11 小时前
MySQL/Oracle/PG/SQLServer 存量库一键逆向成关系图
mysql·oracle·sqlserver
Minxinbb1 天前
TDSQL for MySQL修改统计信息参数
数据库·dba
奇树谦1 天前
《现代 Key-Value 数据库原理:从 B+Tree 到 LSM Tree》-第三篇:LMDB 深度解析二
数据库·oracle·lsm-tree
提笔了无痕1 天前
Agent 上下文管理详解、Context设计与构建
数据库·oracle·agent·context
沉下去,苦磨练!1 天前
Human‑in‑the‑Loop
数据库·oracle
小黑技术栈2 天前
web前端基础到入门——14day
前端·数据库·oracle
todoitbo2 天前
把发票台账接进 Codex:KingbaseES MCP 的一次只读风险排查实践
数据库·oracle·codex·kingbasees·mcp
暗暗别做白日梦3 天前
CompletableFuture 并发统计
网络·数据库·oracle