HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Why are backups of a previous incarnation marked obsolete without regard to redundancy?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
regardwhypreviousbackupsobsoletewithoutareredundancymarkedincarnation

Problem

After incomplete recovery and opening a 9i database with resetlogs we ran a full backup which completed successfully. The backup includes a command to delete obsolete backups after it finishes:

delete noprompt obsolete device type sbt;


RMAN is configured to use REDUNDANCY 2:

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;


However all the backups from the old incarnation were immediately marked obsolete and deleted without regard to redundancy.

  • Would this behaviour have been different if we had a RECOVERY WINDOW configured instead of REDUNDANCY 2?



  • Is this behaviour the same in later versions of Oracle?



edit: added output of LIST INCARNATION:

RMAN> list incarnation;

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            CUR Reset SCN      Reset Time
------- ------- -------- ---------------- --- -------------- ----------
1       1       LIVE     3494832994       NO  1              19-JAN-04
2       2       LIVE     3494832994       NO  11966702870498 01-JAN-14
3       3       LIVE     3494832994       YES 12041003378277 04-JUL-18

Solution

For The Interested RMAN Beginners

The RMAN policies REDUNDANCY and RECOVERY WINDOW are mutually exclusive. This means you can either set one or the other.

Redundancy Policy

Having set REDUNDANCY 2 will always keep only the last two backups and deleting (or marking obsolete) any other previous backups, that are no longer required to bring back the database into a consistent state.

Note:

If you have LEVEL 1 and ARCHIVELOG backups in between the FULL and/or LEVEL 0 backups, then they should be retained until no longer required.

Additional Information

According to the PDF file Oracle Database - Backup and Recovery Reference your retention policy REDUNDANCY 2 should not have deleted your older backups:


The following scenario illustrates how redundancy works in an incremental
backup strategy. Assume that the redundancy level is 1. You run a level 0
database backup at noon Monday, a level 1 cumulative backup at noon on
Tuesday and Wednesday, and a level 0 backup at noon on Thursday.
Immediately after each daily backup you run a DELETE OBSOLETE. The
Wednesday DELETE command does not remove the Tuesday level 1 backup
because this backup is not redundant: the Tuesday level 1 backup could be used
to recover the Monday level 0 backup to a time between noon on Tuesday and
noon on Wednesday. However, the DELETE command on Thursday removes the
previous level 0 and level 1 backups.

The above example uses a value of 1 but is clearly stating that earlier backups of full backups are not deleted until they are larger than the value configured.

Answering your questions

-
It depends, .... (see 2. and "Possible Issues")

-
According to the documentation the retention policy setting still seems to be the same for all versions:

  • Oracle 11c (11.1) : CONFIGURE



  • Oracle 11c (11.2) : CONFIGURE



  • Oracle 12c (12.1) : CONFIGURE



  • Oracle 12c (12.2) : CONFIGURE



  • Oracle 18c (18.x) : CONFIGURE



Possible Issues

  • You encountered a bug during the backup and restores of your database instance.



Reproducing with Oracle 12c

Because Oracle RDBMS 9i is pretty much obsolete and our environment is nearly up-to-date, I was only able to re-iterate/reproduce the steps in a 12c environment.

RMAN Configuration

RMAN was set up using the defaults:

RMAN> show all;

RMAN configuration parameters for database with db_unique_name ORACLE12JN are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'C:\ORACLE_12\PRODUCT\12.2.0\DBHOME_1\DATABASE\SNCFORACLE12JN.ORA'; # default

RMAN Backups

RMAN backups were performed by issuing a simple backup database; command:

RMAN> backup database;

Starting backup at 17-JUL-18
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=00001 name=C:\ORACLE_12\ORADATA\ORACLE12JN\SYSTEM01.DBF
input datafile file number=00005 name=C:\ORACLE_12\ORADATA\ORACLE12JN\UNDOTBS01.DBF
input datafile file number=00003 name=C:\ORACLE_12\ORADATA\ORACLE12JN\SYSAUX01.DBF
input datafile file number=00007 name=C:\ORACLE_12\ORADATA\ORACLE12JN\USERS01.DBF
channel ORA_DISK_1: starting piece 1 at 17-JUL-18
channel ORA_DISK_1: finished piece 1 at 17-JUL-18
piece handle=C:\ORACLE_12\RECOVERY_AREA\ORACLE12JN\BACKUPSET\2018_07_17\O1_MF_NNNDF_TAG20180717T151608_FNVV0RH4_.BKP tag=TAG20180717T151608 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 17-JUL-18

Starting Control File and SPFILE Autobackup at 17-JUL-18
piece handle=C:\ORACLE_12\RECOVERY_AREA\ORACLE12JN\AUTOBACKUP\2018_07_17\O1_MF_S_981731783_FNVV17QR_.BKP comment=NONE
Finished Control File and SPFILE Autobackup at 17-JUL-18

Verifying Backups, Check Obsolete Backups and List Incarnations

After a certain period of backups had been performed I double-checked the RMAN catalog:

RMAN> list backup summary;

List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- ------------------- ------- ------- ---------- ---
3 B F A DISK 2018-07-16 10:03:01 1 1 NO TAG2018071

Code Snippets

alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';
set pages 50
set lines 230
column Path format a20
select INCARNATION#, RESETLOGS_CHANGE#, RESETLOGS_TIME, 
PRIOR_INCARNATION#, STATUS, LEVEL, SYS_CONNECT_BY_PATH(INCARNATION#, ' -> ') Path 
from v$database_incarnation 
WHERE LEVEL >=1 START WITH INCARNATION# = '1' 
CONNECT BY PRIOR INCARNATION# = PRIOR_INCARNATION# 
order by Level, Path, RESETLOGS_TIME;

Context

StackExchange Database Administrators Q#211434, answer score: 4

Revisions (0)

No revisions yet.