Performing PDB Switchover
A PDB switchover is a role reversal between the source PDB and its designated target PDB. Use DGMGRL commands to perform a PDB switchover.
How Broker Performs Switchover in a DG PDB Environment
The broker performs the following actions when you start a switchover:
-
Verifies that the specified target database is reachable, the target PDB exists, and the target PDB is a designated DG PDB.
-
Validates that the source PDB and target PDB are in the correct states. The source PDB must be open in read/write mode and the target PDB must be in recovery mode.
-
Confirms that the target PDB is recovering the current redo stream of the source PDB.
-
Closes the source PDB on all instances.
-
Converts the source PDB to the standby role. After the switchover completes, the source PDB will become the target PDB.
-
Converts the target PDB to the primary role, after the target PDB has recovered through the all the redo generated by the source PDB and recovery is canceled.
-
Opens the target PDB as the new source PDB.
-
Starts recovery after redo from the target PDB is registered at the original source PDB.
Starting a Switchover to a PDB
When a switchover is started, the source PDB and target PDB must have as small a redo lag as possible.
To start a PDB switchover:
-
Run the
SWITCHOVER PLUGGABLE DATABASEcommand. Specify the name of the PDB that must now perform the primary role.
The broker controls the rest of the PDB switchover.
Example 7-1 Performing a PDB Switchover
In this example, a switchover is performed between the
bos_sales and nyc_sales PDBs. After the
switchover operation completes, the target PDB nyc_sales in the
target database newyork transitions to the primary role and becomes
the new source PDB.
DGMGRL> SWITCHOVER TO PLUGGABLE DATABASE nyc_sales AT newyork;
Verifying conditions for Switchover...
Source pluggable database is 'BOS_SALES' at database 'boston'
Performing switchover NOW, please wait...
Closing pluggable database 'BOS_SALES'...
Switching 'BOS_SALES' to standby role...
Waiting for 'NYC_SALES' to recover all redo data...
Stopping recovery at 'NYC_SALES'...
Converting 'NYC_SALES' to primary role...
Opening new primary 'NYC_SALES'...
Waiting for redo data from new primary 'NYC_SALES'...
Starting recovery at new standby 'BOS_SALES'...
Switchover succeeded, new primary is "NYC_SALES"