Category - RMAN

RMAN Practices - PART 3- Back to Basics

RMAN Practices - PART 3- Back to Basics

In this article we will cover below topics.

Backup Retention Policy

The backup retention policy specifies which backups must be retained to meet your data recovery requirements.

This policy can be based on a recovery window or redundancy. Use the CONFIGURE RETENTION POLICY command to specify the retention policy.

Configuring a Redundancy-Based Retention Policy

The REDUNDANCY parameter of the CONFIGURE RETENTION POLICY command specifies how many full or level 0 backups of each data file and control file that RMAN keeps.
The default retention policy is REDUNDANCY 1.

If the number of full or level 0 backups for a specific data file or control file exceeds the REDUNDANCY setting, then RMAN considers the extra backups as obsolete.
RMAN retains all archived logs and incremental backups that are needed to recover the nonobsolete backups.

Assume that you make a full backup of data file 7 on Monday, Tuesday, Wednesday, and Thursday. You now have four full backups of this data file.
If REDUNDANCY is 2, then the Monday and Tuesday backups are obsolete. If you make another backup on Friday, then the Wednesday backup of data file 7 becomes obsolete.

Assume a different case in which REDUNDANCY is 1. You run a level 0 database backup at noon on 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 the command 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.

Run the CONFIGURE RETENTION POLICY command at the RMAN prompt, as in the following example:

CONFIGURE RETENTION POLICY TO REDUNDANCY 3;

Configuring a Recovery Window-Based Retention Policy

The RECOVERY WINDOW parameter of the CONFIGURE command specifies the number of days between the current time and the earliest point of recoverability.

RMAN does not consider any full or level 0 incremental backup as obsolete if it falls within the recovery window. Additionally, RMAN retains all archived logs and level 1 incremental backups that are needed to recover to a random point within the window.
Use the CONFIGURE RETENTION POLICY command at the RMAN prompt to configure a recovery window-based retention policy.

The following example ensures that you can recover the database to any point within the last week:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

RMAN does not automatically delete backups rendered obsolete by the recovery window. Instead, RMAN shows them as OBSOLETE in the REPORT OBSOLETE output and in the OBSOLETE column of V$BACKUP_FILES.
RMAN deletes obsolete files if you run the DELETE OBSOLETE command.

Disabling the Retention Policy

When you disable the retention policy, RMAN does not consider any backup as obsolete.

To disable the retention policy, run this command:

CONFIGURE RETENTION POLICY TO NONE;

Configuring the retention policy to NONE is different from clearing it. Clearing returns the default setting of REDUNDANCY 1, whereas NONE disables it.|


1=> Backup Retention Policies

You can use the CONFIGURE RETENTION POLICY command to create a persistent and automatic backup retention policy.

When a backup retention policy is in effect, RMAN considers a backup of data files or control files as an obsolete backup, that is, no longer needed for recovery, according to criteria specified in the CONFIGURE command.
You can use the REPORT OBSOLETE command to view obsolete files and the DELETE OBSOLETE command to delete them.

As you produce backups over time, older backups become obsolete as they are no longer needed to satisfy the retention policy. RMAN can identify the obsolete files for you, but it does not automatically delete them. You must use the DELETE OBSOLETE command to delete files that are no longer needed to satisfy the retention policy.

If a fast recovery area is configured, then the database automatically deletes files that are either obsolete or backed up to tape when more recovery area space is needed for new files. The disk quota rules are distinct from the retention policy rules, but the database never deletes files in violation of the retention policy to satisfy the disk quota.

A backup is obsolete when REPORT OBSOLETE or DELETE OBSOLETE determines, based on the user-defined retention policy, that it is not needed for recovery. A backup is considered an expired backup only when RMAN performs a crosscheck and cannot find the file. In short, obsolete means a file is not needed, whereas expired means it is not found.

A backup retention policy applies only to full or level 0 data file and control file backups. For data file copies and proxy copies, if RMAN determines that the copy or proxy copy is not needed, then the copy or proxy copy can be deleted. For data file backup sets, RMAN cannot delete the backup set until all data file backups within the backup set are obsolete.

The retention policy is not responsible for deleting or rendering obsolete archived redo logs and incremental level 1 backups. Rather, these files become obsolete when no full backups exist that need them. Besides affecting full or level 0 data file and control file backups, the retention policy affects archived redo logs and level 1 incremental backups. First, RMAN decides which data file and control file backups are obsolete. Then, RMAN considers as obsolete all archived logs and incremental level 1 backups that are not needed to recover the oldest data file or control file backup that must be retained.

Note:RMAN cannot implement an automatic retention policy if backups are deleted by non-RMAN techniques, for example, through the media manager's tape retention policy. The media manager must never expire a tape until all RMAN backups on that tape have been removed from the media manager's catalog.


There are two mutually exclusive options for implementing a retention policy:

    redundancy

    recovery window.

About the Recovery Window

A recovery window is a period that begins with the current time and extends backward in time to the point of recoverability. The point of recoverability is the earliest time for a hypothetical point-in-time recovery, that is, the earliest point to which you can recover following a media failure.

For example, if you implement a recovery window of 1 week, then RMAN retains full backups and required incremental backups and archived logs so that the database can be recovered up to 7 days in the past. You implement this retention policy as follows:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

This command ensures that for each data file, one backup that is older than the point of recoverability is retained. For example, if the recovery window is 7, then there must always exist one backup of each data file that satisfies the following condition:

SYSDATE - BACKUP CHECKPOINT TIME >= 7

All backups older than the most recent backup that satisfied this condition are obsolete.

Assume the retention policy illustrated in Figure 8-4. The retention policy has the following aspects:

    The recovery window is 7 days.

    Database backups are scheduled every two weeks on these days:

        January 1

        January 15

        January 29

        February 12

    The database runs in ARCHIVELOG mode, and archived logs are saved on disk only if needed for the retention policy.


About Backup Redundancy

A redundancy-based retention policy specifies how many backups of each data file must be retained.

The default retention policy is configured to REDUNDANCY 1.

For example, you can configure a redundancy of 2 as follows:

CONFIGURE RETENTION POLICY TO REDUNDANCY 2;

Note that in some cases using a recovery window can complicate disk space planning because the number of backups that must be retained is not constant and depends on the backup schedule.

 

Backup of Backupset And Backup of Image Copy Backups.

This section explains how to back up backup sets and image copies.

About Backups of RMAN Backups

You can use the BACKUP BACKUPSET command to back up backup sets produced by other backup jobs.
You can also use BACKUP RECOVERY AREA to back up recovery files created in the current and all previous fast recovery area destinations.
For disk backups of the recovery files, you must use the TO DESTINATION option.

You can also use the BACKUP COPY OF command to back up image copies of data files, control files, and archived redo logs.
The output of this command can be either backup sets or image copies, so you can generate backup sets from image copies.
This form of backup is used to back up a database backup created as image copies on disk to tape.

About Multiple Copies of RMAN Backup Sets

The BACKUP BACKUPSET command creates additional copies of backup pieces in a backup set, but does not create a new backup set.

Thus, BACKUP BACKUPSET is similar to using the DUPLEX or MAXCOPIES option of BACKUP.
The extra copy of a backup set created by BACKUP BACKUPSET is not a new backup set, just as copies of a backup set produced by other forms of the BACKUP command are not separate backup sets.

Backing Up Backup Sets with RMAN

Use the BACKUP BACKUPSET command to copy backup sets from disk to tape.

RMAN> report schema; 

Report of database schema for database with db_unique_name TNT

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    920      SYSTEM               YES     +DATA/TNT/DATAFILE/system.282.1115902991
3    600      SYSAUX               NO      +DATA/TNT/DATAFILE/sysaux.283.1115903017
4    335      UNDOTBS1             YES     +DATA/TNT/DATAFILE/undotbs1.284.1115903031
5    50       UNDOTBS2             YES     +DATA/TNT/DATAFILE/undotbs2.290.1115904057
7    5        USERS                NO      +DATA/TNT/DATAFILE/users.285.1115903033

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    35       TEMP                 32767       +DATA/TNT/TEMPFILE/temp.289.1115903147

RMAN> list backup of datafile 7;
specification does not match any backup in the repository

RMAN> backup as backupset datafile 7;
Starting backup at 06-OCT-22
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=+DATA/TNT/DATAFILE/users.285.1115903033
channel ORA_DISK_1: starting piece 1 at 06-OCT-22
channel ORA_DISK_1: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t152709_0.772.1117380431 tag=TAG20221006T152709 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
Finished backup at 06-OCT-22

Starting Control File and SPFILE Autobackup at 06-OCT-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_10_06/s_1117380433.762.1117380435 comment=NONE
Finished Control File and SPFILE Autobackup at 06-OCT-22

RMAN> list backup of datafile 7 summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
115     B  F  A DISK        06-OCT-22       1       1       NO         TAG20221006T152709

RMAN> list backupset;

List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
115     Full    2.45M      DISK        00:00:01     06-OCT-22     
        BP Key: 169   Status: AVAILABLE  Compressed: NO  Tag: TAG20221006T152709
        Piece Name: +FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t152709_0.772.1117380431
  List of Datafiles in backup set 115
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  7       Full 2505183    06-OCT-22              NO    +DATA/TNT/DATAFILE/users.285.1115903033

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
116     Full    10.27M     DISK        00:00:02     06-OCT-22     
        BP Key: 170   Status: AVAILABLE  Compressed: NO  Tag: TAG20221006T152713
        Piece Name: +FRA/TNT/AUTOBACKUP/2022_10_06/s_1117380433.762.1117380435
  SPFILE Included: Modification time: 06-OCT-22
  SPFILE db_unique_name: TNT
  Control File Included: Ckp SCN: 2505193      Ckp time: 06-OCT-22

RMAN> backup backupset 115;

Starting backup at 06-OCT-22
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: input backup set: count=155, stamp=1117380429, piece=1
channel ORA_DISK_1: starting piece 1 at 06-OCT-22
channel ORA_DISK_1: backup piece +FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t152709_0.772.1117380431
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/nnnnf0_0.763.1117380509 comment=NONE
channel ORA_DISK_1: finished piece 1 at 06-OCT-22
channel ORA_DISK_1: backup piece complete, elapsed time: 00:00:04
Finished backup at 06-OCT-22

Starting Control File and SPFILE Autobackup at 06-OCT-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_10_06/s_1117380512.771.1117380515 comment=NONE
Finished Control File and SPFILE Autobackup at 06-OCT-22

RMAN> list backupset;

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

BS Key  Type LV Size
------- ---- -- ----------
115     Full    2.45M
  List of Datafiles in backup set 115
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  7       Full 2505183    06-OCT-22              NO    +DATA/TNT/DATAFILE/users.285.1115903033

  Backup Set Copy #1 of backup set 115
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:00:01     06-OCT-22       NO         TAG20221006T152709

    List of Backup Pieces for backup set 115 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    169     1   AVAILABLE   +FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t152709_0.772.1117380431

  Backup Set Copy #2 of backup set 115
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:00:01     06-OCT-22       NO         TAG20221006T152709

    List of Backup Pieces for backup set 115 Copy #2
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    171     1   AVAILABLE   +FRA/TNT/BACKUPSET/2022_10_06/nnnnf0_0.763.1117380509

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
116     Full    10.27M     DISK        00:00:02     06-OCT-22     
        BP Key: 170   Status: AVAILABLE  Compressed: NO  Tag: TAG20221006T152713
        Piece Name: +FRA/TNT/AUTOBACKUP/2022_10_06/s_1117380433.762.1117380435
  SPFILE Included: Modification time: 06-OCT-22
  SPFILE db_unique_name: TNT
  Control File Included: Ckp SCN: 2505193      Ckp time: 06-OCT-22

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
117     Full    10.27M     DISK        00:00:02     06-OCT-22     
        BP Key: 172   Status: AVAILABLE  Compressed: NO  Tag: TAG20221006T152832
        Piece Name: +FRA/TNT/AUTOBACKUP/2022_10_06/s_1117380512.771.1117380515
  SPFILE Included: Modification time: 06-OCT-22
  SPFILE db_unique_name: TNT
  Control File Included: Ckp SCN: 2505304      Ckp time: 06-OCT-22

RMAN>  list backup of datafile 7 summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
115     B  F  A DISK        06-OCT-22       1       2       NO         TAG20221006T152709

The extra copy of a backup set created by BACKUP BACKUPSET is not a new backup set, just as copies of a backup set produced by other forms of the BACKUP command are not separate backup sets.

Backing Up Image Copy Backups with RMAN

Use the BACKUP command to back up image copies to tape.

This section assumes that you have configured an SBT device as your default device.

When you back up image copies that have multiple copies of the data files, specifying tags for the backups makes it easier to identify the input image copy.
All image copies of data files have tags. The tag of an image copy is inherited by default when the image copy is backed up as a new image copy.

=> Take backup of datafile as COPY .

oracle@racsetn1 bkp]$ rman target /

RMAN> report schema ;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name TNT

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    920      SYSTEM               YES     +DATA/TNT/DATAFILE/system.282.1115902991
3    600      SYSAUX               NO      +DATA/TNT/DATAFILE/sysaux.283.1115903017
4    335      UNDOTBS1             YES     +DATA/TNT/DATAFILE/undotbs1.284.1115903031
5    50       UNDOTBS2             YES     +DATA/TNT/DATAFILE/undotbs2.290.1115904057
7    5        USERS                NO      +DATA/TNT/DATAFILE/users.285.1115903033

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    35       TEMP                 32767       +DATA/TNT/TEMPFILE/temp.289.1115903147

RMAN> list backup of datafile 7 summary;
specification does not match any backup in the repository

RMAN> list copy of datafile 7 ;
specification does not match any datafile copy in the repository

RMAN> backup as copy datafile 7 format '/ora_home/bkp/DB_FILE_7_COPY_%d_%u_%s';

Starting backup at 06-OCT-22
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting datafile copy
input datafile file number=00007 name=+DATA/TNT/DATAFILE/users.285.1115903033
output file name=/ora_home/bkp/DB_FILE_7_COPY_TNT_5i19josk_178 tag=TAG20221006T154524 RECID=9 STAMP=1117381525
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 06-OCT-22

Starting Control File and SPFILE Autobackup at 06-OCT-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_10_06/s_1117381526.755.1117381529 comment=NONE
Finished Control File and SPFILE Autobackup at 06-OCT-22

RMAN>  list copy of datafile 7 ;
List of Datafile Copies
=======================

Key     File S Completion Time Ckp SCN    Ckp Time        Sparse
------- ---- - --------------- ---------- --------------- ------
9       7    A 06-OCT-22       2509751    06-OCT-22       NO   
        Name: /ora_home/bkp/DB_FILE_7_COPY_TNT_5i19josk_178
        Tag: TAG20221006T154524

RMAN> list backup of datafile 7 summary;

specification does not match any backup in the repository

=> Take backup of Copy of datafile AS BELOW. (Generate backup sets from image copies)

RMAN> backup copy of datafile 7 format '/ora_home/bkp/DB_FILE_7_BS_%d_%u_%s';

Starting backup at 06-OCT-22
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: including datafile copy of datafile 00007 in backup set
input file name=/ora_home/bkp/DB_FILE_7_COPY_TNT_5i19josk_178
channel ORA_DISK_1: starting piece 1 at 06-OCT-22
channel ORA_DISK_1: finished piece 1 at 06-OCT-22
piece handle=/ora_home/bkp/DB_FILE_7_BS_TNT_5k19jov3_180 tag=TAG20221006T154643 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 06-OCT-22

Starting Control File and SPFILE Autobackup at 06-OCT-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_10_06/s_1117381605.753.1117381607 comment=NONE
Finished Control File and SPFILE Autobackup at 06-OCT-22

RMAN>  list backup of datafile 7 summary;
List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
129     B  F  A DISK        06-OCT-22       1       1       NO         TAG20221006T154643

RMAN>  list copy of datafile 7 ;

List of Datafile Copies
=======================

Key     File S Completion Time Ckp SCN    Ckp Time        Sparse
------- ---- - --------------- ---------- --------------- ------
9       7    A 06-OCT-22       2509751    06-OCT-22       NO   
        Name: /ora_home/bkp/DB_FILE_7_COPY_TNT_5i19josk_178
        Tag: TAG20221006T154524

RMAN> exit

Recovery Manager complete.

[oracle@racsetn1 bkp]$ du -sh *
2.5M DB_FILE_7_BS_TNT_5k19jov3_180  =>>> This is Backupset
5.1M DB_FILE_7_COPY_TNT_5i19josk_178 =>>> this is Copy of datafile 7
12K TNT
[oracle@racsetn1 bkp]$ 

=> Take backup of ALL Copy of datafile AS BELOW. (Generate backup sets from image copies)

RMAN> backup datafilecopy all;

Starting backup at 06-OCT-22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=158 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=277 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=279 instance=TNT1 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: including datafile copy of datafile 00007 in backup set
input file name=/ora_home/bkp/DB_FILE_7_COPY_TNT_5i19josk_178
channel ORA_DISK_1: starting piece 1 at 06-OCT-22
channel ORA_DISK_1: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t155346_0.758.1117382027 tag=TAG20221006T155346 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 06-OCT-22

Starting Control File and SPFILE Autobackup at 06-OCT-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_10_06/s_1117382030.761.1117382033 comment=NONE
Finished Control File and SPFILE Autobackup at 06-OCT-22

RMAN>

Backup Optimization

Backup optimization skips the backup of files in certain circumstances if the identical file or an identical version of the file has been backed up.
When you enable backup optimization, the BACKUP command skips backing up files when the identical file has been backed up to the specified device type.

RMAN uses backup optimization when the following conditions are true:

=>  The CONFIGURE BACKUP OPTIMIZATION ON command has been run to enable backup optimization.
=> You run BACKUP DATABASE, BACKUP ARCHIVELOG with ALL or LIKE options, or BACKUP BACKUPSET ALL, BACKUP RECOVERY AREA, BACKUP RECOVERY FILES, or BACKUP DATAFILECOPY.
=> When TO DESTINATION is used with BACKUP RECOVERY AREA or BACKUP RECOVERY FILES, RMAN only skips backups of files that have identical backups in the TO DESTINATION location that you provide.

Backup OPTIMIZATION & ARCHIVELOG Backups.

=> Let we first take backup of all archivelogs as below.

RMAN> BACKUP ARCHIVELOG ALL;

Starting backup at 06-OCT-22
current log archived
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=2 sequence=13 RECID=24 STAMP=1116432948
channel ORA_DISK_1: starting piece 1 at 06-OCT-22
channel ORA_DISK_2: starting archived log backup set
channel ORA_DISK_2: specifying archived log(s) in backup set
input archived log thread=1 sequence=17 RECID=27 STAMP=1117377652
input archived log thread=1 sequence=18 RECID=28 STAMP=1117377653
input archived log thread=2 sequence=15 RECID=30 STAMP=1117385812
channel ORA_DISK_2: starting piece 1 at 06-OCT-22
channel ORA_DISK_3: starting archived log backup set
channel ORA_DISK_3: specifying archived log(s) in backup set
input archived log thread=1 sequence=15 RECID=23 STAMP=1116432946
input archived log thread=1 sequence=16 RECID=25 STAMP=1116432950
input archived log thread=2 sequence=14 RECID=26 STAMP=1117377648
channel ORA_DISK_3: starting piece 1 at 06-OCT-22
channel ORA_DISK_1: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/annnf0_tag20221006t165653_0.739.1117385815 tag=TAG20221006T165653 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:12
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=19 RECID=29 STAMP=1117385810
channel ORA_DISK_1: starting piece 1 at 06-OCT-22
channel ORA_DISK_2: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/annnf0_tag20221006t165653_0.749.1117385817 tag=TAG20221006T165653 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:11
channel ORA_DISK_3: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/annnf0_tag20221006t165653_0.744.1117385821 tag=TAG20221006T165653 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:09
channel ORA_DISK_1: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/annnf0_tag20221006t165653_0.748.1117385827 tag=TAG20221006T165653 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
Finished backup at 06-OCT-22

Starting Control File and SPFILE Autobackup at 06-OCT-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_10_06/s_1117385831.741.1117385833 comment=NONE
Finished Control File and SPFILE Autobackup at 06-OCT-22

=> Now let we enable OPTIMIZATION ON as below.

RMAN> configure backup optimization on;

new RMAN configuration parameters:
CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters are successfully stored

RMAN>

=> Let we Take backup of archivelog all as below.
As we can see due to OPTIMIZATION in ON , RMAN has skipped those files which are not modified as below.

RMAN> BACKUP ARCHIVELOG ALL;

Starting backup at 06-OCT-22
current log archived
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
skipping archived logs of thread 1 from sequence 15 to 19; already backed up
skipping archived logs of thread 2 from sequence 13 to 15; already backed up
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=20 RECID=32 STAMP=1117385859
channel ORA_DISK_1: starting piece 1 at 06-OCT-22
channel ORA_DISK_2: starting archived log backup set
channel ORA_DISK_2: specifying archived log(s) in backup set
input archived log thread=2 sequence=16 RECID=31 STAMP=1117385859
channel ORA_DISK_2: starting piece 1 at 06-OCT-22
channel ORA_DISK_1: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/annnf0_tag20221006t165740_0.760.1117385861 tag=TAG20221006T165740 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
channel ORA_DISK_2: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/annnf0_tag20221006t165740_0.756.1117385863 tag=TAG20221006T165740 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:04
Finished backup at 06-OCT-22

Starting Control File and SPFILE Autobackup at 06-OCT-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_10_06/s_1117385865.752.1117385867 comment=NONE
Finished Control File and SPFILE Autobackup at 06-OCT-22

=> Let we Clear OPTIMIZATION and take backup again.
And as we can see It's Including all archivelogs in backup set due to OPTIMIZATION is OFF.

RMAN> CONFIGURE  BACKUP OPTIMIZATION  CLEAR;

old RMAN configuration parameters:
CONFIGURE BACKUP OPTIMIZATION ON;
RMAN configuration parameters are successfully reset to default value

RMAN>  SHOW ALL;

RMAN configuration parameters for database with db_unique_name TNT are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;
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;
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 '/ora_home/app/19c/db/dbs/snapcf_TNT1.f'; # default

RMAN> BACKUP ARCHIVELOG ALL;

Starting backup at 06-OCT-22

current log archived
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=2 sequence=13 RECID=24 STAMP=1116432948
channel ORA_DISK_1: starting piece 1 at 06-OCT-22
channel ORA_DISK_2: starting archived log backup set
channel ORA_DISK_2: specifying archived log(s) in backup set
input archived log thread=1 sequence=18 RECID=28 STAMP=1117377653
input archived log thread=2 sequence=15 RECID=30 STAMP=1117385812
input archived log thread=1 sequence=19 RECID=29 STAMP=1117385810
input archived log thread=1 sequence=20 RECID=32 STAMP=1117385859
channel ORA_DISK_2: starting piece 1 at 06-OCT-22
channel ORA_DISK_3: starting archived log backup set
channel ORA_DISK_3: specifying archived log(s) in backup set
input archived log thread=1 sequence=15 RECID=23 STAMP=1116432946
input archived log thread=1 sequence=16 RECID=25 STAMP=1116432950
input archived log thread=2 sequence=14 RECID=26 STAMP=1117377648
input archived log thread=1 sequence=17 RECID=27 STAMP=1117377652
channel ORA_DISK_3: starting piece 1 at 06-OCT-22
channel ORA_DISK_1: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/annnf0_tag20221006t165836_0.750.1117385917 tag=TAG20221006T165836 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:11
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=2 sequence=16 RECID=31 STAMP=1117385859
input archived log thread=2 sequence=17 RECID=33 STAMP=1117385914
input archived log thread=1 sequence=21 RECID=34 STAMP=1117385916
channel ORA_DISK_1: starting piece 1 at 06-OCT-22
channel ORA_DISK_2: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/annnf0_tag20221006t165836_0.747.1117385923 tag=TAG20221006T165836 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:11
channel ORA_DISK_3: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/annnf0_tag20221006t165836_0.740.1117385927 tag=TAG20221006T165836 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_1: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/annnf0_tag20221006t165836_0.773.1117385931 tag=TAG20221006T165836 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05
Finished backup at 06-OCT-22

Starting Control File and SPFILE Autobackup at 06-OCT-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_10_06/s_1117385935.774.1117385937 comment=NONE
Finished Control File and SPFILE Autobackup at 06-OCT-22

RMAN>

Backup OPTIMIZATION & READONLY TABLESPACE Backups.

[oracle@racsetn1 bkp]$ sqlplus "/as sysdba"

SQL> ALTER TABLESPACE RO_TS READ ONLY;

Tablespace altered.

SQL> SELECT STATUS FROM  DBA_TABLESPACES WHERE TABLESPACE_NAME LIKE 'RO_TS';

STATUS
---------
READ ONLY

SQL> select ONLINE_STATUS,STATUS FROM DBA_DATA_FILES  WHERE TABLESPACE_NAME LIKE 'RO_TS';

ONLINE_ STATUS
------- ---------
ONLINE AVAILABLE

[oracle@racsetn1 bkp]$ rman target /

RMAN> list backup of tablespace RO_tS;

using target database control file instead of recovery catalog
specification does not match any backup in the repository

RMAN>

RMAN> backup database;

Starting backup at 06-OCT-22
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=289 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=277 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=411 instance=TNT1 device type=DISK
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=+DATA/TNT/DATAFILE/system.282.1115902991
input datafile file number=00007 name=+DATA/TNT/DATAFILE/users.285.1115903033
channel ORA_DISK_1: starting piece 1 at 06-OCT-22
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00003 name=+DATA/TNT/DATAFILE/sysaux.283.1115903017
input datafile file number=00005 name=+DATA/TNT/DATAFILE/undotbs2.290.1115904057
channel ORA_DISK_2: starting piece 1 at 06-OCT-22
channel ORA_DISK_3: starting full datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00004 name=+DATA/TNT/DATAFILE/undotbs1.284.1115903031
input datafile file number=00002 name=+DATA/TNT/DATAFILE/ro_ts.294.1117385373
channel ORA_DISK_3: starting piece 1 at 06-OCT-22
channel ORA_DISK_3: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t171441_0.780.1117386887 tag=TAG20221006T171441 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:18
channel ORA_DISK_1: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t171441_0.782.1117386883 tag=TAG20221006T171441 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:40
channel ORA_DISK_2: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t171441_0.779.1117386883 tag=TAG20221006T171441 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:39
Finished backup at 06-OCT-22

Starting Control File and SPFILE Autobackup at 06-OCT-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_10_06/s_1117386922.781.1117386923 comment=NONE
Finished Control File and SPFILE Autobackup at 06-OCT-22

RMAN> exit

Recovery Manager complete.

[oracle@racsetn1 bkp]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Thu Oct 6 17:15:35 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: TNT (DBID=1427195521)

RMAN>  list backup of tablespace RO_tS;

using target database control file instead of recovery catalog

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

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
179     Full    3.18M      DISK        00:00:06     06-OCT-22    
        BP Key: 234   Status: AVAILABLE  Compressed: NO  Tag: TAG20221006T171441
        Piece Name: +FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t171441_0.780.1117386887
  List of Datafiles in backup set 179
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  2       Full 2518188    06-OCT-22              NO    +DATA/TNT/DATAFILE/ro_ts.294.1117385373

RMAN> exit

[oracle@racsetn1 bkp]$ rman target /

RMAN> SHOW ALL;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name TNT are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;
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;
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 '/ora_home/app/19c/db/dbs/snapcf_TNT1.f'; # default

RMAN>  backup database;

Starting backup at 06-OCT-22
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=277 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=289 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=411 instance=TNT1 device type=DISK
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=+DATA/TNT/DATAFILE/system.282.1115902991
input datafile file number=00007 name=+DATA/TNT/DATAFILE/users.285.1115903033
channel ORA_DISK_1: starting piece 1 at 06-OCT-22
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00003 name=+DATA/TNT/DATAFILE/sysaux.283.1115903017
input datafile file number=00005 name=+DATA/TNT/DATAFILE/undotbs2.290.1115904057
channel ORA_DISK_2: starting piece 1 at 06-OCT-22
channel ORA_DISK_3: starting full datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00004 name=+DATA/TNT/DATAFILE/undotbs1.284.1115903031
input datafile file number=00002 name=+DATA/TNT/DATAFILE/ro_ts.294.1117385373
channel ORA_DISK_3: starting piece 1 at 06-OCT-22
channel ORA_DISK_3: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t171633_0.778.1117386999 tag=TAG20221006T171633 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:16
channel ORA_DISK_2: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t171633_0.775.1117386997 tag=TAG20221006T171633 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:37
channel ORA_DISK_1: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t171633_0.776.1117386995 tag=TAG20221006T171633 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:38
Finished backup at 06-OCT-22

Starting Control File and SPFILE Autobackup at 06-OCT-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_10_06/s_1117387032.777.1117387033 comment=NONE
Finished Control File and SPFILE Autobackup at 06-OCT-22

RMAN>  backup database;

Starting backup at 06-OCT-22
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
skipping datafile 2; already backed up 2 time(s)
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=+DATA/TNT/DATAFILE/system.282.1115902991
channel ORA_DISK_1: starting piece 1 at 06-OCT-22
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00003 name=+DATA/TNT/DATAFILE/sysaux.283.1115903017
input datafile file number=00007 name=+DATA/TNT/DATAFILE/users.285.1115903033
channel ORA_DISK_2: starting piece 1 at 06-OCT-22
channel ORA_DISK_3: starting full datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00004 name=+DATA/TNT/DATAFILE/undotbs1.284.1115903031
input datafile file number=00005 name=+DATA/TNT/DATAFILE/undotbs2.290.1115904057
channel ORA_DISK_3: starting piece 1 at 06-OCT-22
channel ORA_DISK_3: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t171922_0.747.1117387167 tag=TAG20221006T171922 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:17
channel ORA_DISK_1: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t171922_0.773.1117387163 tag=TAG20221006T171922 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:39
channel ORA_DISK_2: finished piece 1 at 06-OCT-22
piece handle=+FRA/TNT/BACKUPSET/2022_10_06/nnndf0_tag20221006t171922_0.774.1117387165 tag=TAG20221006T171922 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:38
Finished backup at 06-OCT-22

Starting Control File and SPFILE Autobackup at 06-OCT-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_10_06/s_1117387202.740.1117387203 comment=NONE
Finished Control File and SPFILE Autobackup at 06-OCT-22

RMAN>

As we can see Backup for datafile 2 is skipped due to OPTIMIZATION is ON for READ ONLY tablespace. 
Here OPTIMIZATION comes in picture post 1 redundant backup as due to CONFIGURE RETENTION POLICY TO REDUNDANCY 1.

Skipping Offline, Read-Only, and Inaccessible Files

By default, the BACKUP command terminates when it cannot access a data file.

You can specify below parameters to prevent termination,

If you specify...     Then RMAN skips...

SKIP INACCESSIBLE   -Data files that RMAN cannot read.

SKIP OFFLINE       -Offline data files. Some offline data files can still be read because they exist on disk. Others have been deleted or moved and so cannot be read, making them inaccessible.

SKIP READONLY   -Data files in read-only tablespaces.

=> Get DBFILE details as below.

RMAN> REPORT SCHEMA;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name TNT

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    920      SYSTEM               YES     +DATA/TNT/DATAFILE/system.282.1115902991
2    100      RO_TS                NO      +DATA/TNT/DATAFILE/ro_ts.294.1117384207
3    600      SYSAUX               NO      +DATA/TNT/DATAFILE/sysaux.283.1115903017
4    335      UNDOTBS1             YES     +DATA/TNT/DATAFILE/undotbs1.284.1115903031
5    50       UNDOTBS2             YES     +DATA/TNT/DATAFILE/undotbs2.290.1115904057
7    5        USERS                NO      +DATA/TNT/DATAFILE/users.285.1115903033

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    35       TEMP                 32767       +DATA/TNT/TEMPFILE/temp.289.1115903147

RMAN> EXIT

=> Make datafile OFFLINE as below

SQL> alter database datafile 2 offline;

Database altered.

SQL> select status from dba_data_files where tablespace_name ='RO_TS';

STATUS
---------
AVAILABLE

SQL> select ONLINE_STATUS from dba_data_files where tablespace_name ='RO_TS';

ONLINE_
-------
OFFLINE
=> Let we check if we can take backup of datafile 2 as below.

[oracle@racsetn1 bkp]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Thu Oct 6 16:45:29 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: TNT (DBID=1427195521)

RMAN>  backup database format '/ora_home/bkp/DB_%d_%u_%s';

Starting backup at 06-OCT-22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=411 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=158 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=289 instance=TNT1 device type=DISK
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=+DATA/TNT/DATAFILE/system.282.1115902991
input datafile file number=00007 name=+DATA/TNT/DATAFILE/users.285.1115903033
channel ORA_DISK_1: starting piece 1 at 06-OCT-22
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00003 name=+DATA/TNT/DATAFILE/sysaux.283.1115903017
input datafile file number=00005 name=+DATA/TNT/DATAFILE/undotbs2.290.1115904057
channel ORA_DISK_2: starting piece 1 at 06-OCT-22
channel ORA_DISK_3: starting full datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00004 name=+DATA/TNT/DATAFILE/undotbs1.284.1115903031
input datafile file number=00002 name=+DATA/TNT/DATAFILE/ro_ts.294.1117384207
channel ORA_DISK_3: starting piece 1 at 06-OCT-22
channel ORA_DISK_3: finished piece 1 at 06-OCT-22
piece handle=/ora_home/bkp/DB_TNT_5v19jsdh_191 tag=TAG20221006T164537 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: finished piece 1 at 06-OCT-22
piece handle=/ora_home/bkp/DB_TNT_5t19jsdh_189 tag=TAG20221006T164537 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
channel ORA_DISK_2: finished piece 1 at 06-OCT-22
piece handle=/ora_home/bkp/DB_TNT_5u19jsdh_190 tag=TAG20221006T164537 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:08
Finished backup at 06-OCT-22

Starting Control File and SPFILE Autobackup at 06-OCT-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_10_06/s_1117385146.743.1117385147 comment=NONE
Finished Control File and SPFILE Autobackup at 06-OCT-22

RMAN> exit

=> Let we remove above datafile.

[oracle@racsetn1 bkp]$ asmcmd

ASMCMD> cd +DATA/TNT/DATAFILE/
ASMCMD> rm RO_TS.294.1117384207
ASMCMD> ls
SYSAUX.283.1115903017
SYSTEM.282.1115902991
UNDOTBS1.284.1115903031
UNDOTBS2.290.1115904057
USERS.285.1115903033
ASMCMD> exit

[oracle@racsetn1 bkp]$ rman target /

connected to target database: TNT (DBID=1427195521)

RMAN> backup database format '/ora_home/bkp/DB_%d_%u_%s';

Starting backup at 06-OCT-22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=289 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=277 instance=TNT1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=411 instance=TNT1 device type=DISK
RMAN-06169: could not read file header for datafile 2 error reason 4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 10/06/2022 16:47:42
RMAN-06056: could not access datafile 2

RMAN> exit

as we can see we are getting error while backing up files which are inaccessible.

=> Let we backup using SKIP OFFLINE cluase as below.

RMAN>  backup database skip OFFLINE  format '/ora_home/bkp/DB_%d_%u_%s';

Starting backup at 06-OCT-22
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
RMAN-06169: could not read file header for datafile 2 error reason 4
skipping offline file 2
RMAN-06060: warning: skipping datafile compromises tablespace RO_TS recoverability
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=+DATA/TNT/DATAFILE/system.282.1115902991
channel ORA_DISK_1: starting piece 1 at 06-OCT-22
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00003 name=+DATA/TNT/DATAFILE/sysaux.283.1115903017
input datafile file number=00007 name=+DATA/TNT/DATAFILE/users.285.1115903033
channel ORA_DISK_2: starting piece 1 at 06-OCT-22
channel ORA_DISK_3: starting full datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00004 name=+DATA/TNT/DATAFILE/undotbs1.284.1115903031
input datafile file number=00005 name=+DATA/TNT/DATAFILE/undotbs2.290.1115904057
channel ORA_DISK_3: starting piece 1 at 06-OCT-22
channel ORA_DISK_1: finished piece 1 at 06-OCT-22
piece handle=/ora_home/bkp/DB_TNT_6119jsk4_193 tag=TAG20221006T164908 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05
channel ORA_DISK_3: finished piece 1 at 06-OCT-22
piece handle=/ora_home/bkp/DB_TNT_6319jsk5_195 tag=TAG20221006T164908 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_2: finished piece 1 at 06-OCT-22
piece handle=/ora_home/bkp/DB_TNT_6219jsk4_194 tag=TAG20221006T164908 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:08
Finished backup at 06-OCT-22

Starting Control File and SPFILE Autobackup at 06-OCT-22
piece handle=+FRA/TNT/AUTOBACKUP/2022_10_06/s_1117385357.767.1117385359 comment=NONE
Finished Control File and SPFILE Autobackup at 06-OCT-22

So as we see we can SKIP file which are INACCESSIBLE to RMAN.