Skip to content
Keep Learning Keep Living
Keep Learning Keep Living
Keep Learning Keep Living

Old Obsolete Backup is not Deleted

Mustafa, 2023-01-232023-01-23

Hi,

Happy new year (after almost a month). I was quite busy and lazy to write a new blog post but today I found the energy.

What I realized newly is a little bit shocking for me because I had no idea! Maybe this is just an ignorance of me but I never read anything about this (I had read entire backup and recovery documentation of oracle) and never heard of it. Here is the problem: “Report Obsolete”  or “Delete Obsolete” commands don’t report or delete an old backup even if it is beyond the retention period.

At first, I thought probably I am missing something about retention period or maybe a datafile is not backed up correctly (which is not much a possibility). After debugging RMAN report obsolete command, some debug logs takes my attention and I think I found the issue but have no idea whether this is a bug or a feature. I will demonstrate it with a single non-cdb database instance to keep things easy. This is a 19.16 database in a virtual machine and this is happening in both Linux and windows. an empty database, here is the schema report:

Oracle PL/SQL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
RMAN> report schema;
 
Report of database schema for database with db_unique_name ORCL
 
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    1030     SYSTEM               YES     /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_j6xp8c17_.dbf
3    630      SYSAUX               NO      /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_j6xp9r68_.dbf
4    355      UNDOTBS1             YES     /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_j6xpbkbc_.dbf
5    10       TBS_TEST             NO      /u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbs_test_kwwz06qg_.dbf
7    5        USERS                NO      /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_j6xpblfl_.dbf
 
List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    106      TEMP                 32767       /u01/app/oracle/oradata/ORCL/datafile/o1_mf_temp_j6xpd6oz_.tmp

Let’s create a dummy tablespace first:

Oracle PL/SQL
1
2
3
SQL> create tablespace tbs_test datafile size 10M autoextend on next 10m;
 
Tablespace created.

Database has no backup at all at that point, Let’s get one:

Oracle PL/SQL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
RMAN> list backup of database;
 
specification does not match any backup in the repository
 
RMAN> backup database;
 
Starting backup at 23-JAN-23
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=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_j6xp8c17_.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_j6xp9r68_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_j6xpbkbc_.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbs_test_kwwz06qg_.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_j6xpblfl_.dbf
channel ORA_DISK_1: starting piece 1 at 23-JAN-23
channel ORA_DISK_1: finished piece 1 at 23-JAN-23
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2023_01_23/o1_mf_nnndf_TAG20230123T152626_kwwz7m6f_.bkp tag=TAG20230123T152626 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 23-JAN-23
 
Starting Control File and SPFILE Autobackup at 23-JAN-23
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2023_01_23/o1_mf_s_1126884402_kwwz8296_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 23-JAN-23

our new test tablespace TBS_TEST is backup up along with the database. Now, my retention period is default which is REDUNDANCY 1:

Oracle PL/SQL
1
2
3
4
RMAN> show retention policy;
 
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

that means only 1 last backup for everything (database, tablespace, datafile) is enough and all previous backups are “obsolete”. Now before getting a second backup let’s delete TBS_TEST tablespace:

Oracle PL/SQL
1
2
3
SQL> drop tablespace tbs_test including contents and datafiles;
 
Tablespace dropped.

and get a new backup:

Oracle PL/SQL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
RMAN> backup database;
 
Starting backup at 23-JAN-23
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=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_j6xp8c17_.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_j6xp9r68_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_j6xpbkbc_.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_j6xpblfl_.dbf
channel ORA_DISK_1: starting piece 1 at 23-JAN-23
list backup of database;
channel ORA_DISK_1: finished piece 1 at 23-JAN-23
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2023_01_23/o1_mf_nnndf_TAG20230123T152709_kwwz8xqj_.bkp tag=TAG20230123T152709 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 23-JAN-23
 
Starting Control File and SPFILE Autobackup at 23-JAN-23
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2023_01_23/o1_mf_s_1126884436_kwwz94v2_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 23-JAN-23

Good, I have two backups now and TBS_TEST is not included on the last one. since my retention policy is “REDUNDANCY 1”, previous backup should be “obsolete”. List backups:

Oracle PL/SQL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
RMAN> list backup of database;
 
List of Backup Sets
===================
 
 
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
13      Full    1.73G      DISK        00:00:07     23-JAN-23      
        BP Key: 13   Status: AVAILABLE  Compressed: NO  Tag: TAG20230123T152626
        Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2023_01_23/o1_mf_nnndf_TAG20230123T152626_kwwz7m6f_.bkp
  List of Datafiles in backup set 13
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  1       Full 2531160    23-JAN-23              NO    /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_j6xp8c17_.dbf
  3       Full 2531160    23-JAN-23              NO    /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_j6xp9r68_.dbf
  4       Full 2531160    23-JAN-23              NO    /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_j6xpbkbc_.dbf
  5       Full 2531160    23-JAN-23              NO    
  7       Full 2531160    23-JAN-23              NO    /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_j6xpblfl_.dbf
 
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
15      Full    1.72G      DISK        00:00:04     23-JAN-23      
        BP Key: 15   Status: AVAILABLE  Compressed: NO  Tag: TAG20230123T152709
        Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2023_01_23/o1_mf_nnndf_TAG20230123T152709_kwwz8xqj_.bkp
  List of Datafiles in backup set 15
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  1       Full 2531252    23-JAN-23              NO    /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_j6xp8c17_.dbf
  3       Full 2531252    23-JAN-23              NO    /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_j6xp9r68_.dbf
  4       Full 2531252    23-JAN-23              NO    /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_j6xpbkbc_.dbf
  7       Full 2531252    23-JAN-23              NO    /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_j6xpblfl_.dbf

as you see datafile 5 row in the first backup has no Datafile Name anymore because it is dropped. Now, lets report obsolete backups:

Oracle PL/SQL
1
2
3
4
5
6
7
8
9
RMAN> report obsolete;
 
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           14     23-JAN-23        
  Backup Piece       14     23-JAN-23          /u01/app/oracle/fast_recovery_area/ORCL/autobackup/2023_01_23/o1_mf_s_1126884402_kwwz8296_.bkp

Huh! Only autobackup is obsolete and report command doesn’t mention about previous backup! Please remember my retention is redundancy 1 so only last backup should be kept but RMAN is keeping previous backup, the one with dropped tablespace/datafile.

if I keep taking new backups and run report obsolete (or delete obsolete) commands, it doesn’t report the first backup, only the ones after that.

I tried this with a 19.3 databases and it didn’t happen! it marked old backup as obsolete immediately. So as I said, I don’t know if this is my ignorance, lack of knowledge of just missing something or a bug but on different systems (on virtual machines, linux and windows servers) for 19.16, I see this behavior.  Also, it could be a Container database or a non-cdb. You might want to check your systems if there are older backups than your retention periods.

Thanks for reading, wish you all a happy, healthy new year. My next post will be about a ORA-00600 which drives me crazy for a few weeks.

EDIT: I should add one more thing, by the retention policy requirements all archivelogs between old “obsolete” backup and the current one are deleted! so, this old backup file is completely useless.

19c Administration Multi-tenant 19.16backup is not marked as obsoletedelete obsoleteobsolete backup is not deletedreport obsoleterman

Post navigation

Previous post
Next post

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How to call HTTPS Url Without SSL Wallet in 19c
  • Is Table Unnecessary for Pipelined Function
  • Password Rollover Time in Seconds
  • PDB Syncronization Issue
  • How to limit DB Link Connection Timeout
  • Cloud Base Database Service
  • 29th of February and interval
  • How to Copy Local Files to Oracle Object Storage

Recent Comments

  • Mustafa on How to call HTTPS Url Without SSL Wallet in 19c
  • Накрутка авито on How to call HTTPS Url Without SSL Wallet in 19c
  • Mustafa on Cloud Base Database Service
  • Raja on Cloud Base Database Service
  • Mustafa on Refreshable PDB and ORA-17627: ORA-12578: TNS:wallet open failed

Categories

  • 11g
  • 12c
  • 18c
  • 19c
  • 21c
  • 23ai
  • Administration
  • Cloud
  • Compression
  • Development
  • Materialized View
  • Multi-tenant
  • Performance
  • Security
  • SQL / PLSQL
  • Uncategorized
  • Undocumented
  • Useful Scripts

Archives

  • April 2025
  • November 2024
  • July 2024
  • April 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • October 2021
  • September 2021
  • August 2021
  • April 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • July 2019
  • June 2019
  • May 2019
  • March 2019
  • February 2019
  • June 2018

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

RSS Follow This Blog

  • How to call HTTPS Url Without SSL Wallet in 19c
  • Is Table Unnecessary for Pipelined Function
  • Password Rollover Time in Seconds
  • PDB Syncronization Issue
  • How to limit DB Link Connection Timeout
  • Cloud Base Database Service
  • 29th of February and interval
  • How to Copy Local Files to Oracle Object Storage
  • Guid vs Sequences
  • Refreshable PDB and ORA-17627: ORA-12578: TNS:wallet open failed

Archives

  • April 2025
  • November 2024
  • July 2024
  • April 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • October 2021
  • September 2021
  • August 2021
  • April 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • July 2019
  • June 2019
  • May 2019
  • March 2019
  • February 2019
  • June 2018

RSS Follow This Blog

  • How to call HTTPS Url Without SSL Wallet in 19c
  • Is Table Unnecessary for Pipelined Function
  • Password Rollover Time in Seconds
  • PDB Syncronization Issue
  • How to limit DB Link Connection Timeout
  • Cloud Base Database Service
  • 29th of February and interval
  • How to Copy Local Files to Oracle Object Storage
  • Guid vs Sequences
  • Refreshable PDB and ORA-17627: ORA-12578: TNS:wallet open failed
RSS Error: A feed could not be found at `http://www.mywebsite.com/feed/`; the status code is `200` and content-type is `text/html; charset=UTF-8`
©2025 Keep Learning Keep Living | WordPress Theme by SuperbThemes