Using Oracle Data Guard

Note

This procedure is only applicable to bare metal and virtual machine DB systems. To use Oracle Data Guard with Exadata, see Using Oracle Data Guard with Exadata Cloud Service.

This topic explains how to use the Console to manage Oracle Data Guard associations in your DB system.

For complete information on Oracle Data Guard, see the Data Guard Concepts and Administration documentation in the Oracle Help Center.

Required IAM Service Policy

To use Oracle Cloud Infrastructure, you must be granted security access in a policy  by an administrator. This access is required whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you get a message that you don’t have permission or are unauthorized, verify with your administrator what type of access you have and which compartment  you should work in.

If you are new to policies, then see Getting Started with Policies and Common Policies.

Prerequisites

An Oracle Data Guard implementation requires two DB systems, one containing the primary database and one containing the standby database. When you enable Oracle Data Guard for a virtual machine DB system database, a new DB system with the standby database is created and associated with the primary database. For a bare metal DB system, the DB system with the database that you want to use as the standby must already exist before you enable Oracle Data Guard.

Tip

An Oracle Data Guard configuration on the Oracle Cloud Infrastructure is limited to one standby database for each primary database.

Requirement details are as follows:

  • Both DB systems must be in the same compartment.
  • The DB systems must be the same shape type (for example, if the shape of the primary database is a virtual machine, then the shape of the standby database can be any other virtual machine shape).
  • The database versions and editions must be identical. Oracle Data Guard does not support Oracle Database Standard Edition. (Active Data Guard requires Enterprise Edition - Extreme Performance.)
  • The database version determines whether Active Data Guard is enabled. If you are using the BYOL licensing model and if your license does not include Active Data Guard, then you must either use Oracle Database Enterprise Edition - High Performance or set up Oracle Data Guard manually. See Using Oracle Data Guard with the Database CLI.
  • If your primary and standby databases are in different regions, then you must peer the virtual cloud networks (VCNs) for each database. See Remote VCN Peering (Across Regions).
  • Configure the security list ingress and egress rules for the subnets of both DB systems in the Oracle Data Guard association to enable TCP traffic to move between the applicable ports. Ensure that the rules you create are stateful (the default).

    For example, if the subnet of the primary DB system uses the source CIDR 10.0.0.0/24 and the subnet of the standby DB system uses the source CIDR 10.0.1.0/24, then create rules as shown in the subsequent example.

Note

The egress rules in the example show how to enable TCP traffic only for port 1521, which is a minimum requirement for Oracle Data Guard to work. If TCP traffic is already enabled on all of your outgoing ports (0.0.0.0/0), then you do not need to explicitly add these specific egress rules.

Security List for Subnet on the Primary DB System

Ingress Rules:
				Stateless: No
				Source: 10.0.1.0/24
				IP Protocol: TCPSource Port Range: All 
				Destination Port Range: 1521
				Allows: TCP traffic for ports: 1521

				Egress Rules:

				Stateless: No
				Destination: 10.0.1.0/24 
				IP Protocol: TCP 
				Source Port Range: All
				Destination Port Range: 1521
				Allows: TCP traffic for ports: 1521
			

Security List for Subnet on the Standby DB System

Ingress Rules:	

				Stateless: No
				Source: 10.0.0.0/24 
				IP Protocol: TCP 
				Source Port Range: All 
				Destination Port Range: 1521
				Allows: TCP traffic for ports: 1521

				Egress Rules:

				Stateless: No
				Destination: 10.0.0.0/24 
				IP Protocol: TCP 
				Source Port Range: All
				Destination Port Range: 1521
				Allows: TCP traffic for ports: 1521
			

For information about creating and editing rules, see Security Lists.

Availability Domain and Fault Domain Considerations for Oracle Data Guard

Oracle recommends that the DB system that contains the standby database be in a different availability domain  from that of the DB system containing the primary database to improve availability and disaster recovery. If you enable Oracle Data Guard for a database and your standby database is in the same availability domain as the primary database (either by choice, or because you are working in a single availability domain region), then Oracle recommends that you place the standby database in a different fault domain  from that of the primary database.

Note

If your primary and standby databases are two-node Oracle RAC databases and both are in the same availability domain, then only one of the two nodes of the standby database can be in a fault domain that does not include any other nodes from either the primary or standby database. This is because each availability domain has only three fault domains, and the primary and standby databases have a combined total of four nodes. For more information on availability domains and fault domains, see Regions and Availability Domains.

Working with Oracle Data Guard

Oracle Data Guard ensures high availability, data protection, and disaster recovery for enterprise data. The Oracle Cloud Infrastructure Database Data Guard implementation requires two databases: one in a primary role and one in a standby role. The two databases make an Oracle Data Guard association. Most of your applications access the primary database, while the standby database is a transactionally consistent copy of the primary database.

Oracle Data Guard maintains the standby database by transmitting and applying redo data from the primary database. If the primary database becomes unavailable, then you can use Oracle Data Guard to switch or fail over the standby database to the primary role.

Tip

The standby databases in Oracle Cloud Infrastructure Database are physical standbys.

Switchover

A switchover reverses the primary and standby database roles. Each database continues to participate in the Oracle Data Guard association in its new role. A switchover ensures no data loss. Performing planned maintenance on a DB system with an Oracle Data Guard association is typically done by switching the primary database to the standby role, performing maintenance on the standby database, and then switching it back to the primary role.

Failover

A failover transitions the standby database into the primary role after the existing primary database fails or becomes unreachable. A failover might result in some data loss when you use Maximum Performance protection mode.

Reinstate

Reinstates a database into the standby role in an Oracle Data Guard association. You can use the reinstate command to return a failed database into service after correcting the cause of failure.
Note

You cannot terminate a primary database that has an Oracle Data Guard association with a standby database until you first delete the standby database. Alternatively, you can switch over the primary database to the standby role, and then terminate it.

You cannot terminate a DB system that includes databases that have Oracle Data Guard enabled. To remove the Oracle Data Guard association:

  • For a bare metal DB system database you can terminate the standby database.
  • For a virtual machine DB system database you can terminate the standby DB system.

Terminating a DB System with Data Guard

If you want to terminate a DB system that has Data Guard enabled, you must terminate the standby DB system before terminating the primary DB system. If you try to terminate a primary DB system that has a standby, the terminate operation will not complete. See To terminate a DB system for instructions on terminating a DB system.

Using the Console

Use the Console to enable an Oracle Data Guard association between databases, change the role of a database in an Oracle Data Guard association using either a switchover or a failover operation, and reinstate a failed database.

When you enable Oracle Data Guard, a separate Oracle Data Guard association is created for the primary and the standby databases.

To enable Oracle Data Guard on a bare metal DB system
Note

If you do not already have bare metal DB systems with the databases to assume the primary and standby roles, then create them as described in Creating Bare Metal and Virtual Machine DB Systems. A new DB system includes an initial database.
  1. Open the navigation menu. Under Oracle Database, click Bare Metal, VM, and Exadata.
  2. Choose the Compartment that contains a DB system with a database for which you want to enable Oracle Data Guard.
  3. Click the name of a DB system that contains a database you want to assume the primary role.
  4. On the DB System Details page, in the Databases section, click the name of the database you want to make primary.
  5. On the Database Details page, in the Resources section, click Data Guard Associations.
  6. In the Data Guard Associations section, click Enable Data Guard.
  7. On the Enable Data Guard page, configure the Oracle Data Guard association.

    • The settings in the Data Guard association details section are read only and cannot be changed.

      • Protection mode: The protection mode used for this Oracle Data Guard association is set to Maximum Performance.
      • Transport type: The redo transport type used for this Oracle Data Guard association is set to Async (asynchronous).
    • In the Select peer DB system section, provide the following information for the standby database to obtain a list of available DB systems in which to locate the standby database:

      • Region: Select a region where you want to locate the standby database. The region where the primary database is located is selected, by default. You can choose to locate the standby database in a different region. The hint text associated with this field tells you in which region the primary database is located.
      • Availability domain: Select an availability domain for the standby database. The hint text associated with this field tells you in which availability domain the primary database is located.

        Note

        If your standby database is in a region with only one availability domain, or if you choose to provision your standby database in the same availability domain as your primary database, then the system asks you to specify a number of optional fault domains from the Fault domain drop-down for your standby database. Oracle recommends that you locate your standby database in a different fault domain from your primary database. For more information on fault domains, see Regions and Availability Domains.
      • Shape: Select the shape of the DB system in which to locate the standby database. The shape can be another bare metal DB system shape.
      • Peer DB system: Select a DB system in which to locate the standby database.
    • In the Configure standby database section, enter the database administrator password of the primary database in the Database password field. Use this same database administrator password for the standby database.
  8. Click Enable Data Guard.

    When you create the association, the details for a database and its peer display their respective roles as Primary or Standby.

To enable Oracle Data Guard on a virtual machine DB system

If you do not already have a virtual machine DB system with a database that will assume the primary role, then create a database as described in Creating Bare Metal and Virtual Machine DB Systems. A new DB system includes an initial database. When you enable Oracle Data Guard on the primary database, a virtual machine DB system gets created for the standby database.

  1. Open the navigation menu. Under Oracle Database, click Bare Metal, VM, and Exadata.
  2. Choose the Compartment that contains a DB system with a database for which you want to enable Oracle Data Guard.
  3. Click the name of a DB system that contains a database you want to assume the primary role.

  4. On the DB System Details page, in the Databases section, click the name of the database you want to make primary.

  5. On the Database Details page, in the Resources section, click Data Guard Associations.
  6. In the Data Guard Associations section, click Enable Data Guard.
  7. On the Enable Data Guard page, configure your Oracle Data Guard association.

    • The settings in the Data Guard association details section are read only and cannot be changed.

      • Protection mode: The protection mode used for this Oracle Data Guard association is set to Maximum Performance.
      • Transport type: The redo transport type used for this Oracle Data Guard association is set to Async (asynchronous).
    • Specify the following values in the Create peer DB system section for the standby database:

      • Display name: Enter a non-unique display name for the DB system containing the standby database. An Oracle Cloud Identifier (OCID) will uniquely identify the DB system.
      • Region: Select a region where you want to locate the standby database. The region where the primary database is located is selected, by default. You can choose to locate the standby database in a different region. The hint text associated with this field tells you in which region the primary database is located.
      • Availability domain: Select an availability domain for the standby database. The hint text associated with this field tells you in which availability domain the primary database is located.

        Note

        If your standby database is in a region with only one availability domain, or if you choose to provision your standby database in the same availability domain as your primary database, then the system asks you to specify a number of optional fault domains from the Fault domain drop-down for your standby database. Oracle recommends that you locate your standby database in a different fault domain from your primary database. For more information on fault domains, see Regions and Availability Domains.
      • Select a shape: Choose a shape to use to create the standby DB system.

        To specify a shape other than the default, click Change Shape and select an available virtual machine shape from the list.

      • In the Specify the network information section:

        • Virtual cloud network in compartment: Select a virtual cloud network from the drop-down in which to create the DB system containing the standby database. Click Change Compartment to select a virtual cloud network in a different compartment.
        • Subnet in compartment : The subnet to which the DB system containing the standby database attaches. Click Change Compartment to select a subnet in a different compartment.

          Do not use a subnet that overlaps with 192.168.16.16/28, which is used by the Oracle Clusterware private interconnect on the database instance. Specifying an overlapping subnet will cause the private interconnect to malfunction.

        • Configure network security groups (NSGs): Select to add a number of network security groups, which function as virtual firewalls, enabling you to apply a set of security rules that control inbound and outbound traffic for the DB system containing the standby database. For more information, see Network Security Groups and Network Setup for DB Systems.

          Note

          • If you choose a subnet with a security list, then the security rules for the DB system will be a combination of the rules in the security list and the network security groups.

          • You must select a virtual cloud network to be able to assign network security groups to your DB system.

        • Hostname prefix: Enter a host name prefix for the DB system that contains the standby database. The host name must begin with an alphabetic character, and can contain only alphanumeric characters and hyphens (-). The maximum number of characters allowed for bare metal and virtual machine DB systems is 16.

          Important

          If the host name within the subnet is not unique, then provisioning of the DB system fails.
        • Host domain name: The domain name for the DB system. If the subnet you selected uses the Oracle-provided internet and virtual cloud network resolver for DNS name resolution, then this field displays the domain name for the subnet, which you cannot change. Otherwise, you can enter a domain name. Hyphens (-) are not permitted.
        • Host and domain URL: Combines the host and domain names to display the fully-qualified domain name for the database. The maximum length is 64 characters.
      • In the Configure standby database section, enter the database administrator password of the primary database in the Database password field. Use this same database administrator password for the standby database.
    • Database Admin Password: Enter the primary database admin password.

      The same password is used for the standby database.

    • Confirm Database Admin Password: Re-enter the Database Admin Password you specified.
  8. Click Enable Data Guard.

    When you create the association, the details for a database and its peer display their respective roles as Primary or Standby.

Virtual machine shapes

Virtual machine X7 shapes:

  • VM.Standard2.1: Provides a 1-node DB system with 1 core.
  • VM.Standard2.2: Provides a 1- or 2-node DB system with 2 cores.
  • VM.Standard2.4: Provides a 1- or 2-node DB system with 4 cores.
  • VM.Standard2.8: Provides a 1- or 2-node DB system with 8 cores.
  • VM.Standard2.16: Provides a 1- or 2-node DB system with 16 cores.
  • VM.Standard2.24: Provides a 1- or 2-node DB system with 24 cores.

Virtual machine X5 shapes:

  • VM.Standard1.1: Provides a 1-node DB system with 1 core.
  • VM.Standard1.2: Provides a 1- or 2-node DB system with 2 cores.
  • VM.Standard1.4: Provides a 1- or 2-node DB system with 4 cores.
  • VM.Standard1.8: Provides a 1- or 2-node DB system with 8 cores.
  • VM.Standard1.16: Provides a 1- or 2-node DB system with 16 cores.
Note

  • X5-based shapes availability is limited to monthly universal credit customers existing on or before November 9th, 2018, in the US West (Phoenix), US East (Ashburn), and Germany Central (Frankfurt) regions.
  • VM.Standard1.1 and VM.Standard2.1 shapes cannot be used for 2-node RAC clusters.
To perform a database switchover

You initiate a switchover operation by using the Data Guard association of the primary database.

  1. Open the navigation menu. Under Oracle Database, click Bare Metal, VM, and Exadata.
  2. Choose the Compartment that contains the DB system with the primary database you want to switch over.
  3. Click the DB system name, and then click the name of the primary database.
  4. Under Resources, click Data Guard Associations.
  5. For the Data Guard association on which you want to perform a switchover, click the Actions icon (three dots), and then click Switchover.
  6. In the Switchover Database dialog box, enter the database admin password, and then click OK.

    This database should now assume the role of the standby, and the standby should assume the role of the primary in the Data Guard association.

To perform a database failover

You initiate a failover operation by using the Data Guard association of the standby database.

  1. Open the navigation menu. Under Oracle Database, click Bare Metal, VM, and Exadata.
  2. Choose the Compartment that contains the DB system with the primary database's peer standby you want to fail over to.
  3. Click the DB system name, and then click the name of the standby database.
  4. Under Resources, click Data Guard Associations.
  5. For the Data Guard association on which you want to perform a failover, click Failover.
  6. In the Failover Database dialog box, enter the database admin password, and then click OK.

    This database should now assume the role of the primary, and the old primary's role should display as Disabled Standby.

To reinstate a database

After you fail over a primary database to its standby, the standby assumes the primary role and the old primary is identified as a disabled standby. After you correct the cause of failure, you can reinstate the failed database as a functioning standby for the current primary by using its Data Guard association.

Note

Before you can reinstate a 12.2 database, you must perform some steps on the database host to stop the database or start it in MOUNT mode.

Set your ORACLE_UNQNAME environment variable to the value of the Database Unique Name (as seen in the Console), and then run these commands:

srvctl stop database -d db-unique-name -o abort
					srvctl start database -d db-unique-name -o mount
  1. Open the navigation menu. Under Oracle Database, click Bare Metal, VM, and Exadata.
  2. Choose the Compartment that contains the DB system with the failed database you want to reinstate.
  3. Click the DB system name, and then click the database name.
  4. Under Resources, click Data Guard Associations.
  5. For the Data Guard association on which you want to reinstate this database, click the Actions icon (three dots), and then click Reinstate.
  6. In the Reinstate Database dialog box, enter the database admin password, and then click OK.

    This database should now be reinstated as the standby in the Data Guard association.

To terminate a Data Guard association on a bare metal DB system

On a bare metal DB system, you remove a Data Guard association by terminating the standby database.

  1. Open the navigation menu. Under Oracle Database, click Bare Metal, VM, and Exadata.
  2. Choose the Compartment that contains the DB system that includes the standby database you want to terminate.
  3. Click the DB system name.
  4. For the standby database you want to terminate, click the Actions icon (three dots), and then click Terminate.
  5. In the Terminate Database dialog box, enter the name of the database, and then click OK.

To terminate a Data Guard association on a virtual machine DB system

On a virtual machine DB system, you remove a Data Guard association by terminating the standby DB system.

  1. Open the navigation menu. Under Oracle Database, click Bare Metal, VM, and Exadata.
  2. Choose the Compartment that contains the standby DB system that you want to terminate.
  3. Click the DB system name, click the Actions icon (three dots), and then click Terminate.
  4. Confirm when prompted.

    The DB system's icon indicates Terminating.

Using the API

For information about using the API and signing requests, see REST APIs and Security Credentials. For information about SDKs, see Software Development Kits and Command Line Interface.

Use these API operations to manage Data Guard associations:

For the complete list of APIs for the Database service, see Database Service API.