Hi,
Sometimes You can get “RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time ” error.
Details of error are as follows.
RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time
Cause: UNTIL TIME and RECOVERY WINDOW cannot be less than the database creation time or RESETLOGS time.
Action: Check the UNTIL TIME or RECOVERY WINDOW. If the database needs to be restored to an old incarnation,
use the RESET DATABASE TO INCARNATION command.
This error is related with the Incarnation of database.
When I run the Restore and recover until time, I got the following error.
RMAN> RUN { ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch02 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch03 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch04 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch05 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch06 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch07 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch08 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch09 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch10 TYPE 'SBT_TAPE'; set until time "to_date('28/04/2020 16:30:00′,'dd/mm/yyyy hh24:mi:ss')"; restore database; recover database; alter database open resetlogs; } using target database control file instead of recovery catalog allocated channel: ch01 channel ch01: SID=6 device type=SBT_TAPE Starting restore at 28-APR-20 released channel: ch01 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of restore command at 28/04/2020 22:37:27 RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time RMAN>
This error is caused by incarnation of database. So you should set the right incarnation of database.
List all incarnations as follows.
RMAN> list incarnation; List of Database Incarnations DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time ——- ——- ——– —————- — ———- ———- 1 1 T1 6488644328 PARENT 1 07-JUL-14 2 2 T1 6488644328 PARENT 4624168 28-MAR-20 3 3 T1 6488644328 PARENT 8640942 12-APR-20 4 4 T1 6488644328 CURRENT 2460874 28-APR-20
We need to reset database to incarnation 3 as follows before latest resetlogs time.
RESET DATABASE TO INCARNATION RIGHT_INCARNATION_NUMBER;
RMAN> RESET DATABASE TO INCARNATION 3;
database reset to incarnation 3
Now try to restore again, it will run properly.
RMAN> RUN { ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch02 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch03 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch04 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch05 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch06 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch07 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch08 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch09 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch10 TYPE 'SBT_TAPE'; set until time "to_date('28/04/2020 16:30:00′,'dd/mm/yyyy hh24:mi:ss')"; restore database; recover database; alter database open resetlogs; } allocated channel: ch01 channel ch01: SID=6 device type=SBT_TAPE …. ... executing command: SET until clause Starting restore at 28-APR-20 flashing back control file to SCN 9959429 channel ch01: starting datafile backup set restore channel ch01: specifying datafile(s) to restore from backup set …. channel ch10: starting datafile backup set restore channel ch10: specifying datafile(s) to restore from backup set channel ch10: restoring datafile 00001 to +DATA/MSDB/datafile/system01.dbf channel ch10: reading from backup piece bk_923_1_909505699 channel ch02: piece handle=bk_930_1_909505700 tag=T2_INCARNATION1_280420201630 channel ch02: restored backup piece 1 ….. channel ch06: restore complete, elapsed time: 00:01:05 channel ch09: piece handle=bk_924_1_909505699 tag=T2_INCARNATION1_280420201630 channel ch09: restored backup piece 1 channel ch09: restore complete, elapsed time: 00:01:15 channel ch10: piece handle=bk_923_1_909505699 tag=T2_INCARNATION1_280420201630 channel ch10: restored backup piece 1 channel ch10: restore complete, elapsed time: 00:01:25 Finished restore at 28-APR-20 Starting recover at 28-APR-20 starting media recovery archived log for thread 1 with sequence 604 is already on disk as file +DATA/MSDB/arch/arch_1_602_546208786.arc ….. archived log for thread 1 with sequence 611 is already on disk as file +DATA/MSDB/arch/t1_arch_1_611_909008955.arc archived log file name=+DATA/MSDB/arch/arch_1_602_546208786.arc thread=1 sequence=604 …. archived log file name=+DATA/MSDB/arch/t1_arch_1_611_909008955.arc thread=1 sequence=611 media recovery complete, elapsed time: 00:00:01 Finished recover at 28-APR-20 Statement processed released channel: ch01 released channel: ch02 released channel: ch03 released channel: ch04 released channel: ch05 released channel: ch06 released channel: ch07 released channel: ch08 released channel: ch09 released channel: ch10 RMAN>
Do you want to learn more details about RMAN, then read the following articles.
https://ittutorial.org/rman-backup-restore-and-recovery-tutorials-for-beginners-in-the-oracle-database/