Total Pageviews

Thursday, July 5, 2018

RMAN RECOVERY


HOW TO RESOLVE RMAN ERROR RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time

Lets Login to RMAN prompt
C:\Users\ashwanik\Desktop\MY_SCRIPT>rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Thu Jul 5 18:21:27 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DB11GDEV (DBID=398368955)


RMAN> catalog start with 'H:\BACKUPS\DB11GDEV\';
searching for all files that match the pattern H:\BACKUPS\DB11GDEV\
List of Files Unknown to the Database
=====================================
File Name: H:\BACKUPS\DB11GDEV\DB11GDEV_A_20180705_6DT789IR_S205_P1
File Name: H:\BACKUPS\DB11GDEV\DB11GDEV_D_20180705_6CT789IO_S204_P1

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: H:\BACKUPS\DB11GDEV\DB11GDEV_A_20180705_6DT789IR_S205_P1
File Name: H:\BACKUPS\DB11GDEV\DB11GDEV_D_20180705_6CT789IO_S204_P1

Lets try to restore the database to back time  ’14:02’;
RMAN> RUN
{
set until time "to_date('05-JULY-2018 14:02:00','DD-MON-YYYY HH24:MI:SS')";
restore database;
recover database;
}

executing command: SET until clause

Starting restore at 05-JUL-18
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/05/2018 18:05:17
RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time



RMAN> list incarnation;
List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       DB11GDEV 398368955        PARENT  5155846    08-MAR-17
2       2       DB11GDEV 398368955        PARENT  14394326   24-OCT-17
3       3       DB11GDEV 398368955        PARENT  15510069   06-DEC-17
4       4       DB11GDEV 398368955        PARENT  16728921   03-JAN-18
5       5       DB11GDEV 398368955        PARENT  30039265   23-MAY-18
6       6       DB11GDEV 398368955        CURRENT 83040908   05-JUL-18

For resolving this issue we have to reset the current incarnation value to 5;
RMAN> reset database to incarnation 5;
database reset to incarnation 5
RMAN> RUN
{
set until time "to_date('05-JULY-2018 14:02:00','DD-MON-YYYY HH24:MI:SS')";
restore database;
recover database;
}

executing command: SET until clause

Starting restore at 05-JUL-18
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to G:\DB11GDEV\DB11GDEV\SYSTEM01.DBF
channel ORA_DISK_1: restoring datafile 00002 to G:\DB11GDEV\DB11GDEV\SYSAUX01.DBF
channel ORA_DISK_1: restoring datafile 00003 to G:\DB11GDEV\DB11GDEV\UNDOTBS01.DBF
channel ORA_DISK_1: restoring datafile 00004 to G:\DB11GDEV\DB11GDEV\USERS01.DBF
channel ORA_DISK_1: restoring datafile 00005 to G:\DB11GDEV\DB11GDEV\EXAMPLE01.DBF
channel ORA_DISK_1: restoring datafile 00006 to G:\DB11GDEV\DB11GDEV\METALSDB.DBF
channel ORA_DISK_1: restoring datafile 00007 to G:\DB11GDEV\DB11GDEV\METALSIDX.DBF
channel ORA_DISK_1: restoring datafile 00008 to G:\DB11GDEV\DB11GDEV\UNDOTBS02.DBF
channel ORA_DISK_1: restoring datafile 00009 to G:\DB11GDEV\DB11GDEV\USERS.DBF
channel ORA_DISK_1: restoring datafile 00010 to G:\DB11GDEV\DB11GDEV\ORACLEFORENSICS.DBF
channel ORA_DISK_1: reading from backup piece H:\BACKUPS\DB11GDEV\DB11GDEV_D_20180705_6BT789AO_S203_P1
channel ORA_DISK_1: piece handle=H:\BACKUPS\DB11GDEV\DB11GDEV_D_20180705_6BT789AO_S203_P1 tag=TAG20180705T135744
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:03:55
Finished restore at 05-JUL-18

Starting recover at 05-JUL-18
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 244 is already on disk as file C:\APP\ASHWANIK\FLASH_RECOVERY_AREA\DB11GDEV\ARCHIVELOG\2018_07_05\O1_MF_1_244_FMVOW2SL_.ARC
archived log for thread 1 with sequence 245 is already on disk as file C:\APP\ASHWANIK\FLASH_RECOVERY_AREA\DB11GDEV\ARCHIVELOG\2018_07_05\O1_MF_1_245_FMVS7TJF_.ARC
archived log file name=C:\APP\ASHWANIK\FLASH_RECOVERY_AREA\DB11GDEV\ARCHIVELOG\2018_07_05\O1_MF_1_244_FMVOW2SL_.ARC thread=1 sequence=244
archived log file name=C:\APP\ASHWANIK\FLASH_RECOVERY_AREA\DB11GDEV\ARCHIVELOG\2018_07_05\O1_MF_1_245_FMVS7TJF_.ARC thread=1 sequence=245
media recovery complete, elapsed time: 00:00:03
Finished recover at 05-JUL-18

RMAN>

RMAN> list incarnation ;
List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       DB11GDEV 398368955        PARENT  5155846    08-MAR-17
2       2       DB11GDEV 398368955        PARENT  14394326   24-OCT-17
3       3       DB11GDEV 398368955        PARENT  15510069   06-DEC-17
4       4       DB11GDEV 398368955        PARENT  16728921   03-JAN-18
5       5       DB11GDEV 398368955        CURRENT 30039265   23-MAY-18
6       6       DB11GDEV 398368955        ORPHAN  83040908   05-JUL-18

We can see the current incarnation is 5 now and 6 becomes ORPHAN.
Now we have to open the database to resetlogs.

RMAN> alter database open resetlogs;
database opened

We can check verify the same as below:
SQL> select name ,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
DB11GDEV  READ WRITE


No comments:

Post a Comment