Tuesday, May 5, 2020

RMAN incarnations

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       EPCHRS   1025323918       PARENT  1          07-FEB-18
2       2       EPCHRS   1025323918       PARENT  1477662    14-APR-20
3       3       EPCHRS   1025323918       PARENT  3057981    30-APR-20
4       4       EPCHRS   1025323918       CURRENT 3058941    30-APR-20

select * from chrs.bkup_test;

COL1 CAP_DATE USERNAME
Marines 06-MAY-20 11.03.43.957232000 AM SYS
3547908 06-MAY-20 10.55.58.490482000 AM SYSTEM
FLINC2 06-MAY-20 10.55.28.065953000 AM SYSTEM
FLINC2 06-MAY-20 10.55.27.712340000 AM SYSTEM
FLINC2 06-MAY-20 10.55.27.050855000 AM SYSTEM
FLINC2 06-MAY-20 10.51.59.876000000 AM SYSTEM
3546949 06-MAY-20 10.26.48.434402000 AM SYSTEM
FLINC1 06-MAY-20 10.13.02.378823000 AM SYSTEM
FLINC1 06-MAY-20 10.13.00.513703000 AM SYSTEM
FLINC1 06-MAY-20 10.11.29.473162000 AM SYSTEM
Marines 06-MAY-20 10.03.43.849205000 AM SYS


Restore database only to may 6 10 am

startup nomount
alter database mount
run
{
allocate channel dev1 type disk;
set until time "TO_DATE('06-MAY-2020 10:00', 'DD-MON-YYYY HH24:MI')";
restore database;
recover database; }

alter database open resetlogs;

Marines 06-MAY-20 01.22.51.307943000 PM SYS
Marines 06-MAY-20 09.03.43.727733000 AM SYS
Marines 06-MAY-20 08.03.43.592781000 AM SYS
Marines 06-MAY-20 07.03.43.505016000 AM SYS
Marines 06-MAY-20 06.03.43.359553000 AM SYS
Marines 06-MAY-20 05.03.43.264703000 AM SYS


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       EPCHRS   1025323918       PARENT  1          07-FEB-18
2       2       EPCHRS   1025323918       PARENT  1477662    14-APR-20
3       3       EPCHRS   1025323918       PARENT  3057981    30-APR-20
4       4       EPCHRS   1025323918       PARENT  3058941    30-APR-20
5       5       EPCHRS   1025323918       CURRENT 3546181    06-MAY-20


I want to see the FLINC1 entries again

shutdown immeidate;
startup nomount
alter database mount;

run
{
allocate channel dev1 type disk;
restore database;
recover database; }

Marines 06-MAY-20 01.22.51.307943000 PM SYS
Marines 06-MAY-20 09.03.43.727733000 AM SYS
Marines 06-MAY-20 08.03.43.592781000 AM SYS
Marines 06-MAY-20 07.03.43.505016000 AM SYS
Marines 06-MAY-20 06.03.43.359553000 AM SYS
Marines 06-MAY-20 05.03.43.264703000 AM SYS
Marines 06-MAY-20 04.03.44.109648000 AM SYS

## It is still the same because you did a restore a full restore

Try to restore until 11 am

Recovery Manager complete.
[oracle@serpentcustom davscripts]$ rman target /

Recovery Manager: Release 18.0.0.0.0 - Production on Wed May 6 13:40:35 2020
Version 18.3.0.0.0

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

connected to target database: EPCHRS (not mounted)

RMAN> alter database mount;

using target database control file instead of recovery catalog
Statement processed

RMAN>   run
        {
        allocate channel dev1 type disk;
        set until time "TO_DATE('06-MAY-2020 11:00', 'DD-MON-YYYY HH24:MI')";
        restore database;
        recover database; }2> 3> 4> 5> 6>

allocated channel: dev1
channel dev1: SID=259 device type=DISK

executing command: SET until clause

Starting restore at 06-MAY-20
released channel: dev1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/06/2020 13:41:45
RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time

RMAN>

##  It is logical and expected so how the hell are we gonna get those old backups now!!!

DO this

RMAN> alter database mount;

Statement processed

RMAN> reset database to incarnation 4;

database reset to incarnation 4

RMAN> RUN
{
  SET UNTIL TIME "TO_DATE('06-MAY-2020 12:06', 'DD-MON-YYYY HH24:MI')";
  RESTORE DATABASE;
  RECOVER DATABASE;
}2> 3> 4> 5> 6>

.
.
.
archived log file name=/u03/app/oracle/fast_recovery_area/EPCHRS/EPCHRS/archivelog/2020_05_06/o1_mf_1                                                        _596_hc4l38s5_.arc thread=1 sequence=596
media recovery complete, elapsed time: 00:00:01
Finished recover at 06-MAY-20

RMAN> alter database open resetlogs;


Marines 06-MAY-20 02.00.59.634651000 PM SYS
Marines 06-MAY-20 12.03.44.109976000 PM SYS
Marines 06-MAY-20 11.03.43.957232000 AM SYS
3547908 06-MAY-20 10.55.58.490482000 AM SYSTEM
FLINC2 06-MAY-20 10.55.28.065953000 AM SYSTEM
FLINC2 06-MAY-20 10.55.27.712340000 AM SYSTEM
FLINC2 06-MAY-20 10.55.27.050855000 AM SYSTEM
FLINC2 06-MAY-20 10.51.59.876000000 AM SYSTEM
3546949 06-MAY-20 10.26.48.434402000 AM SYSTEM
FLINC1 06-MAY-20 10.13.02.378823000 AM SYSTEM
FLINC1 06-MAY-20 10.13.00.513703000 AM SYSTEM
FLINC1 06-MAY-20 10.11.29.473162000 AM SYSTEM
Marines 06-MAY-20 10.03.43.849205000 AM SYS
Marines 06-MAY-20 09.03.43.727733000 AM SYS
Marines 06-MAY-20 08.03.43.592781000 AM SYS

Now they are back!!!

Good Hunting Comrade!!!

No comments:

Post a Comment