By Joel Peréz ACED.gifSkant Gupta

This article is brought by en.enmotech.com

 

At the last part of this article we performed Switchover, Failover & Reinstate Operations on Oracle Data Guard using the DBCS Console.

You can read it here:

#2 Oracle Cloud (DBaaS): Switchover, Failover & Reinstate Operations on Oracle Data Guard using DBCS Console

Now in this this article we will show the necessary steps to perform Switchover, Failover & Reinstate Operations using the dbaas Utility

 

Performing a Switchover Operation

A switchover operation enables the primary database to switch roles with its standby database. There is no data loss during a switchover. After a switchover, each database continues to participate in the Oracle Data Guard configuration in its new role. A switchover is typically used to reduce primary database downtime during planned outages, such as operating system or hardware upgrades, or rolling upgrades of the Oracle database software and patch sets.

 

Steps to Perform a Switchover Operation using the dbaascli utility

 

You can use the dataguard switchover subcommand of the dbaascli utility to perform a switchover to the standby database in your Oracle Data Guard configuration.

To perform a switchover by using the dataguard switchover subcommand:

 

1. Connect to the compute node in the Oracle Data Guard configuration that will host the new primary database as the opc user.

Using username "opc".

Authenticating with public key "rsa-key-20170425"

Passphrase for key "rsa-key-20170425":

[opc@DATAGUARD-dg01 ~]$

 

2. Start a root-user command shell and then switch to the oracle user.

[opc@DATAGUARD-dg01 ~]$ sudo su - oracle

[oracle@DATAGUARD-dg01 ~]$

 

3. Initiate the switchover to the standby database

[oracle@DATAGUARD-dg01 ~]$ dbaascli dataguard switchover

DBAAS CLI version 1.0.0

Executing command dataguard switchover

Performing switchover NOW, please wait...

New primary database "ORCL_02" is opening...

Operation requires startup of instance "ORCL" on database "ORCL_01"

Starting instance "ORCL"...

ORACLE instance started.

Database mounted.

Switchover succeeded, new primary is "ORCL_02"

SUCCESS : Switchover to Standby operation completed successfully

[oracle@DATAGUARD-dg01 ~]

 

4. Restart the ORDS server

[root@DATAGUARD-dg01 ~]# /etc/init.d/ords restart

INFO: Stopping Oracle REST Data Services...

INFO: Oracle REST Data Services stopped

INFO: Starting Oracle REST Data Services...

INFO: Oracle REST Data Services bound to ports 8080,8181 854

INFO: Oracle REST Data Services started with PID 854

[root@DATAGUARD-dg01 ~]#

 

5. Check the status of standby database

[oracle@DATAGUARD-dg01 ~]$ dbaascli dataguard status

DBAAS CLI version 1.0.0

Executing command dataguard status

SUCCESS : Dataguard is up and running

DETAILS:

Configuration - fsc

  Protection Mode: MaxPerformance

  Databases:

    ORCL_02 - Primary database

    ORCL_01 - Physical standby database

  Properties:

    FastStartFailoverThreshold      = '30'

    OperationTimeout                = '120'

    FastStartFailoverLagLimit       = '30'

    CommunicationTimeout            = '180'

    ObserverReconnect               = '0'

    FastStartFailoverAutoReinstate  = 'TRUE'

    FastStartFailoverPmyShutdown    = 'TRUE'

    BystandersFollowRoleChange      = 'ALL'

    ObserverOverride                = 'FALSE'

    ExternalDestination1            = ''

    ExternalDestination2            = ''

    PrimaryLostWriteAction          = 'CONTINUE'

Fast-Start Failover: DISABLED

Configuration Status:

SUCCESS

[oracle@DATAGUARD-dg01 ~]$

 

Performing a Manual Failover Operation

A failover operation changes a standby database to the primary role in response to a primary database failure. If the primary database was not operating in either maximum protection mode or maximum availability mode before the failure, some data loss may occur. If Flashback Database is enabled on the primary database, it can be reinstated as a standby for the new primary database once the reason for the failure is corrected. A failover is typically used only when the primary database becomes unavailable, and there is no possibility of restoring it to service within a reasonable period of time.

 

Steps to Perform a Failover Operation using the dbaascli utility

You can use the dataguard failover subcommand of the dbaascli utility to perform a manual failover to the standby database in your Oracle Data Guard configuration.

To perform a failover by using the dataguard failover subcommand:

 

1. Connect to the compute node in the Oracle Data Guard configuration that will host the new primary database as the opc user.

Using username "opc".

Authenticating with public key "rsa-key-20170425"

Passphrase for key "rsa-key-20170425":

[opc@DATAGUARD-dg01 ~]$

 

2. Start a root-user command shell and then switch to the oracle user.

[opc@DATAGUARD-dg01 ~]$ sudo su - oracle

[oracle@DATAGUARD-dg01 ~]$

 

3. Initiate the failover to the standby database

[oracle@DATAGUARD-dg02 ~]$ dbaascli dataguard failover

DBAAS CLI version 1.0.0

Executing command dataguard failover

Performing failover NOW, please wait...

Failover succeeded, new primary is "ORCL_01"

SUCCESS : Successfully failed over to Standby

[oracle@DATAGUARD-dg02 ~]$

 

4. Restart the ORDS server

[root@DATAGUARD-dg02 ~]# /etc/init.d/ords restart

INFO: Stopping Oracle REST Data Services...

INFO: Oracle REST Data Services stopped

INFO: Starting Oracle REST Data Services...

INFO: Oracle REST Data Services bound to ports 8080,8181 24177

INFO: Oracle REST Data Services started with PID 24177

[root@DATAGUARD-dg02 ~]#

 

5. Check the status of standby database

[oracle@DATAGUARD-dg02 ~]$ dbaascli dataguard status

DBAAS CLI version 1.0.0

Executing command dataguard status

SUCCESS : Dataguard is up and running

DETAILS:

 

Configuration - fsc

  Protection Mode: MaxPerformance

  Databases:

    ORCL_01 - Primary database

    ORCL_02 - Physical standby database (disabled)

      ORA-16661: the standby database needs to be reinstated

  Properties:

    FastStartFailoverThreshold      = '30'

    OperationTimeout                = '120'

    FastStartFailoverLagLimit       = '30'

    CommunicationTimeout            = '180'

    ObserverReconnect               = '0'

    FastStartFailoverAutoReinstate  = 'TRUE'

    FastStartFailoverPmyShutdown    = 'TRUE'

    BystandersFollowRoleChange      = 'ALL'

    ObserverOverride                = 'FALSE'

    ExternalDestination1            = ''

    ExternalDestination2            = ''

    PrimaryLostWriteAction          = 'CONTINUE'

Fast-Start Failover: DISABLED

Configuration Status:

SUCCESS

[oracle@DATAGUARD-dg02 ~]$

 

At next article we will show you how to reinstate a Failed Primary Database using dbaascli Utility.

 

If you want to be updated with all our articles send us the Invitation or Follow us:

Joel Perez’s LinkedIn: www.linkedin.com/in/SirDBaaSJoelPerez

Skant Gupta's LinkedIn: www.linkedin.com/in/skantali/

or Join Oracle Cloud DBaaS LinkedIn Group: https://www.linkedin.com/groups/12065270

 

Full Index of Oracle Cloud Articles:

Sir.CloudDBaaSjoelperez

 

Joel Pérez is an Expert DBA ( Oracle ACE Director, Maximum Availability OCM, OCM Cloud Admin. & OCM12c/11g ) with over 17 years of Real World Experience in Oracle Technology, specialised in design and implement solutions of: High Availability, Disaster Recovery, Upgrades, Replication, Cloud and all area related to Oracle Databases. International consultant with duties, conferences & activities in more than 50 countries and countless clients around the world. Habitual and one of leading writers of Technical Oracle articles for: OTN Spanish, Portuguese, English and more. Regular Speaker in worldwide Oracle events  like: OTN LAD (Latin America), OTN MENA (Middle East & Africa), OTN APAC ( Asian Pacific), DTCC China, Oracle Code.. . Joel has always been known for being a pioneer in Oracle technology since the early days of his career being the first Latin American awarded as “OTN Expert” at year 2003 by Oracle Corp., one of the first “Oracle ACE” globally in the Oracle ACE Program at year 2004. He was honoured as one of the first “OCM Database Cloud Administrator” & Maximum Availability OCM in the world. Currently Joel works as Senior Cloud Database Architect in “Yunhe Enmo (Beijing) Technology Co.,Ltd”., company located in Beijing, China En.enmotech.com

 

Skant Gupta is an Oracle Certified Cloud Professional in Oracle Database 12c, an Oracle Certified Expert in Oracle Real Application Clusters (Oracle RAC) in Oracle Database 11g and 12c, and an Oracle Exadata Certified and an Oracle Certified Professional in Oracle Database 10g, 11g, and 12c. He works at Vodafone Technology in the UK and formerly worked as a senior DBA at Etisalat in Dubai. He has six years of experience with various Oracle technologies, focusing mainly on Cloud, database, and high availability solutions, Oracle WebLogic Suite, Oracle Exadata and Oracle GoldenGate. He has presented at several Oracle user groups worldwide, most recently in the US, the United Arab Emirates, and the India. Skant website link: oracle-help.com