Skip to content
Home » Oracle Database » Control_File_Record_Keep_Time, How and Why

Control_File_Record_Keep_Time, How and Why

In this post, I'll talk about why we should increase CONTROL_FILE_RECORD_KEEP_TIME and how to increase it.

  1. RMAN Loss of Memory
  2. Check Backup Record Keep Size
  3. ALTER SYSTEM SET CONTROL_FILE_RECORD_KEEP_TIME

RMAN Loss of Memory

I found that RMAN backup records are lost regularly. Let's see the symptoms.

Obsolete Not Deleted

Some backup files older than 3 months are definitely obsolete according to redundancy policy, but running daily commands including DELETE OBSOLETE does not remove them. Additionally, they are not even in the backup records.

Backup Records Lost

Some old backup records are lost. It seems that control file regularly disconnect the relationship with those old backup records. Therefore, RMAN has no way to find obsolete files to delete.

Backup Records have no Content

Some old backup records contain no content. Although control file still keep those backup records, but it does not remember their content.

Let's see an aged backupset for instance. First, we crosscheck the backupset.

RMAN> crosscheck backupset 1990;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1334 instance=ORCLCDB1 device type=DISK
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/backup/2l0pdp4q_2133_1_1 RECID=1990 STAMP=1100407962
Crosschecked 1 objects

It looks good, so next, we list its content.

RMAN> list backupset 1990;

List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
1990    Incr 0  1.14M      DISK        00:00:00     2022-03-27 04:52:42
        BP Key: 1990   Status: AVAILABLE  Compressed: YES  Tag: TAG20220327T001514
        Piece Name: /backup/2l0pdp4q_2133_1_1

There's nothing in this backupset. Something is wrong.

Check Backup Record Keep Size

Let's see current size of backup records.

Backup Set

SQL> select records_used, records_total from v$controlfile_record_section where type='BACKUP SET';

RECORDS_USED RECORDS_TOTAL
------------ -------------
        1022          1022

This shows us that we can only keep at most 1022 backup sets currently.

Backup Piece

SQL> select records_used, records_total from v$controlfile_record_section where type='BACKUP PIECE';

RECORDS_USED RECORDS_TOTAL
------------ -------------
        1030          1030

This shows us that we can only keep at most 1030 backup pieces currently.

ALTER SYSTEM SET CONTROL_FILE_RECORD_KEEP_TIME

Such loss of memory in RMAN reminds me a parameter CONTROL_FILE_RECORD_KEEP_TIME which specifies the minimum number of days before a record in the control file can be reused in a circular fashion.

To keep more backup records than the current size, we should increase it, luckily, it's a dynamic parameter.

Check CONTROL_FILE_RECORD_KEEP_TIME

SQL> show parameter control_file_record_keep_time

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7

OK, it's 7 days which is the default value.

Increase CONTROL_FILE_RECORD_KEEP_TIME

Here we raise the value from 7 into 21.

SQL> alter system set control_file_record_keep_time=21;

System altered.

The default scope is BOTH in all instances. Which means, the parameter can be changed online.

Check Current CONTROL_FILE_RECORD_KEEP_TIME

SQL> show parameter control_file_record_keep_time

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     21

Now we can keep more backup records.

Leave a Reply

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