Friday, August 9, 2013

ORA-16795: the standby database needs to be re-created


DB CONFIGURATION
2 node primary database
2 node standby database
Fast_Start FailOver(observer)- Enabled

BHU_A è Primary database
BHU_B è standby database

n  Due to the network issues, FSFO failover the standby database (BHU_B) as a new primary and old primary database (BHU_A) is in the mount stage.


oracle BHU bhuora001> dgmgrl
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys /xxxxxxxxxxxxxx
Connected.

DGMGRL> show configuration

Configuration - DG_BHU

  Protection Mode: MaxAvailability
  Databases:
    BHU_B - Primary database
      Warning: ORA-16817: unsynchronized fast-start failover configuration

    BHU_A - (*) Physical standby database (disabled)
      ORA-16795: the standby database needs to be re-created

Fast-Start Failover: ENABLED

Configuration Status:
WARNING


n  We check the flashback enabled option on both old & new primary. We are showing the output of new primary database

SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
YES


n  On the NEW PRIMARY SITE; check when the conversion happened(standby to primary) and you can see the time by looking to scn_to_timestamp conversion.

SQL> SELECT TO_CHAR(STANDBY_BECAME_PRIMARY_SCN) FROM V$DATABASE;

TO_CHAR(STANDBY_BECAME_PRIMARY_SCN)
----------------------------------------
12788498729592

SQL> SELECT SCN_TO_TIMESTAMP(12788498729592) from dual;

SCN_TO_TIMESTAMP(12788498729592)
---------------------------------------------------------------------------
08-AUG-13 22.04.00.000000000



On the OLD PRIMARY DATABASE(BHU_A). Check the status of database


SQL> select name,open_mode,database_role from gv$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
BHU    MOUNTED              PRIMARY


SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
YES

n When we try to check  CURRENT_SCN number on the old primary and it has displayed as “0”

SQL> select current_scn from v$database;

CURRENT_SCN
-----------
          0

Now, We are converting the old primary database as a NEW STANDBY DATABASE

n  We are mounting the database first

SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.

SQL> startup mount;
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area 2271580160 bytes
Fixed Size                  2230352 bytes
Variable Size            1191184304 bytes
Database Buffers         1073741824 bytes
Redo Buffers                4423680 bytes
Database mounted.

n  We have identified the failover time from the new database. so we will use that time to flashback the old primary database; we have add 20 further to actual time.

SQL> FLASHBACK DATABASE TO TIMESTAMP to_timestamp('2013-08-08 21:50:00', 'YYYY-MM-DD HH24:MI:SS');

Flashback complete.

n  We are checking the current role before converting the old primary to new standby database.

SQL> select name,open_mode,database_role from v$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
BHU    MOUNTED              PRIMARY

n  Converting database to standby database.

SQL> ALTER DATABASE CONVERT TO PHYSICAL STANDBY;

Database altered.

n  We are checking the current role after converting the old primary to new standby database.

SQL> select name,open_mode,database_role from v$database;
select name,open_mode,database_role from v$database
                                         *
ERROR at line 1:
ORA-01507: database not mounted


n  After converting the database; database will go to nomount stage; so we have to stop & start the database.

SQL> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> startup mount;
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area 2271580160 bytes
Fixed Size                  2230352 bytes
Variable Size            1191184304 bytes
Database Buffers         1073741824 bytes
Redo Buffers                4423680 bytes
Database mounted.

SQL> select name,open_mode,database_role from v$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
BHU    MOUNTED              PHYSICAL STANDBY


n  We could see the current status of the old primary as new standby database.
n  Now we are login to the dg broker to enable the new standby database

DGMGRL> enable database 'BHU_A';
Enabled.

n  Once enabled, oracle will take some time to apply the logs till the current time


DGMGRL> show configuration;

Configuration - DG_BHU

  Protection Mode: MaxAvailability
  Databases:
    BHU_B - Primary database
      Warning: ORA-16817: unsynchronized fast-start failover configuration

    BHU_A - (*) Physical standby database
      Warning: ORA-16817: unsynchronized fast-start failover configuration

Fast-Start Failover: ENABLED

Configuration Status:
WARNING

n  Now primary database & standby database are in sync.

DGMGRL> show configuration;

Configuration - DG_BHU

  Protection Mode: MaxAvailability
  Databases:
    BHU_B - Primary database
    BHU_A - (*) Physical standby database

Fast-Start Failover: ENABLED

Configuration Status:
SUCCESS






2 comments:

  1. Very nice document. I followed the exact same procedure except FLASHBACK DATABASE TO SCN, instead of time.

    Thanks!

    ReplyDelete