Thursday, December 28, 2017

How to Drop/Recreate Standby Redolog file in Oracle 11g

Below are the steps to drop/recreate the redolog file from standby database :


On Standby Database :


Errors in file /u01/app/oracle/diag/rdbms/mydb/mydb/trace/mydb_arc1_xxxxx.trc:
ORA-00314: log 4 of thread 1, expected sequence# 93874 doesn't match 93786
ORA-00312: online log 4 thread 1: '/u01/data/mydb/redo04_stanby.log'

Error during check standby redolog


SQL> select GROUP#,BYTES/1024/1024, STATUS, FIRST_TIME,NEXT_TIME from v$standby_log;
ERROR:
ORA-00310: archived log contains sequence 93786; sequence 93874 required
ORA-00334: archived log: '/u01/data/mydb/redo04_stanby.log'


Here,we have to drop the 1 standby redolog file .


SQL> alter database drop standby logfile group 4;
alter database drop standby logfile group 4
*
ERROR at line 1:
ORA-01156: recovery or flashback in progress may need access to files

Now to solve this issue we have cancel the managed recovery session and set  "standby_file_management"  to manual and drop the standby redolog file  as

SQL> alter database recover managed standby database cancel ;
Database altered.

SQL> alter system set standby_file_management='MANUAL' ;
System altered.

If the status of standby redolog show the "clearing_current" then we cannot drop "clearing_current" status logs,and for that we have to sync with Primary and clear the log first before dropping as

SQL> alter database clear logfile group 4;
Database altered.

SQL> alter database drop standby logfile group 4;
Database altered.

Recreate standby redolog by using old redolog file.


SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ('/u01/data/mydb/redo04_stanby.log') SIZE 50M reuse;
System altered.

Once the standby redologs are dropped and recreated then again back to recover the standby.


SQL> select GROUP#,BYTES/1024/1024 , STATUS, FIRST_TIME,NEXT_TIME from v$standby_log;

    GROUP# BYTES/1024/1024    STATUS     FIRST_TIME  NEXT_TIME
---------- -------------------- ---------- ----------- -----------
         4                    50 UNASSIGNED
         5                    50 UNASSIGNED
         6                    50 UNASSIGNED

3 rows selected.

SQL> alter system set standby_file_management='AUTO' ;
System altered.

SQL> alter database recover managed standby database disconnect from session ;
Database altered.

No comments:

Post a Comment