Configuration Generator for Oracle Maximum Availability Architectures

Data Guard Role Transitions

This page describes Data Guard role transitions. The following is applicable to both MAAGEN and non-MAAGEN configurations.

A role transition occurs when a new database in the configuration becomes the primary. There can only be one primary database in a configuration.

The following operations are described on this page:

This page documents how to perform the above operations using the Data Guard Broker. In Oracle 11.1 and above the Broker is considered to be the most reliable and efficient role transistion tool.

Currently MAAGEN scripts are not generated for the SWITCHOVER / FAILOVER / REINSTATE operations. This is partly to allow manual checking before committing to the role transition and partly to avoid a role transition being accidently initiately by accidentally executing a script.

The examples on this page are based on the following:

Switchover

In a switchover operation the current primary location becomes a standby location and a current standby location then becomes the primary location. There is a short period (seconds) during which both databases are standbys and there is no primary.

Prior to the switchover, check the configuration:

[oracle@bristol1]$ dgmrgl /
DGMGRL> SHOW CONFIGURATION

Configuration - DGPROD

  Protection Mode: MaxAvailability  
  Databases:        
    PRODBRIS - Primary database
    PRODCARD - Physical standby database 

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

The switchover operation should be initiated from the current primary cluster. In this example, the current primary PRODBRIS will become the new standby and the current standby PRODCARD will become the new primary.

The switchover operation should be performed using DGMGRL logged in as the SYS user. For example assuming that the switchover operation is from PRODBRIS to PRODCARD:

[oracle@bristol1]$ dgmrgl 
DGMGRL CONNECT SYS/<password>

The switchover operation is initiated specifying the target standby database. For example:

DGMGRL> SWITCHOVER TO 'PRODCARD';

Performing switchover NOW, please wait...
New primary database "PRODCARD" is opening...

Operation requires shutdown of instance "PROD1" on database "PRODBRIS"
Shutting down instance "PROD1"...
ORACLE instance shut down.

Operation requires startup of instance "PROD1" on database "PRODBRIS"
Starting instance "PROD1"...
ORACLE instance started.
Database mounted.

Switchover succeeded, new primary is "PRODCARD"

Note that the SWITCHOVER command specifies the DB_UNIQUE_NAME of the target standby database. Note also that the database name should be enclosed with single quotes.

Following the switchover, check the configuration:

[oracle@cardiff1]$ dgmrgl /

DGMGRL> SHOW CONFIGURATION

Configuration - DGPROD

  Protection Mode: MaxAvailability  
  Databases:        
    PRODCARD - Primary database
    PRODBRIS - Physical standby database 

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

Switchback

In a symmetrical configuration, a switchback operation is identical to a switchover operation. The primary role returns to the original primary location and the standby role returns to the original standby location. In a asymmetric configuration many users prefer to differentiate between the two operations as different steps are required to complete each task.

Prior to the switchback, check the configuration:

[oracle@cardiff1]$ dgmrgl /

DGMGRL> SHOW CONFIGURATION

Configuration - DGPROD

  Protection Mode: MaxAvailability  
  Databases:        
    PRODCARD - Primary database
    PRODBRIS - Physical standby database 

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

The switchback operation should be initiated from the current primary cluster. In this example the current primary PRODCARD will become the new standby and the current standby PRODBRIS will become the new primary.

The switchover operation should be performed using DGMGRL logged in as the SYS user. For example assuming that the switchover operation is from PRODCARD to PRODBRIS:

[oracle@cardiff1]$ dgmrgl 
DGMGRL CONNECT SYS/<password>

The switchover operation is initiated specifying the target standby database. For example:

DGMGRL> SWITCHOVER TO 'PRODBRIS';

Performing switchover NOW, please wait...
New primary database "PRODBRIS" is opening...

Operation requires shutdown of instance "PROD1" on database "PRODCARD"
Shutting down instance "PROD1"...
ORACLE instance shut down.

Operation requires startup of instance "PROD1" on database "PRODCARD"
Starting instance "PROD1"...
ORACLE instance started.
Database mounted.

Switchover succeeded, new primary is "PRODBRIS"

Note that the SWITCHOVER command specifies the DB_UNIQUE_NAME of the target standby database. Note also that the database name should be enclosed with single quotes.

Following the switch back, check the configuration:

[oracle@bristol1]$ dgmrgl /
DGMGRL> SHOW CONFIGURATION

Configuration - DGPROD

  Protection Mode: MaxAvailability  
  Databases:        
    PRODBRIS - Primary database
    PRODCARD - Physical standby database 

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

Failover

In a failover operation, the original primary location becomes unavailable and a standby database is promoted to the new primary.

Following a failover operation, if flashback logging is enabled, it is possible to reinstate the standby database using flashback logs. If flashback logging is not enabled then it will be necessary to recreate a new standby database using RMAN DUPLICATE, RMAN backups or storage-level backups.

Prior to the failover, check the configuration:

[oracle@bristol1]$ dgmrgl /
DGMGRL> SHOW CONFIGURATION

Configuration - DGPROD

  Protection Mode: MaxAvailability  
  Databases:        
    PRODBRIS - Primary database
    PRODCARD - Physical standby database 

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

On any node in the primary cluster, abort the primary database to simulate a failover. For example:

[oracle@bristol1]$ srvctl stop database -d PRODBRIS -o abort

Note that most failures involve a partial lose of components in which case a RAC database may survive without the need to switch over.

The failback operation should be initiated from the current standby cluster. It cannot be initiated on the failed primary.

The failover operation should be performed using DGMGRL logged in as the SYS user. For example assuming that PRODBRIS has failed:

[oracle@cardiff1]$ dgmrgl 
DGMGRL CONNECT SYS/<password>

The failover operation is initiated specifying the target standby database. For example:

DGMGRL> FAILOVER TO 'PRODCARD' IMMEDIATE;
Performing failover NOW, please wait...
Failover succeeeded, new primary is 'PRODCARD"

Note that the SWITCHOVER command specifies the DB_UNIQUE_NAME of the target standby database. Note also that the database name should be enclosed with single quotes.

To avoid ORA-16660 "not connected to target standby database for failover" connect explicitly to the standby database before issuing the FAILOVER command.

Following the failover, the SHOW CONFIGURATION command on the new primary cluster will probably show errors. For example:

DGMGRL> SHOW CONFIGURATION

Configuration - DGPROD

    Protection Mode: MaxAvailability 
    Databases:       
      PRODCARD - Primary database
        Warning: ORA-16629: database reports a different protection level from the protection mode        
      PRODBRIS  - Physical standby database (disabled)         
        ORA-16661: the standby database needs to be reinstated

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

Reinstatement

Following a failover operation, the SHOW CONFIGURATION command on the new primary cluster will probably show errors. For example:

DGMGRL> SHOW CONFIGURATION

Configuration - DGPROD

    Protection Mode: MaxAvailability 
    Databases:       
      PRODCARD - Primary database
        Warning: ORA-16629: database reports a different protection level from the protection mode        
      PRODBRIS  - Physical standby database (disabled)         
        ORA-16661: the standby database needs to be reinstated

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

If flashback logging was enabled then the original primary may be reinstated as a standby database by the Data Guard Broker.

If the original primary was failed using srvctl stop database -o abort then it may be necessary to mount the database again manually before using DGMGRL to initiate reinstatement.

The reinstatement operation should be performed using DGMGRL logged in as the SYS user. For example assuming that PRODBRIS has failed:

[oracle@bristol1]$ dgmrgl 
DGMGRL CONNECT SYS/<password>

The reinstatement operation is initiated specifying the target standby database. For example to reinstate the PRODBRIS database:

DGMGRL> REINSTATE DATABASE 'PRODBRIS';

Reinstating database "PRODBRIS", please wait...
Operation requires shutdown of instance "PROD1" on database "PRODBRIS"
Database closed
Database dismounted
ORACLE instance shut down

Operation requires startup of instance "PROD1" on database "PRODBRIS"
ORACLE instance started
Database mounted
Continuing to reinstate database "PRODBRIS"

Operation requires shutdown of instance "PROD1" on database "PRODBRIS"
ORA-01109: database not open
Database dismounted

Operation requires startup of instance "PROD1" on database "PRODBRIS"
ORACLE instance started
Database mounted

Continuing to reinstate database "PRODBRIS"
Reinstatement of database "PRODBRIS" succeeded

Note that the SWITCHOVER command specifies the DB_UNIQUE_NAME of the target standby database. Note also that the database name should be enclosed with single quotes.

Following the reinstatement check the configuration again:

DGMGRL> SHOW CONFIGURATION

Configuration - DGPROD

    Protection Mode: MaxAvailability 
    Databases: 
      PRODCARD - Primary database
      PRODBRIS - Physical standby database 

Fast-Start Failover: DISABLED

Configuration Status: 
SUCCESS