Oracle Error RMAN-05021: this configuration cannot be changed for a BACKUP or STANDBY control file

Oracle Error Message

RMAN-05021: this configuration cannot be changed for a BACKUP or STANDBY control file

Reason for the Error

The user attempted to modify the configuration which cannot be changed for a BACKUP or STANDBY control file while the mounted control file was either BACKUP or STANDBY. The following configurations can be changed only when connected to primary database instance that has CURRENT/CREATED control file type mounted: CONFIGURE RETENTION POLICY CONFIGURE EXCLUDE CONFIGURE ENCRYPTION CONFIGURE DB_UNIQUE_NAME

Solution

Connect to primary database instance and execute the command.