Oracle 12c-Performing Dataguard Switchover Using DGMGRL UtilityDescription:-
- We are going to switch the role of the primary database and a standby database using the SWITCHOVER command
- The state of the primary and standby databases are TRANSPORT-ON and APPLY-ON
- Standby redo log files are configured on the primary database.
- The broker configuration file is updated to reflect the change in roles.
- Restarts the new standby database and begins the redo apply service.
- The new primary database is opened in read/wirte mode and the redo transport service is started.
Note:-Now primary database is Prime After the switchover primary database is Stand
Let’s Start the Demo:-
Step1:-Check the Primary Database
Use the SHOW DATABASE VERBOSE command to check the state, health, and properties of the primary database
DGMGRL> SHOW DATABASE VERBOSE ‘prime’;
Database – prime
Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
prime
Properties:
DGConnectIdentifier = ‘prime’
ObserverConnectIdentifier = ”
LogXptMode = ‘ASYNC’
RedoRoutes = ”
DelayMins = ‘0’
Binding = ‘optional’
MaxFailure = ‘0’
MaxConnections = ‘1’
ReopenSecs = ‘300’
NetTimeout = ’30’
RedoCompression = ‘DISABLE’
LogShipping = ‘ON’
PreferredApplyInstance = ”
ApplyInstanceTimeout = ‘0’
ApplyLagThreshold = ‘0’
TransportLagThreshold = ‘0’
TransportDisconnectedThreshold = ’30’
ApplyParallel = ‘AUTO’
StandbyFileManagement = ‘AUTO’
ArchiveLagTarget = ‘0’
LogArchiveMaxProcesses = ‘4’
LogArchiveMinSucceedDest = ‘1’
DbFileNameConvert = ‘/u01/app/oracle/oradata/STAND/datafile, /u01/app/oracle/oradata/PRIME/datafile’
LogFileNameConvert = ‘/u01/app/oracle/oradata/STAND/onlinelog, /u01/app/oracle/oradata/PRIME/onlinelog’
FastStartFailoverTarget = ”
InconsistentProperties = ‘(monitor)’
InconsistentLogXptProps = ‘(monitor)’
SendQEntries = ‘(monitor)’
LogXptStatus = ‘(monitor)’
RecvQEntries = ‘(monitor)’
StaticConnectIdentifier = ‘(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.24)(PORT=1539))(CONNECT_DATA=(SERVICE_NAME=PRIME_DGMGRL)(INSTANCE_NAME=prime)(SERVER=DEDICATED)))’
StandbyArchiveLocation = ‘USE_DB_RECOVERY_FILE_DEST’
AlternateLocation = ”
LogArchiveTrace = ‘0’
LogArchiveFormat = ‘%t_%s_%r.dbf’
TopWaitEvents = ‘(monitor)’
Database Status:
SUCCESS
Step2:-Check the Standby Database That is the Target of the Switchover
Use the SHOW DATABASE command to check the status of the standby database that is the target of the switchover
DGMGRL> SHOW DATABASE ‘stand’;
Database – stand
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
Average Apply Rate: 1.00 KByte/s
Real Time Query: OFF
Instance(s):
stand
Database Status:
SUCCESS
Step3:-Confirm That the Database Is Ready for a Role Change
12c New Feature
Prior to performing a role change, you can use the VALIDATE DATABASE command to perform
an exhaustive set of checks on the database to confirm that it is ready for a role change.
DGMGRL> VALIDATE DATABASE ‘prime’;
Database Role: Primary database
Ready for Switchover: Yes
Flashback Database Status:
prime: Off
DGMGRL> VALIDATE DATABASE ‘stand’;
Database Role: Physical standby database
Primary Database: prime
Ready for Switchover: Yes
Ready for Failover: Yes (Primary Running)
Flashback Database Status:
prime: Off
stand: Off
DGMGRL> SHOW CONFIGURATION;
Configuration – hari
Protection Mode: MaxPerformance
Members:
prime – Primary database
stand – Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 10 seconds ago)
Step4:-Issue the Switchover Command
Issue the SWITCHOVER command to swap the roles of the primary and standby databases
DGMGRL> switchover to ‘stand’;
Performing switchover NOW, please wait…
Operation requires a connection to instance “stand” on database “stand”
Connecting to instance “stand”…
Connected as SYSDBA.
New primary database “stand” is opening…
Operation requires start up of instance “prime” on database “prime”
Starting instance “prime”…
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is “stand”
Step5:-Show the Configuration
DGMGRL> SHOW CONFIGURATION;
Configuration – hari
Protection Mode: MaxPerformance
Members:
stand – Primary database (Now primary database is Stand)
prime – Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 28 seconds ago)
Successfully Switchover completed using DGMGRL Utlility
Reference:-
https://docs.oracle.com/database/121/DGBKR/cli.htm#DGBKR495
Catch Me On:- Hariprasath Rajaram
LinkedIn:https://www.linkedin.com/in/hari-prasath-aa65bb19/
Facebook:https://www.facebook.com/HariPrasathdba
FB Group:https://www.facebook.com/groups/894402327369506/
FB Page: https://www.facebook.com/dbahariprasath/?
Twitter: https://twitter.com/hariprasathdba