12c RMAN新特性之UNTIL AVAILABLE REDO--自动恢复到REDO终点的步骤简化

0    243    1

Tags:

👉 本文共约6536个字,系统预计阅读时间或需25分钟。

在Oracle 12.2之前,当需要恢复数据库到某个时间点的时候,需要确定SCN,或者日志序列号,或者一个时间点,以便尽可能多的应用归档日志,进而尽可能多的恢复数据。从12.2开始,RMAN新增参数“UNTIL AVALIABLE REDO”,语法如下:

RMAN> RECOVER DATABASE UNTIL AVALIABLE REDO;

RMAN将会根据控制文件信息和归档日志、线日志、归档日志备份集的物理可用性,将数据库恢复到最后一个可用的归档日志。所以在进行恢复的时候,可以不需要指定SCN,或者时间或者日志序列号。需要注意的是,数据文件仍然需要在一致的情况下,数据库才能打开。

需要注意的是,这些新特性有如下的限制条件:

l 不能针对恢复数据文件或者表空间使用这个命令。

l 不能针对恢复PDB使用这个命令。

l 只能针对全库恢复使用这个命令。



12.2 NEW FEATURE : -RECOVER DATABASE UNTIL AVAILABLE REDO (文档 ID 2300465.1)

In this Document

Goal
Solution
A> Using Current Controlfile.
B> When using backup or restored controlfile.

APPLIES TO:

Oracle Database - Enterprise Edition - Version 12.2.0.1 to 12.2.0.1 [Release 12.2]
Information in this document applies to any platform.

GOAL

Goal of this Document is to explain how to use the New Feature in 12.2 Recover database until available redo.

The New Syntax available in 12.2 is

RMAN> RECOVER DATABASE UNTIL AVAILABLE REDO ;

Finds the last available archived redo log and online redo logs, and recovers the database to the point where a log is missing.

The database files still needs to be consistent enough to open the database.

LIMITATIONS/RESTRICTIONS

  1. You cannot recover a Datafile or Tablepace with this command.
  2. You cannot recover PDB using this command.
  3. You can use this command only while performing recovery of whole database.

SOLUTION

Whenever a database needs to be restored to a Point in time we need to determine SCN, or the Sequence or time in order to apply as many archived logs as possible, to recover as much data as possible.
The new syntax helps reduce this work as rman would physically check for the available Archive/redo copy or backupset and do the recovery till the last available Archivelog based on information in Controlfile and physical availability of the Archivelog copy/redo log/Archive log backupsets.So you don't have to specify any until SCN ,Sequence or time.

Here is an example which explains the new feature.

In this example we will delete couple of Archivelog's after the backups are taken.

A> Using Current Controlfile.

Step1 :- Take a backup of the database

Rman> backup database plus archivelog

Starting backup at 24-AUG-17
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=56 STAMP=952838603
channel ORA_DISK_1: starting piece 1 at 24-AUG-17
channel ORA_DISK_1: finished piece 1 at 24-AUG-17
piece handle=/u01/app/cdb/backupset/2017_08_24/o1_mf_annnn_TAG20170824T052759dswryzts.bkp tag=TAG20170824T052759 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=5 RECID=15 STAMP=952145574
input archived log thread=1 sequence=6 RECID=16 STAMP=952145576
input archived log thread=1 sequence=7 RECID=17 STAMP=952145579
input archived log thread=1 sequence=10 RECID=39 STAMP=952146261
input archived log thread=1 sequence=11 RECID=40 STAMP=952146361
channel ORA_DISK_1: starting piece 1 at 24-AUG-17
channel ORA_DISK_1: finished piece 1 at 24-AUG-17
piece handle=/u01/app/cdb/backupset/2017_08_24/o1_mf_annnn_TAG20170824T052759dswrz70f.bkp tag=TAG20170824T052759 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=2 RECID=57 STAMP=952838697
input archived log thread=1 sequence=3 RECID=58 STAMP=952838705
input archived log thread=1 sequence=4 RECID=59 STAMP=952838715
input archived log thread=1 sequence=5 RECID=60 STAMP=952838721
input archived log thread=1 sequence=6 RECID=61 STAMP=952838751
input archived log thread=1 sequence=7 RECID=62 STAMP=952838785
input archived log thread=1 sequence=8 RECID=63 STAMP=952838861
input archived log thread=1 sequence=9 RECID=64 STAMP=952838879
channel ORA_DISK_1: starting piece 1 at 24-AUG-17
channel ORA_DISK_1: finished piece 1 at 24-AUG-17
piece handle=/u01/app/cdb/backupset/2017_08_24/o1_mf_annnn_TAG20170824T052759dswrz861.bkp tag=TAG20170824T052759 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=15 RECID=44 STAMP=952146606
input archived log thread=1 sequence=16 RECID=45 STAMP=952146607
input archived log thread=1 sequence=17 RECID=55 STAMP=952147123
channel ORA_DISK_1: starting piece 1 at 24-AUG-17
channel ORA_DISK_1: finished piece 1 at 24-AUG-17
piece handle=/u01/app/cdb/backupset/2017_08_24/o1_mf_annnn_TAG20170824T052759dswrz9bz.bkp tag=TAG20170824T052759 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-AUG-17

Starting backup at 24-AUG-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=/u01/app/cdb/datafile/o1_mf_usersdqlzw5mf.dbf
input datafile file number=00001 name=/u01/app/cdb/datafile/o1_mf_systemdqlz2fhb.dbf
input datafile file number=00003 name=/u01/app/cdb/datafile/o1_mf_sysauxdqlz2fj2.dbf
input datafile file number=00004 name=/u01/app/cdb/datafile/o1_mf_undotbs1dqlz2fjo.dbf
input datafile file number=00013 name=/u01/app/cdb/datafile/o1_mf_abcdqlz2fk4.dbf
channel ORA_DISK_1: starting piece 1 at 24-AUG-17
channel ORA_DISK_1: finished piece 1 at 24-AUG-17
piece handle=/u01/app/cdb/backupset/2017_08_24/o1_mf_nnndf_TAG20170824T052810dswrzc1c.bkp tag=TAG20170824T052810 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00010 name=/u01/app/cdb/52A23D56DF2E3CC1E0535C08DC0A83FF/datafile/o1_mf_sysauxdqlzwyxk.dbf
input datafile file number=00009 name=/u01/app/cdb/52A23D56DF2E3CC1E0535C08DC0A83FF/datafile/o1_mf_systemdqlzwyyh.dbf
input datafile file number=00011 name=/u01/app/cdb/52A23D56DF2E3CC1E0535C08DC0A83FF/datafile/o1_mf_undotbs1dqlzwyz0.dbf
input datafile file number=00012 name=/u01/app/cdb/52A23D56DF2E3CC1E0535C08DC0A83FF/datafile/o1_mf_usersdqlzwz06.dbf
channel ORA_DISK_1: starting piece 1 at 24-AUG-17
channel ORA_DISK_1: finished piece 1 at 24-AUG-17
piece handle=/u01/app/cdb/52A23D56DF2E3CC1E0535C08DC0A83FF/backupset/2017_08_24/o1_mf_nnndf_TAG20170824T052810dsws128w.bkp tag=TAG20170824T052810 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=/u01/app/cdb/52A2312195952E57E0535C08DC0A137A/datafile/o1_mf_sysauxdqlzxqtm.dbf
input datafile file number=00005 name=/u01/app/cdb/52A2312195952E57E0535C08DC0A137A/datafile/o1_mf_systemdqlzxqvs.dbf
input datafile file number=00008 name=/u01/app/cdb/52A2312195952E57E0535C08DC0A137A/datafile/o1_mf_undotbs1dqlzxqwc.dbf
channel ORA_DISK_1: starting piece 1 at 24-AUG-17
channel ORA_DISK_1: finished piece 1 at 24-AUG-17
piece handle=/u01/app/cdb/52A2312195952E57E0535C08DC0A137A/backupset/2017_08_24/o1_mf_nnndf_TAG20170824T052810dsws1v45.bkp tag=TAG20170824T052810 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 24-AUG-17
channel ORA_DISK_1: finished piece 1 at 24-AUG-17
piece handle=/u01/app/cdb/backupset/2017_08_24/o1_mf_ncsnf_TAG20170824T052810dsws2o9d.bkp tag=TAG20170824T052810 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-AUG-17

Starting backup at 24-AUG-17
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=10 RECID=65 STAMP=952838998 ===================> This is the minimum archivelog till which recovery would make database consistent to open.
channel ORA_DISK_1: starting piece 1 at 24-AUG-17
channel ORA_DISK_1: finished piece 1 at 24-AUG-17
piece handle=/u01/app/cdb/backupset/2017_08_24/o1_mf_annnn_TAG20170824T052958dsws2pw8.bkp tag=TAG20170824T052958 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-AUG-17

本人提供Oracle(OCP、OCM)、MySQL(OCP)、PostgreSQL(PGCA、PGCE、PGCM)等数据库的培训和考证业务,私聊QQ646634621或微信dbaup66,谢谢!
AiDBA后续精彩内容已被站长无情隐藏,请输入验证码解锁本文!
验证码:
获取验证码: 请先关注本站微信公众号,然后回复“验证码”,获取验证码。在微信里搜索“AiDBA”或者“dbaup6”或者微信扫描右侧二维码都可以关注本站微信公众号。

标签:

Avatar photo

小麦苗

学习或考证,均可联系麦老师,请加微信db_bao或QQ646634621

您可能还喜欢...

发表回复