You can switch the role of the primary database and a standby database using the SWITCHOVER command. Before you issue the SWITCHOVER command, you must ensure:
- The state of the primary and standby databases are TRANSPORT-ON and APPLY-ON, respectively.
- All participating databases are in good health, without any errors or warnings present.
- The standby database properties were set on the primary database, so that the primary database can function correctly when transitioning to a standby database (shown in the following examples in boldface type).
- Standby redo log files on the primary database are set up, and the LogXptMode configurable database property is set to SYNC if the configuration is operating in either maximum availability mode or maximum protection mode.
- If fast-start failover is enabled, you can perform a switchover only to the standby database that was specified as the target standby database.
Step 1 Check the primary database.
Use the SHOW DATABASE VERBOSE command to check the state, health, and properties of the primary database, as follows:
DGMGRL> SHOW DATABASE VERBOSE ‘North_Sales’;
Database
Name: North_Sales
Role: PRIMARY
Enabled: YES
IntendedState: TRANSPORT-ON
Instance(s):
sales1
Properties:
DGConnectIdentifier = ‘North_Sales.foo.com’
ObserverConnectIdentifier = ”
LogXptMode = ‘SYNC’
DelayMins = ‘0’
Binding = ‘OPTIONAL’
MaxFailure = ‘0’
MaxConnections = ‘1’
ReopenSecs = ‘300’
NetTimeout = ’30’
RedoCompression = ‘DISABLE’
LogShipping = ‘ON’
PreferredApplyInstance = ”
ApplyInstanceTimeout = ‘0’
ApplyParallel = ‘AUTO’
StandbyFileManagement = ‘AUTO’
ArchiveLagTarget = ‘0’
LogArchiveMaxProcesses = ‘5’
LogArchiveMinSucceedDest = ‘1’
DbFileNameConvert = ‘dbs/bt, dbs/t’
LogFileNameConvert = ‘dbs/bt, dbs/t’
FastStartFailoverTarget = ‘DR_Sales’
StatusReport = ‘(monitor)’
InconsistentProperties = ‘(monitor)’
InconsistentLogXptProps = ‘(monitor)’
SendQEntries = ‘(monitor)’
LogXptStatus = ‘(monitor)’
RecvQEntries = ‘(monitor)’
HostName = ‘North_Sales.foo.com’
SidName = ‘sales1’
StandbyArchiveLocation = ‘/archfs/arch/’
AlternateLocation = ”
LogArchiveTrace = ‘8191’
LogArchiveFormat = ‘db1r_%d_%t_%s_%r.arc’
LatestLog = ‘(monitor)’
TopWaitEvents = ‘(monitor)’
Current status for “North_Sales”:
SUCCESS
In particular, you should examine the boldface properties and the current status of the primary database. See Chapter 4 for information about managing databases.
Step 2 Check the standby database that is the target of the switchover.
Use the SHOW DATABASE VERBOSE command to check the state, health, and properties of the standby database that is the target of the switchover. For example:
DGMGRL> SHOW DATABASE VERBOSE ‘DR_Sales’;
Database
Name: DR_Sales
Role: PHYSICAL STANDBY
Enabled: NO
IntendedState: APPLY-ON
Instance(s):
dr_sales1
Properties:
DGConnectIdentifier = ‘DR_Sales.foo.com’
ObserverConnectIdentifier = ”
LogXptMode = ‘SYNC’
DelayMins = ‘0’
Binding = ‘OPTIONAL’
MaxFailure = ‘0’
MaxConnections = ‘1’
ReopenSecs = ‘300’
NetTimeout = ’30’
RedoCompression = ‘DISABLE’
LogShipping = ‘ON’
PreferredApplyInstance = ”
ApplyInstanceTimeout = ‘0’
ApplyParallel = ‘AUTO’
StandbyFileManagement = ‘AUTO’
ArchiveLagTarget = ‘0’
LogArchiveMaxProcesses = ‘5’
LogArchiveMinSucceedDest = ‘1’
DbFileNameConvert = ‘dbs/t, dbs/bt’
LogFileNameConvert = ‘dbs/t, dbs/bt’
FastStartFailoverTarget = ”
StatusReport = ‘(monitor)’
InconsistentProperties = ‘(monitor)’
InconsistentLogXptProps = ‘(monitor)’
SendQEntries = ‘(monitor)’
LogXptStatus = ‘(monitor)’
RecvQEntries = ‘(monitor)’
HostName = ‘dr_sales.foo.com’
SidName = ‘dr_sales1’
StandbyArchiveLocation = ‘/archfs/arch’
AlternateLocation = ”
LogArchiveTrace = ‘8191’
LogArchiveFormat = ‘db2r_%d_%t_%s_%r.arc’
LatestLog = ‘(monitor)’
TopWaitEvents = ‘(monitor)’
Current status for “DR_Sales”:
SUCCESS
In particular, you should examine the current status of the database.
Step 3 Issue the switchover command.
Issue the SWITCHOVER command to swap the roles of the primary and standby databases. The following example shows how the broker automatically shuts down and restarts the old primary database as a part of the switchover. (See the usage notes in Section 8.1.3 for information about how to set up the broker environment so that DGMGRL can automatically restart the primary and standby databases for you.)
DGMGRL> switchover to ‘DR_Sales’;
Performing switchover NOW, please wait…
New primary database “DR_Sales” is opening…
Operation requires shutdown of instance “sales1” on database “North_Sales”
Shutting down instance “sales1″…
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance “sales1” on database “North_Sales”
Starting instance “sales1″…
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is “DR_Sales”
After the switchover completes, use the SHOW CONFIGURATION and SHOW DATABASE commands to verify that the switchover operation was successful.
Step 4 Show the configuration.
Issue the SHOW CONFIGURATION command to verify that the switchover was successful.
DGMGRL> SHOW CONFIGURATION;
Configuration
Name: DRSolution
Enabled: YES
Protection Mode: MaxAvailability
Databases:
DR_Sales – Primary database
North_Sales – Physical standby database
– Fast-Start Failover target
Fast-Start Failover: ENABLED
Current status for “DRSolution”:
SUCCESS