Scenario 11: Reinstating a Failed Primary Database

If your former primary database was configured with Flashback Database, you can easily reinstate the failed primary database as a standby database of the new primary database.

The failed primary database will be reinstated as a standby type that matches the old standby database. For example, if you failed over to a physical standby database, the old primary will be reinstated as a physical standby database.

To reinstate the failed primary database, start it to the mounted state. Then run DGMGRL, connect to the new primary database and reinstate the old primary database.

  1. Restart the old primary database:
    % dgmgrl / as sysdba
    DGMGRL for Linux: Release 23.0.0.0.0 – Production on Tue Dec 20 00:50:10 2022
    Version 23.1.0.0.0
    
    Copyright (c) 1982, 2022, Oracle and/or its affiliates.  All rights reserved.
    
    Welcome to DGMGRL, type "help" for information.
    Connected to an idle instance.
    Connected as SYSDBA.
    DGMGRL> STARTUP
    Connected to "North_Sales"
    ORACLE instance started.
    Database mounted.
    ORA-16649: Data Guard prevented this database from opening.
    https://docs.oracle.com/error-help/db/ora-16649/
    
    DGMGRL> SHOW CONFIGURATION
    
    Configuration - DRSolution
    
      Protection Mode: MaxAvailability
      Members:
      North_Sales - Primary database
        South_Sales - Physical standby database 
    
    Fast-Start Failover:  Disabled
    
    Configuration Status:
    DISABLED
    DGM-17290: Role change detected. This database may no longer be the primary database.
    

    Note:

    Because a role transition occurred while the old primary was offline, Data Guard prevents the database from reopening and leaves it in a mounted state to ensure there is only one database open in the primary role.
  2. Reinstating the old primary database as a standby database requires a connection to the new primary database:
    DGMGRL> CONNECT sys@south_sales
    Password: password
    Connected to "South_Sales"
    Connected as SYSDBA.
    DGMGRL> REINSTATE DATABASE 'North_Sales';
    2022-12-20T01:06:56.636+00:00
    Reinstating database "North_Sales", please wait...
    
    2022-12-20T01:07:25.747+00:00
    Reinstatement of database "North_Sales" succeeded
    
    2022-12-20T01:07:25.747+00:00
    Reinstate processing complete, broker ready.
    

    After the primary has been reinstated, issue the SHOW CONFIGURATION and SHOW DATABASE commands to confirm that the old primary has been successfully reinstated.

  3. Show the configuration and its members:
    DGMGRL> SHOW CONFIGURATION;
    
    Configuration - DRSolution
    
      Protection Mode: MaxAvailability
      Members:
      South_Sales - Primary database
        North_Sales - Physical standby database 
    
    Fast-Start Failover:  Disabled
    
    Configuration Status:
    SUCCESS   (status updated 22 seconds ago)
    
    DGMGRL> SHOW DATABASE 'South_Sales';
    
    Database - South_Sales
    
      Role:                PRIMARY
      Intended State:      TRANSPORT-ON
      Redo Rate:           146 Byte/s  in 15 seconds (computed 9 seconds ago) 
      Instance(s):
        SouthSales
    
    Database Status:
    SUCCESS
    
    DGMGRL> SHOW DATABASE 'North_Sales';
    
    Database - North_Sales
    
      Role:                PHYSICAL STANDBY
      Intended State:      APPLY-ON
      Transport Lag:       0 seconds (computed 1 second ago)
      Apply Lag:           0 seconds (computed 1 second ago)
      Average Apply Rate:  435.00 KByte/s
      Real Time Query:     OFF
      Instance(s):
        NorthSales
    
    Database Status:
    SUCCESS