Administering a Data Guard Configuration

Oracle Database Classic Cloud Service provides several commands and features to simplify the administration of database deployments that contain an Oracle Data Guard configuration.

Note:

Oracle Database Classic Cloud Service does not currently include the fast-start failover (FSFO) feature of Oracle Data Guard. In Database Classic Cloud Service, you perform failover operations manually, as described in Performing a Manual Failover Operation.

Checking the Status of the Oracle Data Guard Configuration

Note:

This topic does not apply to database deployments using both Oracle RAC and Oracle Data Guard. For such deployments, use the raccli status dataguard command to check the status of the deployment.

You can use the dataguard status subcommand of the dbaascli utility to check the status of your Oracle Data Guard configuration.

Before performing certain operations, you may want to check the status of your Oracle Data Guard configuration.

To check the status of the Oracle Data Guard configuration by using the dataguard status subcommand:
  1. Connect to either compute node in the Data Guard configuration as the oracle user.
  2. Check the status of the configuration:
    $ dbaascli dataguard status [--details yes|no] [--password password]
    

    Use the details option to generate a detailed listing including data protection mode, redo transport services mode, maximum data loss potential, and approximate database role transition time.

    Use the password option to supply the SYS user password if you changed it since creating the Data Guard configuration.

Performing a Switchover Operation

You can perform a switchover to the standby database in your Oracle Data Guard configuration by using the Oracle Database Classic Cloud Service console or, if desired, by using one of the ways listed in Other Ways to Perform a Switchover Operation at the end of this topic.

A switchover operation enables the primary database to switch roles with the 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. For more information, see "Switchovers" in Oracle Data Guard Concepts and Administration for Release 18, 12.2, 12.1 or 11.2.

Performing a Switchover Operation by Using the Oracle Database Classic Cloud Service Console

  1. Go to the Overview page for the database deployment you want to perform a switchover on:

    1. Open the Oracle Database Classic Cloud Service console.

      For detailed instructions, see Accessing the Oracle Database Classic Cloud Service Console.

    2. In the list of deployments, click the name of the database deployment you want to perform the switchover on.

      The Oracle Database Classic Cloud Service Overview page is displayed.

  2. To ensure the Overview page reflects the current role of each database, click the Refresh Configuration icon.

  3. From the action menu (Menu icon) located beside the deployment name or beside any of the compute nodes, select Switchover, and then confirm the action.

    The deployment shows a status of Maintenance in the Oracle Database Classic Cloud Service console until the switchover is complete.

  4. Refresh the page occasionally.

    Database Role will be updated to reflect the new role for each database.

Note:

For Data Guard configurations of two Oracle RAC databases, you must manually configure backups after the switchover operation completes. For instructions, see Manual backup configuration required after switchover or failover on Oracle RAC plus Data Guard deployments in Known Issues for Oracle Database Classic Cloud Service.

Other Ways to Perform a Switchover Operation

Performing a Switchover Operation by 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.
  2. Start a root-user command shell and then switch to the oracle user:
    $ sudo -s
    # su - oracle
    $
  3. Initiate the switchover to the standby database:
    $ dbaascli dataguard switchover [--password password]
    

    Use the password option to supply the SYS user password if you changed it since creating the Data Guard configuration.

  4. Return to being the root user:
    $ exit
    #
  5. Restart the ORDS server:
    # /etc/init.d/ords restart
  6. Exit the root-user command shell and disconnect from the compute node:
    # exit
    $ exit

Performing a Manual Failover Operation

You can perform a manual failover to the standby database in your Oracle Data Guard configuration by using the Oracle Database Classic Cloud Service console or, if desired, by using one of the ways listed in Other Ways to Perform a Manual Failover Operation at the end of this topic.

A failover operation changes the 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. For more information, see "Failovers" in Oracle Data Guard Concepts and Administration for Release 18, 12.2, 12.1 or 11.2.

Performing a Manual Failover Operation by Using the Oracle Database Classic Cloud Service Console

  1. Go to the Overview page for the database deployment you want to perform the failover on:

    1. Open the Oracle Database Classic Cloud Service console.

      For detailed instructions, see Accessing the Oracle Database Classic Cloud Service Console.

    2. In the list of deployments, click the name of the database deployment you want to perform the failover on.

      The Oracle Database Classic Cloud Service Overview page is displayed.

  2. To ensure the Overview page reflects the current role of each database, click the Refresh Configuration icon.

  3. From the action menu (Menu icon) located beside the deployment name or beside any of the compute nodes, select Failover, and then confirm the action.

    The deployment shows a status of Maintenance in the Oracle Database Classic Cloud Service console until the operation is complete.

  4. Refresh the page occasionally.

    Database Role will be updated to reflect the new role for each database.

Note:

For Data Guard configurations of two Oracle RAC databases, you must manually configure backups after the failover operation completes. For instructions, see Manual backup configuration required after switchover or failover on Oracle RAC plus Data Guard deployments in Known Issues for Oracle Database Classic Cloud Service.

Other Ways to Perform a Manual Failover Operation

Performing a Manual Failover Operation by 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.
  2. Start a root-user command shell and then switch to the oracle user:
    $ sudo -s
    # su - oracle
    $
  3. Initiate the failover to the standby database:
    $ dbaascli dataguard failover [--force yes|no] [--password password]
    

    Use the force option if the status subcommand shows that the Data Guard configuration is in a warning or error state.

    Use the password option to supply the SYS user password if you changed it since creating the Data Guard configuration.

  4. Return to being the root user:
    $ exit
    #
  5. Restart the ORDS server:
    # /etc/init.d/ords restart
  6. Exit the root-user command shell and disconnect from the compute node:
    # exit
    $ exit

Reinstating a Failed Primary Database

You can reinstate a failed primary database after a failover by using the Oracle Database Classic Cloud Service console or, if desired, by using one of the ways listed in Other Ways to Reinstate a Failed Primary Database at the end of this topic.

After performing a failover to the standby database, you may be able to restore your original disaster-recovery solution by reinstating the failed primary database. You can use the Data Guard broker's reinstate capability to make the failed primary database a viable standby database for the new primary. For more information, see "Reenabling Disabled Databases After a Role Change" in Oracle Data Guard Broker for Release 18, 12.2, 12.1 or 11.2.

Reinstating a Failed Primary Database by Using the Oracle Database Classic Cloud Service Console

  1. Go to the Overview page for the database deployment you want to perform the reinstate on:

    1. Open the Oracle Database Classic Cloud Service console.

      For detailed instructions, see Accessing the Oracle Database Classic Cloud Service Console.

    2. In the list of deployments, click the name of the database deployment you want to perform the reinstate on.

      The Oracle Database Classic Cloud Service Overview page is displayed.

  2. To ensure the Overview page reflects the current role of each database, click the Refresh Configuration icon.

  3. From the action menu (Menu icon) located beside the deployment name , select Reinstate, and then confirm the action.

    The deployment has a status of Maintenance in the Oracle Database Classic Cloud Service console until the operation is complete.

  4. Refresh the page occasionally.

    Database Role will be updated to reflect the new role for each database.

Other Ways to Reinstate a Failed Primary Database

Reinstating a Failed Primary Database by Using the dbaascli Utility

You can use the dataguard reinstate subcommand of the dbaascli utility to reinstate a failed primary database after a failover.

To determine whether the database can be reinstated, use the dataguard status subcommand as described in Checking the Status of the Oracle Data Guard Configuration. A status of ORA-16661: the standby database needs to be reinstated indicates the standby database can be reinstated.

To reinstate a failed primary database by using the dataguard reinstate subcommand:
  1. Connect to one of the compute nodes in the Oracle Data Guard configuration as the oracle user.
  2. Initiate the reinstatement of the failed primary database:
    $ dbaascli dataguard reinstate [--password password]
    

    Use the password option to supply the SYS user password if you changed it since creating the Data Guard configuration.

  3. Disconnect from the compute node.
    $ exit

Changing the SYS Password

Note:

This topic does not apply to database deployments using both Oracle RAC and Oracle Data Guard. Such deployments do not include the dbaascli utility.

You can use the database changepassword subcommand of the dbaascli utility to change the password of the SYS user in your Oracle Data Guard configuration.

To use the database changepassword subcommand of the dbaascli utility:

  1. Connect as the oracle user to the compute node hosting the primary database.
  2. Execute the dbaascli database changepassword command.
    $ dbaascli database changepassword
    
    Enter the SYS user name and new password when prompted.
  3. Disconnect from the compute node.
    $ exit

Configuring Clients for Automatic Failover

Note:

This topic does not apply to database deployments using both Oracle RAC and Oracle Data Guard.

By using pre-defined network service names, application clients can automatically reconnect to a new primary database following a role transition.

Your Data Guard configuration on Oracle Database Classic Cloud Service is pre-configured to provide automatic transition of application connections from a failed primary database to a new primary database after a Data Guard role transition has taken place.

The following network service names are pre-defined:

  • SID_dg: This service is used to connect to the primary database. If the database uses Oracle Database 12c Release 1, or later, this service connects to the root container.

  • SID_dg_ro: If the Data Guard configuration includes a standby database with real-time query (Active Data Guard), this service is defined and is used to connect to the standby database. If the database uses Oracle Database 12c Release 1, or later, this service connects to the root container.

  • PDBname_dg: In an Oracle Data Guard configuration using Oracle Databases 12c Release 1, or later, this service is defined and is used to connect to the default PDB of the primary database.

  • PDBname_dg_ro: In an Oracle Data Guard configuration using Oracle Databases 12c Release 1, or later, that includes a standby database with real-time query (Active Data Guard), this service is defined and is used to connect to the default PDB of the standby database.

The services are managed on each database through the use of pre-defined triggers. Following a role transition, the trigger is fired to start the services on the new primary database. By using the pre-defined network service names in your application connections, your application clients will be automatically directed to the new primary database following a role transition.

See Client Failover Best Practices for Highly Available Oracle Databases: Oracle Database 11g Release 2 or Client Failover Best Practices for Highly Available Oracle Databases Oracle Database 12c for detailed information.