Scenario 8: Failover to Target PDB
For situations where a planned role transition is not possible, a failover can be performed instead of a switchover. A failover is typically performed in an emergency situation where the source PDB has failed or is not accessible. During a failover, the specified target PDB is changed to the source role. If the the original source PDB is unavailable or inaccessible but the container database and other PDBs are all functioning correctly, the failover operation is very similar to the switchover operation in the sense that the original source PDB within the container is converted and marked as a physical standby. Recovery, however, is not started and the PDB must be reinstated as a target PDB before any redo from the new source PDB can be applied.
nyc_sales
to bos_sales
and then reinstate nyc_sales
as a
target PDB for bos_sales
:
DGMGRL> FAILOVER TO PLUGGABLE DATABASE bos_sales AT boston;
Verifying conditions for Failover...
Source pluggable database is 'NYC_SALES' at database 'newyork'
Performing failover NOW, please wait...
Closing pluggable database 'NYC_SALES'...
Converting 'NYC_SALES' to standby role...
Waiting for 'BOS_SALES' to recover all redo data...
Stopping recovery at 'BOS_SALES'...
Converting 'BOS_SALES' to primary role...
Opening new primary 'BOS_SALES'...
Waiting for redo data from new primary 'BOS_SALES'...
Failover succeeded, new primary is "BOS_SALES"
After
the failover completes, recovery is not started on the failed (original source) PDB.
This is true even if the container database is restarted or if the ENABLE
DATABASE
command is issued at the container database level. The
original source PDB is converted from the primary role to the physical standby role
and recovery can only be restarted after it has been reinstated as a target standby
for the new source PDB. To verify that the failover was successful and confirm the
expected states for each PDB, issue the following commands:
DGMGRL> SHOW PLUGGABLE DATABASE bos_sales AT boston;
Pluggable database - bos_sales at boston
Data Guard Role: Primary
Con_ID: 3
Active Target: con_id 3 at newyork needs to be reinstated
Pluggable Database Status:
DGM-17450: not protected
DGMGRL> SHOW PLUGGABLE DATABASE nyc_sales AT newyork;
Pluggable database - NYC_SALES at newyork
Data Guard Role: Physical Standby
Con_ID: 3
Source: (unknown)
Pluggable Database Status:
ORA-16661: The standby database must be reinstated.
After
any issues with the former source (primary) PDB have been resolved, start recovery
on that PDB to reinstate it in the target role to provide protection for the new
source PDB: DGMGRL> EDIT PLUGGABLE DATABASE nyc_sales AT newyork SET STATE=APPLY-ON;
Succeeded.
Note:
For more information on removing a PDB refer to: Removing a PDB