2018-01-19

Correcting Oracle DB Errors: ORA-01153, ORA-16136, ORA-16766, ORA-16826, ORA-38706, ORA-38788

After having re-build the standby DB, I've got the following error trying to enable the flashback:
SQL> 
alter database flashback on;

alter database flashback on
*
ERROR at line 1:
ORA-38706: Cannot turn on FLASHBACK DATABASE logging.
ORA-38788: More standby database recovery is needed

In order to solve the problem, I tried to start the recovery . . .
SQL> 
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
ORA-16136: Managed Standby Recovery not active

. . . the error from above, reminded my that I forgot to start the DataGuard Broker on the primary DB. So I did it:
SQL> alter system set dg_broker_start=true;

This was not enough.
On the Data Guard Manager console, I've remarked the following error for the standby DB
. . .
DGMGRL> show configuration verbose;
. . .
        Error: ORA-16766: Redo Apply is stopped

Since I remembered, that I once solved this error by making sure that the physical standby DB really starts on MOUNT mode, I've checked it an restarted the standby DB:
OS>
srvctl modify database -d <MyPhysicalStandbyDbUniqueName> -r PHYSICAL_STANDBY -s mount

srvctl stop database -d <MyPhysicalStandbyDbUniqueName>

srvctl start database -d <MyPhysicalStandbyDbUniqueName>

And checked its configuration
OS>
srvctl config database -d <MyPhysicalStandbyDbUniqueName>

But when re-trying to start the recovery I've got another error:
SQL>
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT
*
ERROR at line 1:
ORA-01153: an incompatible media recovery is active

This was caused by the running recovery process (MRP0) . . .
SQL> 
select PROCESS,CLIENT_PROCESS,THREAD#,SEQUENCE#,BLOCK# from v$managed_standby where process = 'MRP0' or client_process='LGWR';

PROCESS CLIENT_P THREAD# SEQUENCE# BLOCK#
--------- -------- ---------- ---------- ----------
RFS LGWR 1 1551 125
MRP0 N/A 1 1551 125

. . . that I've stopped:
SQL>
alter database recover managed standby database cancel;

Database altered.

Check:
SQL>
select PROCESS,CLIENT_PROCESS,THREAD#,SEQUENCE#,BLOCK# from v$managed_standby where process = 'MRP0' or client_process='LGWR';

PROCESS CLIENT_P THREAD# SEQUENCE# BLOCK#
--------- -------- ---------- ---------- ----------
RFS LGWR 1 1551 125

Not I've re-tryied to enable the flash back again => with success
SQL>
alter database flashback on;

Database altered.

But the Data Guard Manager console shows that the redo apply is still stopped
DGMGRL>
show configuration verbose;
. . .
      Error: ORA-16766: Redo Apply is stopped

So, I re-tried to start it again:
SQL>
alter database recover managed standby database disconnect from session;

Database altered.

But the DataGuard Manager console shows that 
DGMGRL>
show configuration verbose;
. . .
      Warning: ORA-16826: apply service state is inconsistent with the DelayMins property

Ops, I used the wrong option when re-trying to start the recovery (I did not start it on the "MANAGED REAL TIME APPLY" mode).
Verify this with this query on the PRIMARY SITE:
SQL>
SET LINES 200
column DEST_NAME format A20;
column RECOVERY_MODE format A30;
select DEST_ID, DEST_NAME, RECOVERY_MODE FROM V$ARCHIVE_DEST_STATUS;

Output example:
   DEST_ID DEST_NAME            RECOVERY_MODE
---------- -------------------- --------------------
         1 LOG_ARCHIVE_DEST_1   IDLE
         2 LOG_ARCHIVE_DEST_2   MANAGED
         3 LOG_ARCHIVE_DEST_3   IDLE
. . .
It is only MANAGER, not 

After stopping the recovery again and restarting it "with REAL TIME APPLY"
SQL>
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE cancel;

Database altered.


SQL>
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE disconnect;

Database altered.

The recovery is now on "REAL TIME APPLY" mode:
SQL>
SET LINES 200
column DEST_NAME format A20;
column RECOVERY_MODE format A30;
select DEST_ID, DEST_NAME, RECOVERY_MODE FROM V$ARCHIVE_DEST_STATUS;

   DEST_ID DEST_NAME            RECOVERY_MODE
---------- -------------------- ------------------------------
         1 LOG_ARCHIVE_DEST_1   IDLE
         2 LOG_ARCHIVE_DEST_2   MANAGED REAL TIME APPLY
         3 LOG_ARCHIVE_DEST_3   IDLE
         4 LOG_ARCHIVE_DEST_4   IDLE
. . .

And the DataGuard Manager console shows that all is OK:
DGMGRL> show configuration verbose;

Configuration Status:
SUCCESS


No comments :

Post a Comment