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 ofREDUNDANCY 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
Best Answer
For The Interested RMAN Beginners
The RMAN policies
REDUNDANCY
andRECOVERY 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 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:Possible Issues
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 Backups
RMAN backups were performed by issuing a simple
backup database;
command:Verifying Backups, Check Obsolete Backups and List Incarnations
After a certain period of backups had been performed I double-checked the RMAN catalog:
Verified that no obsolete backups were lying around:
And listed the current incarnations:
Perform First Restore / Recovery
The following commands were issued to restore/recover the database into a consistent state:
The restore was successful and no backups were marked as obsolete even though the incarnation changed after the restore and with the
ALTER DATABASE OPEN RESETLOGS
issued.Alternate Incarnation Listing
An alternate representation of the incarnations can be achieved with the following command:
Output:
The advantage of querying the local catalog in the database instance is the representation of the incarnation as a path to follow
Perform Second Restore / Recovery
The following commands were issued to restore/recover the database into a consistent state again:
Ok, we've hit an incarnation "bump" in the restore path. We are currently on incarnation 3 as can be seen in the incarnation listing below which I copied from above:
...and the backup we are aiming for is after the RESETLOGS for incarnation 2. Let's reset the incarnation to 2 and proceed with the backup:
Seems to work. Let's restart the restore/recover again:
The restore was successful and no backups were marked as obsolete even though the incarnation changed after the restore and the
ALTER DATABASE OPEN RESETLOGS
was issued again. Now we are on a newer incarnation and still noObsolete Backups
reported.List of Current Incarnations After Second Restore (SQL)
Initiate Backup
After restoring the second time let's backup the database again:
Check Obsolete
We'll now check which (backup) files have become obsolete:
Check Incarnations (SQL)
As can be seen the incarnation 3 is now orphaned, because its direct line of heritage in regards to the current state of the database is broken. After the first restore we went back in time an re-restored the database again which results in the incarnation path
1 -> 2 -> 4
being the direct line of current ancestors for the open database.Because the direct line for restoring the current database is along the incarnations of 1, 2, 4 there is no need for RMAN to keep the obsolete backups listed above. They can safely be deleted.
Delete Obsolete
Let's go ahead and delete the obsolete backups:
List Backup Summary
Now that we have deleted some backup files and RMAN has performed some internal cleaning, let's have a look at the backup summary:
As we can see we still have "at least" two complete backup that will allow us to restore the database two backups in the past. RMAN (in 12c) did not delete any other backups along the incarnation path or outside of the orphaned incarnation.
Conclusion
Regarding the deleted backups after your initial restore in 9i I believe there are two possible scenarios:
Reference Material