Published by : Obay Salah , November 19, 2024

 To change roles between Primary Database and Standby Database, you can use Switchover to convert Primary Database to Standby Database and vice versa without losing any data with very little downtime as both Primary and Standby Database will be restarted if we are using Physical Standby Database, but if we are using Logical Standby Database we do not need that.

We need Switchover to maintain and develop Primary Database or for other reasons and not because of a problem in Primary Database.

We need to determine the Standby Database that will play the role of New Primary Database, but before performing the conversion process, the following must be taken into account:

1- Make sure that Primary and Standby Database are in Online mode.

2- All databases participating in the Configuration are working well and without any error messages.

3- Make sure that there is a Standby Redo Log in Primary Database, if necessary.

Here are the steps to implement the switchover:

1- Check the Primary Database

DGMGRL> SHOW DATABASE VERBOSE 'PRIM';


2- Make sure the Standby Database will become the new Primary Database.

DGMGRL> SHOW DATABASE VERBOSE 'STAN';


3- Run the switchover Command

DGMGRL> SWITCHOVER TO "STAN";
Performing switchover NOW. Please wait...
Operation requires shutdown of instance "PRIM" on database
"PRIM".
Shutting down instance "PRIM"...
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires shutdown of instance "STAN" on database
"STAN".
Shutting down instance "STAN"...
database not mounted
ORACLE instance shut down.
Operation requires startup of instance "PRIM" on database "PRIM".
Starting instance "PRIM"...
ORACLE instance started.
Database mounted.
Operation requires startup of instance "STAN" on database "STAN".
Starting instance "STAN"...
ORACLE instance started.
Database mounted.
Switchover succeeded. New primary is "STAN"

This command will switch roles so that PRIM will become the Standby Database and STAN will become the Primary Database. Of course, this command will be executed after connecting to the Primary Database. Note that the Data Guard Broker will automatically close and open the databases.


4- Ensure the conversion process

DGMGRL> SHOW CONFIGURATION;
Configuration
  Name:            TEST
  Enabled:         YES
  Protection Mode: MaxPerformance
  Databases:
PRIM - Physical standby database
 STAN    - Primary database
Current status for "TEST":
SUCCESS



Tags : Data Guard

You May Also Like

Comments

no comment yet!