Forum Stats

  • 3,824,773 Users
  • 2,260,416 Discussions
  • 7,896,309 Comments

Discussions

delete obsolete not working

Robeen
Robeen Member Posts: 2,179 Silver Badge
edited Aug 18, 2020 4:37AM in Recovery Manager (RMAN)

Oracle DB 12.1.0.2

Solaris 11.4

Hello Team,

Good morning.

I did a crosscheck backup on disk and found backups on 12 and 15 Aug 2020. RMAN retention recovery window is set to 2 days.

RMAN> crosscheck backup;

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/backup/files/CC_df_DWARE1_20200812_26571_1 RECID=26173 STAMP=1048269258

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/backup/files/CC_df_DWARE1_20200812_26572_1 RECID=26174 STAMP=1048269262

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/backup/files/CC_df_DWARE1_20200812_26570_1 RECID=26175 STAMP=1048269255

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/backup/files/CC_df_DWARE1_20200812_26569_1 RECID=26181 STAMP=1048269254

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=+RECO/DWARE1/AUTOBACKUP/2020_08_12/s_1048274205.6675.1048274205 RECID=26187 STAMP=1048274205

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/backup/files/CC_df_DWARE1_20200815_26917_1 RECID=26490 STAMP=1048544360

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/backup/files/CC_df_DWARE1_20200815_26918_1 RECID=26491 STAMP=1048544360

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/backup/files/CC_df_DWARE1_20200815_26916_1 RECID=26492 STAMP=1048544360

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/backup/files/CC_df_DWARE1_20200815_26915_1 RECID=26493 STAMP=1048544360

The problem is when is execute delete obsolete backups on 12 and 15 are not deleted.

RMAN> delete obsolete device type disk;

RMAN retention policy will be applied to the command

Kindly advise.

Thanks,

Joe

RMAN retention policy is set to recovery window of 2 days

no obsolete backups found

Answers

  • EdStevens
    EdStevens Member Posts: 28,778 Gold Crown
    edited Aug 17, 2020 10:24AM

    And what types of backups are these? 

    Recovery window of two days does NOT mean anything older than two days is obsolete.  It means rman will keep anything and everything needed to guarantee recovery to any point in time within the last two days (actually, last 48 hours) of when recovery is requested.  And all recovery must begin with the most recent level 0 backup prior to the recovery point in time.  So, to take an extreme example, if you only take a full/level 0 backup on the first day of the month, that backup and most (if not all) level 1 backups and archivelogs will still be needed - and thus NOT be obsolete - on the 30th of the month.

    Robeen
  • Joerg.Sobottka
    Joerg.Sobottka Senior Consultant and Oracle Ace Member Posts: 597 Bronze Trophy
    edited Aug 18, 2020 4:04AM

    Like EdStevens said, you have told rman that you want to be able to restore to any point in time for the last two days (starting from the "obsolete" command backwards).

    We do see your point many times in our workshops, so an example:

    You do set "recovery window 1 day" - this means, you tell the database to guarantee the possibility to recover to any point in the last 24 hours.

    You take incremental 0 backups (which is more or less a full one) on Sunday 1st, 8pm, it's running two hours.

    You take incremental backups level 1 (not cumulative!) every evening at 8pm (running an hour) and you are doing archive log backups every half an hour.

    Now it is Saturday, 7th, and you do a delete obsolete - nothing obsolete of the datafile backup is found (maybe some archivelogs are deleted).

    Now it is Sunday, 8th, you do your incremental level 0 backup, after this, you do a delete obsolete. Oracle will delete some old archivelog backups only, because to restore, the first level 0 and all level 1 backups + the latest archivelogs are still needed.

    No it is Monday, 9th, you do your incremental backup level 1 and a delete obsolete. As level 1 is faster than level 0, the backup ended at 9pm - to recover the last 24h, the first level 0 ist still needed (as the second level 1 ended at 10pm on Sunday, 8th, in the evening). So the first time, rman will delete the first level 0 backups and the incremental backups for the first week is, if you specify a delete obsolete after Monday, 9th, 10pm,

    This means, you do have more than a week backups on disk - even the recovery window is only ONE day.

    At the workshops, I therefore always specify a RESTORE and a RECOVER concept with the customers, because the backup strategy drops out of that concept "by itself", more or less.

  • Robeen
    Robeen Member Posts: 2,179 Silver Badge
    edited Aug 18, 2020 4:15AM

    Then how will the backup  incremental L0 backups and subsequent L1 backups be deleted from Monday 1st ?

  • Joerg.Sobottka
    Joerg.Sobottka Senior Consultant and Oracle Ace Member Posts: 597 Bronze Trophy
    edited Aug 18, 2020 4:37AM

    Only after 24hours (the set recovery window) AFTER the Sunday, 8th, backup has finished. So, if the backup has finished Sunday, 8th 10pm, the backups BEFORE this moment can/will be obsolete after Monday, 9th, 10:00:01pm.

    The "control_file_record_keep_time" must be set to e.g. 10 (days), that all these backups are still in the metadata repository of the controlfile (or you do use an external RMAN catalog).