Monday, July 4, 2011

Changing Backup Policy on Standby DB - 3

Previous two posts were using non-RAC data guard configurations. This blog used a RAC-RAC data guard configuration.

1. Requirment is to change the backup retention policy.
RMAN>
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name RAC11G2S are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 04/07/2011 12:47:36
RMAN-05021: this configuration cannot be changed for a BACKUP or STANDBY control file
2. Change the backup retention policy on primary first
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2;

new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
new RMAN configuration parameters are successfully stored
3. Make a standby controlfile on the primary after this can revert back to the earlier backup policy on primary.
RMAN> backup current controlfile for standby format '/tmp/standby.ctl';

Starting backup at 04-JUL-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=43 instance=rac11g21 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including standby control file in backup set
channel ORA_DISK_1: starting piece 1 at 04-JUL-11
channel ORA_DISK_1: finished piece 1 at 04-JUL-11
piece handle=/tmp/standby.ctl tag=TAG20110623T123939 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 04-JUL-11

Starting Control File and SPFILE Autobackup at 04-JUL-11
piece handle=+FLASH/rac11g2/autobackup/2011_07_04/s_754576786.494.754576789 comment=NONE
Finished Control File and SPFILE Autobackup at 04-JUL-11
4. Move the newly created standby controlfile on primary server to standby server.

5. Stop log apply and redo transport
DGMGRL> show configuration verbose

Configuration - rac11g2_dgb

Protection Mode: MaxPerformance
Databases:
rac11g2 - Primary database
rac11g2s - Physical standby database

DGMGRL> edit database rac11g2s set state='APPLY-OFF';
DGMGRL> edit database rac11g2 set state='TRANSPORT-OFF';
6. Shutdown all instances in standby database RAC and start one instance in nomount mode
srvctl stop database -d rac11g2s

SQL> startup nomount
ORACLE instance started.
7. Restore the controlfiles using the newly created standby controlfiles
RMAN> restore standby controlfile from '/home/oracle/standby.ctl';

Starting restore at 04-JUL-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=143 instance=rac11g2s2 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output file name=+DATA/rac11g2s/controlfile/current.257.754586439
output file name=+FLASH/rac11g2s/controlfile/current.482.754586439
8. Mount the database and catalog the datafiles
RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> catalog start with '+DATA/rac11g2s/datafile';

Starting implicit crosscheck backup at 04-JUL-11
allocated channel: ORA_DISK_1
Crosschecked 8 objects
Finished implicit crosscheck backup at 04-JUL-11

Starting implicit crosscheck copy at 04-JUL-11
using channel ORA_DISK_1
Crosschecked 2 objects
Finished implicit crosscheck copy at 04-JUL-11

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +flash/RAC11G2S/AUTOBACKUP/2011_07_04/s_755582799.520.755612793
File Name: +flash/RAC11G2S/AUTOBACKUP/2011_07_01/s_755372829.380.755372831
File Name: +flash/RAC11G2S/AUTOBACKUP/2011_07_01/s_755369531.371.755373091
File Name: +flash/RAC11G2S/BACKUPSET/2011_07_04/annnf0_TAG20110704T122511_0.435.755612715
File Name: +flash/RAC11G2S/BACKUPSET/2011_07_04/nnndf0_TAG20110704T122546_0.424.755612747
File Name: +flash/RAC11G2S/BACKUPSET/2011_07_01/annnf0_TAG20110701T174611_0.414.755372773
File Name: +flash/RAC11G2S/BACKUPSET/2011_07_01/nnndf0_TAG20110701T174616_0.387.755372777
File Name: +flash/RAC11G2S/BACKUPSET/2011_07_01/annnf0_TAG20110701T174706_0.478.755372827
File Name: +flash/RAC11G2S/BACKUPSET/2011_07_01/ncnnf0_TAG20110701T175126_0.315.755373087
File Name: +flash/RAC11G2S/ARCHIVELOG/2011_07_04/thread_1_seq_769.427.755612261

searching for all files that match the pattern +DATA/rac11g2s/datafile

List of Files Unknown to the Database
=====================================
File Name: +data/RAC11G2S/DATAFILE/SYSAUX.259.754586467
File Name: +data/RAC11G2S/DATAFILE/SYSTEM.258.754586581
File Name: +data/RAC11G2S/DATAFILE/UNDOTBS3.262.754586657
File Name: +data/RAC11G2S/DATAFILE/UNDOTBS2.261.754586713
File Name: +data/RAC11G2S/DATAFILE/USERS.276.754586727

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +data/RAC11G2S/DATAFILE/SYSAUX.259.754586467
File Name: +data/RAC11G2S/DATAFILE/SYSTEM.258.754586581
File Name: +data/RAC11G2S/DATAFILE/UNDOTBS3.262.754586657
File Name: +data/RAC11G2S/DATAFILE/UNDOTBS2.261.754586713
File Name: +data/RAC11G2S/DATAFILE/USERS.276.754586727
9. Switch database to copy
RMAN> switch database to copy;

datafile 1 switched to datafile copy "+DATA/rac11g2s/datafile/system.258.754586581"
datafile 2 switched to datafile copy "+DATA/rac11g2s/datafile/sysaux.259.754586467"
datafile 4 switched to datafile copy "+DATA/rac11g2s/datafile/users.276.754586727"
datafile 5 switched to datafile copy "+DATA/rac11g2s/datafile/undotbs2.261.754586713"
datafile 6 switched to datafile copy "+DATA/rac11g2s/datafile/undotbs3.262.754586657"
10. Clear the log files
SQL> select group# from v$log;

GROUP#
----------
1
2
3
4

alter database clear logfile group 1;
alter database clear logfile group 2;
alter database clear logfile group 3;
alter database clear logfile group 4;
Generate the clearing SQL using and run the output
SQL> select 'alter database clear logfile group '||group#||';' from v$standby_log;
alter database clear logfile group 5;
alter database clear logfile group 6;
alter database clear logfile group 7;
alter database clear logfile group 8;
alter database clear logfile group 9;
alter database clear logfile group 10;
11. Shutdown the instance and start the RAC database
Database dismounted.
ORACLE instance shut down.

srvctl start database -d rac11g2s
12. Enable log apply and transport
dgmgrl sys/rac11g2db
Connected.

DGMGRL> edit database rac11g2s set STATE='APPLY-ON';
Succeeded.

DGMGRL> edit database rac11g2 SET STATE='TRANSPORT-ON';
Succeeded.
13. Verify log apply is working
SQL> select thread#,applied from v$archived_log;

THREAD# APPLIED
---------- ---------
1 YES
1 YES
1 IN-MEMORY
2 NO
2 YES
On primary do a log file archive
SQL> alter system archive log current;
and then on standby
THREAD# APPLIED
---------- ---------
1 YES
1 YES
1 YES
2 NO
2 YES
1 YES
2 YES
1 YES
2 IN-MEMORY
14. Verify that retention policy is changed
RMAN> show all

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name RAC11G2S are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
Once everything is confirmed to be working fine, remove the duplicate log files using asmcmd.

Changing Backup Policy on Standby DB - 2

The previous post is a mixture of steps on metalink notes [ID 734862.1] and [ID 459411.1]. This blog is based on [ID 734862.1] and the same data guard configuration used in the previous post is used here as well. Again the requirment is to change the backup retention policy.

On Primary

1. Change the backup retention policy on primary to the desired retention policy on standby
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 days;

old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
new RMAN configuration parameters are successfully stored
2. Create a new standby controlfile
RMAN> backup current controlfile for standby format '/tmp/standby.ctl';
copy the above file to standby server.

On standby

3. Stop the log apply and start the standby DB in nomount mode
SQL> alter database recover managed standby database cancel;

Database altered.

SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.

SQL> startup nomount
ORACLE instance started.
4. Restore the controlfile using the newly created standby controlfile
rman target /
RMAN> restore standby controlfile from '/home/oracle/standby.ctl';

Starting restore at 01-JUL-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1088 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/opt/app/oracle/oradata/STDAUX/controlfile/o1_mf_5q7xfq1o_.ctl
output file name=/opt/app/oracle/oradata/STDAUX/controlfile/o1_mf_5q7xfq2t_.ctl
Finished restore at 01-JUL-11
5. Mount the database
RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1
6. Catalog the datafiles
RMAN> catalog start with '/opt/app/oracle/oradata/STDAUX/datafile';

Starting implicit crosscheck backup at 01-JUL-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1070 device type=DISK
Finished implicit crosscheck backup at 01-JUL-11

Starting implicit crosscheck copy at 01-JUL-11
using channel ORA_DISK_1
Crosschecked 4 objects
Finished implicit crosscheck copy at 01-JUL-11

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /opt/app/oracle/flash_recovery_area/STDAUX/archivelog/2011_07_01/o1_mf_1_1822_70vb948l_.arc
File Name: /opt/app/oracle/flash_recovery_area/STDAUX/archivelog/2011_07_01/o1_mf_1_1817_70v8hn1w_.arc
File Name: /opt/app/oracle/flash_recovery_area/STDAUX/archivelog/2011_07_01/o1_mf_1_1820_70v994l1_.arc
File Name: /opt/app/oracle/flash_recovery_area/STDAUX/archivelog/2011_07_01/o1_mf_1_1816_70v7bz26_.arc
File Name: /opt/app/oracle/flash_recovery_area/STDAUX/archivelog/2011_07_01/o1_mf_1_1818_70v8vn7k_.arc
File Name: /opt/app/oracle/flash_recovery_area/STDAUX/archivelog/2011_07_01/o1_mf_1_1823_70vcb25c_.arc
File Name: /opt/app/oracle/flash_recovery_area/STDAUX/archivelog/2011_07_01/o1_mf_1_1815_70tj299j_.arc
File Name: /opt/app/oracle/flash_recovery_area/STDAUX/archivelog/2011_07_01/o1_mf_1_1819_70v93sg2_.arc
File Name: /opt/app/oracle/flash_recovery_area/STDAUX/archivelog/2011_07_01/o1_mf_1_1821_70v9rxmb_.arc
File Name: /opt/app/oracle/flash_recovery_area/STDAUX/archivelog/2011_07_01/o1_mf_1_1817_70v8wc4x_.arc
File Name: /opt/app/oracle/flash_recovery_area/STDAUX/archivelog/2011_07_01/o1_mf_1_1814_70t0vmyk_.arc
File Name: /opt/app/oracle/flash_recovery_area/STDAUX/archivelog/2011_06_30/o1_mf_1_1813_70scm1p0_.arc

searching for all files that match the pattern /opt/app/oracle/oradata/STDAUX/datafile

List of Files Unknown to the Database
=====================================
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_undotbs1_70sbx6n4_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbxlobs_70sbx6nb_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_test_70sbxko9_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_system_70sbx6nk_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbxindex_70sbx6n7_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_travelbo_70sbx6mx_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbx2ktbs_70sc6qw8_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_temp_70v7btqh_.tmp
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_users_70sbx6nq_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_sysaux_70sbx6nd_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_example_70sbx6ns_.dbf

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_undotbs1_70sbx6n4_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbxlobs_70sbx6nb_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_test_70sbxko9_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_system_70sbx6nk_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbxindex_70sbx6n7_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_travelbo_70sbx6mx_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbx2ktbs_70sc6qw8_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_temp_70v7btqh_.tmp
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_users_70sbx6nq_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_sysaux_70sbx6nd_.dbf
File Name: /opt/app/oracle/oradata/STDAUX/datafile/o1_mf_example_70sbx6ns_.dbf
7. Switch datafile to copy
RMAN> switch database to copy;

datafile 1 switched to datafile copy "/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_system_70sbx6nk_.dbf"
datafile 2 switched to datafile copy "/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_sysaux_70sbx6nd_.dbf"
datafile 3 switched to datafile copy "/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_undotbs1_70sbx6n4_.dbf"
datafile 4 switched to datafile copy "/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_users_70sbx6nq_.dbf"
datafile 5 switched to datafile copy "/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_example_70sbx6ns_.dbf"
datafile 6 switched to datafile copy "/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_travelbo_70sbx6mx_.dbf"
datafile 7 switched to datafile copy "/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbxindex_70sbx6n7_.dbf"
datafile 8 switched to datafile copy "/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbxlobs_70sbx6nb_.dbf"
datafile 9 switched to datafile copy "/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbx2ktbs_70sc6qw8_.dbf"
datafile 10 switched to datafile copy "/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_test_70sbxko9_.dbf"
8. Stop and start flashback if it was enabled
SQL>ALTER DATABASE FLASHBACK OFF;
SQL>ALTER DATABASE FLASHBACK ON;
9. Clear logfiles
SQL> select group# from v$log;

GROUP#
----------
1
2
6
4
5
3

6 rows selected.

alter database clear logfile group 1;
alter database clear logfile group 2;
alter database clear logfile group 6;
alter database clear logfile group 4;
alter database clear logfile group 5;
alter database clear logfile group 3;

SQL> select group# from v$standby_log;

GROUP#
----------
7
8
9
10
11

alter database clear logfile group 7;
alter database clear logfile group 8;
alter database clear logfile group 9;
alter database clear logfile group 10;
alter database clear logfile group 11;
10. Start log apply service
SQL> alter database recover managed standby database using current logfile disconnect;
and verify log apply with
SQL> select sequence#,applied from v$archived_log;
SEQUENCE# APPLIED
---------- ---------
1814 NO
1813 NO
1825 YES
1826 YES
1827 YES
1828 IN-MEMORY
11. Confirm that backup retention policy has changed
RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ENT11G1 are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
Once everything is confirm removed the duplicate standby logs and online logs from the disk using OS utility. Although metalink note states to do this step early on, having done this early one resulted in getting the following error
RMAN> switch database to copy;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of switch to copy command at 06/23/2011 14:01:05
RMAN-06571: datafile 1 does not have recoverable copy
It is possible the old logs may contain some information needed for recovery. So it's best to remove the duplicate log files at the end rather than early on.

Changing Backup Policy on Standby DB - 1

Once a standby database is created it is not possible to change the backup retention policy. If the space available on the standby site is less or due to some other constraint it may be required to change the backup retention policy from that of the primary DB. Trying to do so using the configure command would give the following error
MAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 days;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 07/01/2011 11:25:47
RMAN-05021: this configuration cannot be changed for a BACKUP or STANDBY control file
If possible the easiest way to change the retention policy is to do a switchover (making the standby the primary) and change the retention policy and switchover back to original primary. But this may not be possible at all times, especially if the data guard configuration is asymmetric and standby is used more for data protection than for disaster recovery.

What is required here is to change the retention policy in primary to that is desired on the standby, created a standby controlfile , revert the retention policy on primary, restore the newly created standby controlfile on standby DB which will have the modified retention policy.

There are two metalink notes that can help with this.

Steps to recreate a Physical Standby Controlfile [ID 459411.1]
Step By Step Guide On How To Recreate Standby Control File When Datafiles Are On ASM And Using Oracle Managed Files [ID 734862.1]

This blog will use steps listed in both these notes first on a single instance data guard configuration using file system for datafile storage (OMF) and another blog will follow with RAC data guard configuration using ASM.

On standby database

1. Requirement is to change the retention policy to recovery window of 2 days which cannot be done with the configure command and switchover to standby is not possible at this time
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 days;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 07/01/2011 11:25:47
RMAN-05021: this configuration cannot be changed for a BACKUP or STANDBY control file
2. Cancel log apply on standby and get the datafile name list and shutdown the standby database
SQL>alter database recover managed standby database cancel;

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_system_70sbx6nk_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_sysaux_70sbx6nd_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_undotbs1_70sbx6n4_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_users_70sbx6nq_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_example_70sbx6ns_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_travelbo_70sbx6mx_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbxindex_70sbx6n7_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbxlobs_70sbx6nb_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbx2ktbs_70sc6qw8_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_test_70sbxko9_.dbf

SQL>shutdown immediate;
On primary DB

3. Change the retention policy to what is required in standby
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 days;

old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
new RMAN configuration parameters are successfully stored
4. Create the new standby controlfile in primary db server and copy it to the standby db server
SQL> alter database create standby controlfile as '/home/oracle/standby.ctl';

Database altered.
5. Backup the current controlfile on standby using OS utility. (only valid if the database is shutdown clearnly).
mv o1_mf_5q7xfq1o_.ctl o1_mf_5q7xfq1o_.ctl.bak
mv o1_mf_5q7xfq2t_.ctl o1_mf_5q7xfq2t_.ctl.bak
Replace the current controlfiles on standby with the new standby controlfiles
cp /home/oracle/standby.ctl o1_mf_5q7xfq1o_.ctl
cp /home/oracle/standby.ctl o1_mf_5q7xfq2t_.ctl
6.Mount the standby database

7. Metalink note [ID 459411.1] says If the File-Structure is different between Primary and Standby Database and db_file_name_convert/log_file_name_convert is not set, rename the File-Location(s) in the new Standby Controlfile:

In this case above mention initialization parameters were set but since the standby was using OMF the datafile names are different from the primary hence the reason to query them in step 1. This could be observed by runnign following query on standby
SQL> select name from v$datafile;

NAME
----------------------------------------------------------------------
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_system_5q7x745y_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_sysaux_5q7x746p_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_undotbs1_5q7x746t_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_users_5q7x747g_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_example_5q7xg0kk_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_travelbo_5zb2lltr_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbxindex_5zb2lzvc_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbxlobs_5zb2mf60_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_tbx2ktbs_5zb2t0jn_.dbf
/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_test_70p7blqh_.dbf
These are the datafile names on primary and would not be same as standby datafile names.

8. Rename the datafile names to their original names
SQL> alter database rename file '/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_system_5q7x745y_.dbf' to '/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_system_70sbx6nk_.dbf';
alter database rename file '/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_system_5q7x745y_.dbf' to '/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_system_70sbx6nk_.dbf'
*
ERROR at line 1:
ORA-01511: error in renaming log/data files
ORA-01275: Operation RENAME is not allowed if standby file management is
automatic.
To overcome this problem change the standby file management to manual for the duration of the rename
SQL> alter system set standby_file_management='MANUAL' scope=memory;

System altered.

SQL> alter database rename file '/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_system_5q7x745y_.dbf' to '/opt/app/oracle/oradata/STDAUX/datafile/o1_mf_system_70sbx6nk_.dbf';

Database altered.
Rename all the files like this and change the standby file management to auto
SQL> alter system set standby_file_management='AUTO' SCOPE=MEMORY;

System altered.
9. Stop and start flashback if it was enabled
SQL>ALTER DATABASE FLASHBACK OFF;
SQL>ALTER DATABASE FLASHBACK ON;
10. If standby log files were not created on primary create them on standby now, if standby log exists on standby clear standby log as well online logs
SQL> select group# from v$log;

GROUP#
----------
1
2
6
4
5
3

6 rows selected.

SQL> alter database clear logfile group 1;

Database altered.
Do the same for other logs as well.
SQL> select group# from v$standby_log;

GROUP#
----------
7
8
9
10
11

SQL> alter database clear logfile group 7;

Database altered.
Do the same for other logs as well.

11. Start log apply on standby and verify log apply is working
SQL> alter database recover managed standby database using current logfile disconnect;

Database altered.


SQL> select sequence#,applied from v$archived_log;

SEQUENCE# APPLIED
---------- ---------
1820 IN-MEMORY
Do a log archive on primary
SQL> alter system archive log current;
and check on standby
SQL> select sequence#,applied from v$archived_log;

SEQUENCE# APPLIED
---------- ---------
1820 YES
1821 IN-MEMORY
12. Finally verify the backup retention on standby has changed to desired retention policy
RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ENT11G1 are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
If database uses OMF then when log apply is started new online logfiles and standby logfiles would have been created. To save space identify the currently used logfiles with
select group#,member from v$logfile;
and remove the logfiles that doesn't appear on the output from the disk. (This is the step 3 B on [ID 734862.1]
Depending on the location of the logfiles on the standby server remove all online and standby redo logs from the standby directories Using an Operating System utility or ASMCMD and make sure that you have the LOG_FILE_NAME_CONVERT parameter defined to translate any directory paths. )