12 Using Oracle Data Guard for Disaster Management and Recovery on Oracle Database Appliance

Understand how you can use Oracle Data Guard for disaster management and recovery on Oracle Database Appliance.

About Oracle Data Guard on Oracle Database Appliance

Oracle Database Appliance provides client interface through ODACLI commands for easy configuration and management of Oracle Data Guard for high availability, data protection, and disaster recovery.

Oracle Data Guard provides a comprehensive set of services that create, maintain, manage, and monitor one or more standby databases to enable production Oracle databases to survive disasters and data corruptions. Oracle Data Guard maintains these standby databases as copies of the production database. Then, if the production database becomes unavailable because of a planned or an unplanned outage, Oracle Data Guard can switch any standby database to the production role, minimizing the downtime associated with the outage. Oracle Data Guard can be used with traditional backup, restoration, and cluster techniques to provide a high level of data protection and data availability. Oracle Data Guard transport services are also used by other Oracle features such as Oracle Streams and Oracle GoldenGate for efficient and reliable transmission of redo from a source database to one or more remote destinations.

With Oracle Data Guard, administrators can optionally improve production database performance by offloading resource-intensive backup and reporting operations to standby systems.

The ability to create clone databases on a standby system enables you to set up test or development environments based on your standby databases. Since standby systems are not production systems, they are a better choice for seeding test or development environments.

Note:

Oracle Database Enterprise Edition includes Oracle Data Guard.

Configuring Oracle Data Guard on Oracle Database Appliance

Oracle Database Appliance enables you to set up Oracle Data Guard using ODACLI commands.

Prerequisites for Oracle Database Guard Configuration

Before you begin:
  • Oracle recommends running the primary and the standby databases on separate Oracle Database Appliance hardware, so ensure that you have at least two separate Oracle Database Appliance machines.
  • Oracle recommends running the primary and the standby databases on two homogeneous Oracle Database Appliance systems. For example, if the primary database is a High-Availability system, then the standby database must be on a similar High-Availability system.
  • Oracle recommends that the primary and standby systems have the same Oracle Database Appliance configuration. The database must have similar configuration for database shape, version, memory, networking, and storage (both must have either Oracle ASM or Oracle ACFS storage) to avoid any unpredictability with the database switch roles.
  • The primary and standby systems must be the same Oracle Database Appliance release, and must be on Oracle Database Appliance release 19.8 or later.
  • If you have customized the operating system, then ensure that environments on both machines are identical.
  • Ensure that your deployment follows Oracle Maximum Availability Architecture (MAA) best practices. See the Oracle Maximum Availability Architecture (MAA) page on Oracle Technology Network.
  • If you decide to use Oracle ObjectStore for backup and recovery, then you must configure access for both the primary and standby systems.
  • You need the TrustStore password to configure Oracle Data Guard. The TrustStore password is available in the location /opt/oracle/dcs/dcscli/dcscli.conf.

Setting up Backup and Recovery for Oracle Database Guard Configuration

You can use either Object Store or External FRA (NFS) to set up the backup for primary and standby databases when configuring Oracle Data Guard on Oracle Database Appliance. A backup is necessary to instantiate a standby database.

To set up Object Store backup (recommended):
  1. Configure the agent proxy settings:
    # odacli update-agentConfigParameters -n HttpProxyHost -v www-proxy.test.com -n HttpProxyPort -v 80 -u

    For more information, see the topic Configuring Agent Proxy Settings for Object Store Access in this guide.

  2. Create the Object Store credentials on both primary and standby systems:
    # odacli create-objectstoreswift -e swift_end_point_URL -n Object Store_Swift_name -t Object_Store_tenant_name -u Object_Store_user_name

    For example:

    # odacli create-objectstoreswift -e https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1  -n aaa -t test_user -u testuser
  3. View the Object Store Swift name:
    # odacli list-objectstoreswifts
  4. Create the backup configuration:
    # odacli create-backupconfig -d objectstore -c testuser -on aaa -w 7 -cr -n backupConfig7days
  5. Associate the backup configuration with the database:
    # odacli modify-database -in test_db -bin backupConfig7days -bp
To set up NFS backup:
  1. Create the backup configuration. For High-Availability deployments, run the command on one node only.
    # odacli create-backupconfig -n nfsbkup -w 10 -d NFS -c /u01/nfs_backup
  2. Associate the backup configuration with the database:
    # odacli modify-database -in test_db -bin nfsbkup

Configuring Oracle Data Guard using ODACLI commands

Follow these steps:

  1. Take a backup of your primary database to Object Store or External FRA (NFS) with the -ka option to keep archivelogs after backup.
    # odacli create-backup --backupType Regular-L0 -in primary_DB -ka
    For example:
    # odacli create-backup --backupType Regular-L0 -in test_db -ka
  2. Save the backup report:
    # odacli describe-backupreport -i eba406c7-ae46-4d1d-a1e5-3e985397b171 > backup_report_test_db_0620.json

    The backup report ID is the ID of the backup created in step 1 and can be obtained by running the odacli list-backupreports command.

  3. Copy the backup report to the standby system and restore the backup to a standby database.
    # odacli irestore-database -ro STANDBY

    If you want to use Object Store, then specify the Object Store location:

    # odacli irestore-database -r backup_report.json -u dbUniqueName -on objectStoreName -bp -ro STANDBY
    Rman Backup Encryption Password(s). Multiple passwords needs to be comma separated.:
    Password for SYS user:

    In the above command, specify the dbUniqueName of the standby system.

    If your backup option is NFS, then specify the NFS location:

    odacli irestore-database -r backup_report.json -u dbUniqueName -ro STANDBY
    Password for SYS user:
  4. Copy the trust store file of the standby machine to the primary machine, and set the file permissions to 400.
    # scp root@standby_host:/opt/oracle/dcs/dcscli/dcscli.conf /opt/oracle/dcs/dcscli/dcscli.conf.standby_host_name
    # chmod 400 /opt/oracle/dcs/dcscli/dcscli.conf.standby_host_name
  5. Configure Oracle Data Guard, by running the odacli configure-dataguard command on the primary system. Provide the values for your configuration through the interactive command line interface.
    In the interactive CLI configuration steps, the parameters are as follows:
    • Standby site address is IP address or host name of the standby host. Provide the fully qualified domain name and hostname if the primary and the standby systems are in the same domain and DNS is configured.
    • The TrustStore_password is the value in the TrustStorePassword field in the /opt/oracle/dcs/dcscli/dcscli.conf file on the standby system.
    • Select Oracle Data Guard protection modes to meet availability, performance and data protection requirements. Oracle Data Guard Protection Modes are Maximum Availability, Maximum Performance, and Maximum Protection. The log transport modes are ASYNC, SYNC, and FASTSYNC.

      You can select the following combinations of protection modes and transport types:

    Table 12-1 Oracle Data Guard protection modes and transport modes

    Protection Mode \ Transport Type ASYNC FASTSYNC** SYNC
    MAXPERFORMANCE Y* Y Y
    MAXAVAILABILITY N Y Y*
    MAXPROTECTION N N Y*

    * in the table indicates the default supported pair and ** FASTSYNC mode is available only in Oracle Database 12.1 or later.

    # odacli configure-dataguard
    Standby site address: test_domain
    BUI username for Standby site (default: oda-admin): 
    BUI password for Standby site: 
    TrustStore path for Standby DCS server: /cacerts.a
    TrustStore password for Standby DCS server: TrustStore_Password
    Database name for Data Guard configuration: cpub
    Primary database syspassword: 
    *******************************************************************************************
    Data Guard default settings
    Primary site network for Data Guard configuration: Public-network
    Standby site network for Data Guard configuration: Public-network
    Primary database listener port: 1521
    Standby database listener port: 1521
    Transport type: ASYNC
    Protection mode: MAX_PERFORMANCE
    Data Guard configuration name: pcpub_scpub
    Active Data Guard: disabled
    Do you want to edit this Data Guard configuration? (Y/N, default:N): 
    The TrustStore of the Standby site should be removed unless it is necessary for some other purpose. Do you want to delete it? (Y/N, default:Y): n
    As a requirement, Standby database's SYS password will be set to Primary database's after Data Guard configuration. Are you sure you want to proceed with Data Guard configuration? (Y/N): y
    *******************************************************************************************
    Configure Data Guard pcpub_scpub started
    *******************************************************************************************
    Step 1: Validate Data Guard configuration request (Primary site)
    Description: Validate DG Config Creation
    Job ID: bafb8ef4-d3c9-4421-84a1-4c75d73e71a0
    Started August 25, 2020 05:51:20 UTC
    Validate create Data Guard configuration request
    Finished August 25, 2020 05:51:27 UTC
    *******************************************************************************************
    Step 2: Validate Data Guard configuration request (Standby site)
    Description: Validate DG Config Creation
    Job ID: a7b80880-40ab-4dbf-b8be-22717ae87711
    Started August 25, 2020 05:51:27 UTC
    Validate create Data Guard configuration request
    Finished August 25, 2020 05:51:33 UTC
    *******************************************************************************************
    Step 3: Download password file from Primary database (Primary site)
    Description: Download orapwd file from Primary database
    Started August 25, 2020 05:51:33 UTC
    Prepare orapwd file for Primary database cpub
    Finished August 25, 2020 05:51:38 UTC
    *******************************************************************************************
    Step 4: Upload password file to Standby database (Standby site)
    Description: Upload orapwd file to Standby database
    Started August 25, 2020 05:51:38 UTC
    Write orapwd file to Standby database cpub
    Finished August 25, 2020 05:51:47 UTC
    *******************************************************************************************
    Step 5: Configure Primary database (Primary site)
    Description: DG Config service creation - ConfigurePrimary
    Job ID: b6726f76-0a3a-4bb1-8fec-a3eb311531cf
    Started August 25, 2020 05:51:47 UTC
    Configure host DNS on primary env
    Configure Data Guard Tns on primary env
    Enable Data Guard related Db parameters for primary env
    Enable force logging and archivelog mode in primary env
    Enable FlashBack
    Configure network parameters for local listener on primary env
    Restart listener on primary env
    Create services for primary db
    Finished August 25, 2020 05:52:10 UTC
    *******************************************************************************************
    Step 6: Configure Standby database (Standby site)
    Description: DG Config service creation - ConfigureStandby
    Job ID: e6b552be-fef0-4cd6-a61d-81292f957a6e
    Started August 25, 2020 05:52:10 UTC
    Configure Data Guard Tns on standby env
    Configure host DNS on standby env
    Clear Data Guard related Db parameters for standby env
    Enable Data Guard related Db parameters for standby env
    Enable force logging and archivelog mode in standby env
    Populate standby database metadata
    Configure network parameters for local listener on standby env
    Reset Db sizing and hidden parameters for ODA best practice
    Restart Listener on standby env
    Create services for standby db
    Finished August 25, 2020 05:53:40 UTC
    *******************************************************************************************
    Step 7: Configure and enable Data Guard (Primary site)
    Description: DG Config service creation - ConfigureDg
    Job ID: 0b79511f-794a-4bc2-936d-5c651110467f
    Started August 25, 2020 05:53:40 UTC
    Config and enable Data Guard
    Post check Data Guard configuration
    Finished August 25, 2020 05:55:06 UTC
    *******************************************************************************************
    Step 8: Enable Flashback (Standby site)
    Description: DG Config service creation - EnableFlashback
    Job ID: b526445e-67df-4c35-a7ca-8420298b8bd2
    Started August 25, 2020 05:55:06 UTC
    Enable FlashBack
    Finished August 25, 2020 05:55:17 UTC
    *******************************************************************************************
    Step 9: Re-enable Data Guard (Primary site)
    Description: DG Config service creation - ReenableDg
    Job ID: 4833133f-da65-44a9-beb7-2c4d347c9120
    Started August 25, 2020 05:55:23 UTC
    Re-enable Data Guard if inconsistent properties found
    Post check Data Guard configuration
    Finished August 25, 2020 05:55:29 UTC
    *******************************************************************************************
    Step 10: Create Data Guard status (Primary site)
    Description: DG Status service creation - NewDgconfig
    Job ID: 430d0613-bcd3-4e34-9418-c5f4dfddc052
    Started August 25, 2020 05:55:33 UTC
    Create Data Guard status
    Finished August 25, 2020 05:55:37 UTC
    *******************************************************************************************
    Step 11: Create Data Guard status (Standby site)
    Description: DG Status service creation - NewDgconfig
    Job ID: 93bcdd39-657f-4d7c-b893-c50dc5e708c4
    Started August 25, 2020 05:55:40 UTC
    Create Data Guard status
    Finished August 25, 2020 05:55:43 UTC
    *******************************************************************************************
    Configure Data Guard pcpub_scpub completed
    *******************************************************************************************
    Example with Oracle Data Guard custom configuration:
    # odacli configure-dataguard
    Standby site address: test_domain
    BUI username for Standby site (default: oda-admin): 
    BUI password for Standby site: 
    TrustStore path for Standby DCS server: /cacerts.a
    TrustStore password for Standby DCS server: <TrustStore_Password>
    Database name for Data Guard configuration: cpub
    Primary database syspassword: 
    *******************************************************************************************
    Data Guard default settings
    Primary site network for Data Guard configuration: Public-network
    Standby site network for Data Guard configuration: Public-network
    Primary database listener port: 1521
    Standby database listener port: 1521
    Transport type: ASYNC
    Protection mode: MAX_PERFORMANCE
    Data Guard configuration name: pcpub_scpub
    Active Data Guard: disabled
    Do you want to edit this Data Guard configuration? (Y/N, default:N): y
    *******************************************************************************************
    Primary site network for Data Guard configuration [Public-network] (default: Public-network): 
    Standby site network for Data Guard configuration [Public-network] (default: Public-network): 
    Primary database listener port (default: 1521): 
    Standby database listener port (default: 1521): 
    Transport type [ASYNC, FASTSYNC, SYNC] (default: ASYNC): SYNC
    Protection mode [MAX_PROTECTION, MAX_PERFORMANCE, MAX_AVAILABILITY] (default: MAX_PERFORMANCE): MAX_PROTECTION
    Data Guard configuration name (default: pcpub_scpub): custom_pcpub_scpub
    Enable Active Data Guard? (Y/N, default:N): y
    The TrustStore of the Standby site should be removed unless it is necessary for some other purpose. Do you want to delete it? (Y/N, default:Y): n
    As a requirement, Standby database's SYS password will be set to Primary database's after Data Guard configuration. Are you sure you want to proceed with Data Guard configuration? (Y/N): y
    *******************************************************************************************
    Configure Data Guard custom_pcpub_scpub started
    *******************************************************************************************
    Step 1: Validate Data Guard configuration request (Primary site)
    Description: Validate DG Config Creation
    Job ID: 64baff1f-3759-4a63-a203-fc369329cb7e
    Started August 25, 2020 18:07:59 UTC
    Validate create Data Guard configuration request
    Finished August 25, 2020 18:08:05. UTC
    *******************************************************************************************
    Step 2: Validate Data Guard configuration request (Standby site)
    Description: Validate DG Config Creation
    Job ID: 52e5757c-0006-45d5-ac10-40443dbbde24
    Started August 25, 2020 18:08:06 UTC
    Validate create Data Guard configuration request
    Finished August 25, 2020 18:08:12 UTC
    *******************************************************************************************
    Step 3: Download password file from Primary database (Primary site)
    Description: Download orapwd file from Primary database
    Started August 25, 2020 18:08:12 UTC
    Prepare orapwd file for Primary database cpub
    Finished August 25, 2020 18:08:17 UTC
    *******************************************************************************************
    Step 4: Upload password file to Standby database (Standby site)
    Description: Upload orapwd file to Standby database
    Started August 25, 2020 18:08:17 UTC
    Write orapwd file to Standby database cpub
    Finished August 25, 2020 18:08:26 UTC
    *******************************************************************************************
    Step 5: Configure Primary database (Primary site)
    Description: DG Config service creation - ConfigurePrimary
    Job ID: 7f30ee42-3bce-411d-90b3-ac35619f7280
    Started August 25, 2020 18:08:26 UTC
    Configure host DNS on primary env
    Configure Data Guard Tns on primary env
    Enable Data Guard related Db parameters for primary env
    Enable force logging and archivelog mode in primary env
    Enable FlashBack
    Configure network parameters for local listener on primary env
    Restart listener on primary env
    Create services for primary db
    Finished August 25, 2020 18:08:49 UTC
    *******************************************************************************************
    Step 6: Configure Standby database (Standby site)
    Description: DG Config service creation - ConfigureStandby
    Job ID: f071504f-ee2c-4d1d-8cdb-3879c9c27958
    Started August 25, 2020 18:08:49 UTC
    Configure Data Guard Tns on standby env
    Configure host DNS on standby env
    Clear Data Guard related Db parameters for standby env
    Enable Data Guard related Db parameters for standby env
    Enable force logging and archivelog mode in standby env
    Populate standby database metadata
    Configure network parameters for local listener on standby env
    Reset Db sizing and hidden parameters for ODA best practice
    Restart Listener on standby env
    Create services for standby db
    Finished August 25, 2020 18:10:18 UTC
    *******************************************************************************************
    Step 7: Configure and enable Data Guard (Primary site)
    Description: DG Config service creation - ConfigureDg
    Job ID: 6055ad23-0d2a-430a-80fc-f23f4fd3c8ab
    Started August 25, 2020 18:10:19 UTC
    Config and enable Data Guard
    Post check Data Guard configuration
    Finished August 25, 2020 18:11:54 UTC
    *******************************************************************************************
    Step 8: Enable Flashback (Standby site)
    Description: DG Config service creation - EnableFlashback
    Job ID: 33537107-0cb3-41f4-831d-443b6a268591
    Started August 25, 2020 18:11:54 UTC
    Enable FlashBack
    Finished August 25, 2020 18:12:07 UTC
    *******************************************************************************************
    Step 9: Re-enable Data Guard (Primary site)
    Description: DG Config service creation - ReenableDg
    Job ID: 4833133f-da65-44a9-beb7-2c4d347c9120
    Started August 25, 2020 18:12:12 UTC
    Re-enable Data Guard if inconsistent properties found
    Post check Data Guard configuration
    Finished August 25, 2020 18:12:17 UTC
    *******************************************************************************************
    Step 10: Enable Active Data Guard (Standby site)
    Description: DG Config service creation - EnableActivedg
    Job ID: 3117c046-2d71-453d-9950-c85bed19f5f2
    Started August 25, 2020 18:12:19 UTC
    Started
    Open standby db
    Restart standby db
    Finished
    Started August 25, 2020 18:12:21 UTC
    *******************************************************************************************
    Step 11: Create Data Guard status (Primary site)
    Description: DG Status service creation - NewDgconfig
    Job ID: bf3e1a5e-fcf2-414c-a73b-b7350b67acac
    Started August 25, 2020 18:12:22 UTC
    Create Data Guard status
    Finished August 25, 2020 18:12:24 UTC
    *******************************************************************************************
    Step 12: Create Data Guard status (Standby site)
    Description: DG Status service creation - NewDgconfig
    Job ID: 5c2fb574-bd98-4348-9cf1-5900b4613268
    Started August 25, 2020 18:12:28 UTC
    Create Data Guard status
    Finished August 25, 2020 18:12:32 UTC
    *******************************************************************************************
    Configure Data Guard custom_pcpub_scpub completed
    *******************************************************************************************
    You can also specify a JSON file to configure Oracle Data Guard. An example JSON file is described in this topic.
    # odacli configure-dataguard -r configdg_ODA_HA.json 
    Standby machine address: test_domain
    BUI username for Standby machine (default: oda-admin): 
    BUI password for Standby machine: 
    TrustStore path for Standby DCS server (copy from /opt/oracle/dcs/dcscli/dcscli.conf on Standby machine to this machine and set file permissions to 400): /dcscli.conf
    TrustStore password for Standby DCS server: TrustStore_password
    Primary database syspassword: 
    The TrustStore of the Standby machine should be removed unless it is necessary for some other purpose. Do you want to delete it? (Y/N, default:Y): n
    As a requirement, Standby database’s SYS password will be set to Primary database’s after Data Guard configuration. Are you sure you want to proceed? (Y/N): y
    Data Guard configuration for database 'test' started
    *******************************************************************************************
    Step 1: Validate Data Guard configuration request (Primary machine)
    .....

For more information about these command options, see the Oracle Database Appliance Command Line Reference chapter in this guide.

Example JSON for configuring Oracle Data Guard on Oracle Database Appliance

{
  "name": "test1_test7",
  "protectionMode": "MAX_PERFORMANCE",
  "enableFlashback": true,
  "enableActiveDg": false,
  "replicationGroups": [
    {
      "sourceEndPoints": [
        {
          "endpointType": "PRIMARY",
          "hostName": test_domain1",
          "listenerPort": 1521,
          "databaseUniqueName": "test1",
          "ipAddress": "test_IPaddress"
        },
    {
      "endpointType": "PRIMARY",
      "hostName": "test_domain1",
      "listenerPort": 1521,
      "databaseUniqueName": "test1",
      "ipAddress": "test_IPaddress2"
    }
      ],
      "targetEndPoints": [
        {
          "endpointType": "STANDBY",
          "hostName": "test_domain2",
          "listenerPort": 1521,
          "databaseUniqueName": "test7",
          "ipAddress": "test_IPaddress3"
        },
        {
          "endpointType": "STANDBY",
          "hostName": "test_domain2",
          "listenerPort": 1521,
          "databaseUniqueName": "test7",
          "ipAddress": "test_IPaddress4"
        }
      ],
      "transportType": "ASYNC"
    }
  ]
}

Viewing Oracle Data Guard Status on Oracle Database Appliance

View Oracle Data Guard status using ODACLI commands.

Viewing Oracle Data Guard Status using ODACLI commands

Follow these steps:
  • To view the status of primary and standby databases in your Oracle Data Guard configuration, use the following command:
    # odacli list-dataguardstatus
  • To view the status of your specific Oracle Data Guard configuration, use the following command:
    # odacli describe-dataguardstatus -i 5f0ed48a-366d-454c-a389-fe367772dbb7

For more information about these command options, see the Oracle Database Appliance Command Line Reference chapter in this guide.

Performing Oracle Data Guard Operations

Perform failover, switchover, and reinstate operations on Oracle Data Guard using ODACLI commands.

Performing Oracle Data Guard operations using ODACLI commands

Follow these steps:
  • To switch roles between the primary database and standby database in your Oracle Data Guard configuration, run the following command on the primary system:
    # odacli switchover-dataguard -i dg_ID -u standby_db_unique_name_to_switchover

    For example:

    # odacli switchover-dataguard -i 75f23ce0-006a-4aeb-ba6d-b4b60275c19 -u test_db2

    Confirm that the switchover of roles completed successfully:

    # odacli describe-dataguardstatus -i 75f23ce0-006a-4aeb-ba6d-b4b60275c19
  • A failover provides for transitioning a standby database in your configuration to take over the primary database role, if all instances of an Oracle RAC primary database fail, or are unreachable.

    To failover a standby database to the primary database in your Oracle Data Guard configuration, run the following command on your current standby system:

    # odacli failover-dataguard -i dg_ID -u standby_db_unique_name_to_failover_to

    For example:

    # odacli failover-dataguard -i 75f23ce0-006a-4aeb-ba6d-b4b60275c19 -u test_db2

    Confirm that the requested database failover to the new primary database has completed successfully:

    # odacli describe-dataguardstatus -i 75f23ce0-006a-4aeb-ba6d-b4b60275c19
  • To reinstate a failed primary database after a failover and convert it to a new standby database in your Oracle Data Guard configuration, run the following command on your new primary system:

    # odacli reinstate-dataguard -i dg_ID -u db_unique_name_to_reinstate

    For example:

    # odacli reinstate-dataguard -i 75f23ce0-006a-4aeb-ba6d-b4b60275c19 -u test_db2

    Confirm that the requested database is reinstated as a new standby database:

    # odacli describe-dataguardstatus -i 75f23ce0-006a-4aeb-ba6d-b4b60275c19

For more information about these command options, see the Oracle Database Appliance Command Line Reference chapter in this guide.

Creating an Oracle Data Guard Network

Create an Oracle Data Guard network and associate it with a database using ODACLI commands.

Configuring an Oracle Data Guard Network using ODACLI commands

You can configure Oracle Data Guard using a network of type Public, Database, or Dataguard.

Follow these steps:
  1. Create the network:
    # odacli create-network -n btbond1 -t VLAN -p 192.209.10.227 -w Dataguard -no-d -s 255.255.255.240 -v 369 -g 192.209.10.225
  2. View the new network:
    # odacli list-networks
    
    ID                                     Name                 NIC          Interface Type  Subnet Mask        Gateway            VLAN ID  Node Networks          
    -------------------------------------- -------------------- ------------ --------------- ------------------ ------------------ -------- -----------------------
    836cfa4b-5d2c-45e3-a62d-099fc7c57984   Private-network      priv0        INTERNAL        255.255.255.240   [ IP Address on node0:  192.168.16.24 ]
    1a312239-761d-4321-84d2-8da406f21e5c   Public-network       btbond1.359  VLAN            255.255.255.240    10.209.10.65       359  [ IP Address on node0:  192.209.10.69 ]
    f279ac96-5a4a-4b73-86af-1afbdb6ae5d4   vlan369              btbond1.369  VLAN            255.255.255.240    10.209.10.225      369  [ IP Address on node0:  192.209.10.227]
  3. To attach a network of type Dataguard to a database:
    # odacli modify-database -in test_db -an vlan369

For more information about these command options, see the Oracle Database Appliance Command Line Reference chapter in this guide.

Migrating an Oracle Data Guard Database from One System to Another

You can migrate Oracle Data Guard databases using ODACLI commands.

Migrating Oracle Data Guard Database using ODACLI commands

If your database is on an old Oracle Database Appliance hardware model, and you want to move your deployment to a new Oracle Database Appliance hardware, then you can use your Oracle Data Guard configuration on Oracle Database Appliance to migrate from one system to another.

Before you begin:
  • Oracle recommends running the primary and the standby databases on separate Oracle Database Appliance hardware, so ensure that you have at least two separate Oracle Database Appliance machines.
  • The primary and standby systems must be the same Oracle Database Appliance release, and must be on Oracle Database Appliance release 19.8 or later. The instances on the primary and standby databases must have similar configuration for database parameter settings including database version, memory, CPU, networking, and storage (Oracle ASM or Oracle ACFS), thus avoiding any unpredictability when the databases switch roles.
  • If you have customized the operating system, then ensure that environments on both machines are identical.
  • Ensure that your deployment follows Oracle Maximum Availability Architecture (MAA) best practices.

Follow these steps:

  1. Take a backup of your primary database to Object Store or External FRA (NFS) with the option to keep archivelogs enabled.
    # odacli create-backup primary_DB -ka
    For example:
    # odacli create-backup --backupType Regular-L0 -in test_db -ka
  2. Save the backup report:
    # odacli describe-backupreport -i eba406c7-ae46-4d1d-a1e5-3e985397b171 > backup_report_test_db_0620.json

    The backup report ID is the ID of the backup created in step 1 and can be obtained by running the odacli list-backupreports command.

  3. Copy the backup report to the standby system and restore the backup to a standby database.
    # odacli irestore-database -ro STANDBY

    If your backup option is Object Store, then specify the Object Store location:

    # odacli irestore-database -r backup_report.json -u dbUniqueName -on objectStoreName -bp -ro STANDBY -dh
    Password for SYS user:
    Rman Backup Encryption Password(s). Multiple passwords needs to be comma separated.:

    If your backup option is NFS, then specify the NFS location:

    odacli irestore-database -r backup_report.json -u dbUniqueName -ro STANDBY
    Password for SYS user:
  4. Copy the trust store file of the standby machine to the primary machine, and set the file permissions to 400.
    # scp root@standby_host:/opt/oracle/dcs/dcscli/cacerts/opt/oracle/dcs/dcscli/cacerts.standby_host_name
    # chmod 400 /opt/oracle/dcs/dcscli/cacerts.standby_host_name
  5. Configure Oracle Data Guard, by running the following command on the primary system:
    # odacli configure-dataguard
    Standby site address: test_domain
    BUI username for Standby site (default: oda-admin): 
    BUI password for Standby site: 
    TrustStore path for Standby DCS server: /cacerts.a
    TrustStore password for Standby DCS server: <TrustStore_Password>
    Database name for Data Guard configuration: cpub
    Primary database syspassword: 
    ***********************************************************************************
    Data Guard default settings
    Primary site network for Data Guard configuration: Public-network
    Standby site network for Data Guard configuration: Public-network
    Primary database listener port: 1521
    Standby database listener port: 1521
    Transport type: ASYNC
    Protection mode: MAX_PERFORMANCE
    Data Guard configuration name: pcpub_scpub
    Active Data Guard: disabled
    Do you want to edit this Data Guard configuration? (Y/N, default:N): 
    The TrustStore of the Standby site should be removed unless it is necessary for some other purpose. Do you want to delete it? (Y/N, default:Y): n
    As a requirement, Standby database's SYS password will be set to Primary database's after Data Guard configuration. Are you sure you want to proceed with Data Guard configuration? (Y/N): y
    *******************************************************************************************
    Configure Data Guard pcpub_scpub started
    *******************************************************************************************
    Step 1: Validate Data Guard configuration request (Primary site)
    Description: Validate DG Config Creation
    Job ID: bafb8ef4-d3c9-4421-84a1-4c75d73e71a0
    Started August 25, 2020 05:51:20 UTC
    Validate create Data Guard configuration request
    Finished August 25, 2020 05:51:27 UTC
    *******************************************************************************************
    Step 2: Validate Data Guard configuration request (Standby site)
    Description: Validate DG Config Creation
    Job ID: a7b80880-40ab-4dbf-b8be-22717ae87711
    Started August 25, 2020 05:51:27 UTC
    Validate create Data Guard configuration request
    Finished August 25, 2020 05:51:33 UTC
    *******************************************************************************************
    Step 3: Download password file from Primary database (Primary site)
    Description: Download orapwd file from Primary database
    Started August 25, 2020 05:51:33 UTC
    Prepare orapwd file for Primary database cpub
    Finished August 25, 2020 05:51:38 UTC
    *******************************************************************************************
    Step 4: Upload password file to Standby database (Standby site)
    Description: Upload orapwd file to Standby database
    Started August 25, 2020 05:51:38 UTC
    Write orapwd file to Standby database cpub
    Finished August 25, 2020 05:51:47 UTC
    *******************************************************************************************
    Step 5: Configure Primary database (Primary site)
    Description: DG Config service creation - ConfigurePrimary
    Job ID: b6726f76-0a3a-4bb1-8fec-a3eb311531cf
    Started August 25, 2020 05:51:47 UTC
    Configure host DNS on primary env
    Configure Data Guard Tns on primary env
    Enable Data Guard related Db parameters for primary env
    Enable force logging and archivelog mode in primary env
    Enable FlashBac
    Configure network parameters for local listener on primary env
    Restart listener on primary env
    Create services for primary db
    Finished August 25, 2020 05:52:10 UTC
    *******************************************************************************************
    Step 6: Configure Standby database (Standby site)
    Description: DG Config service creation - ConfigureStandby
    Job ID: e6b552be-fef0-4cd6-a61d-81292f957a6e
    Started August 25, 2020 05:52:10 UTC
    Configure Data Guard Tns on standby env
    Configure host DNS on standby env
    Clear Data Guard related Db parameters for standby env
    Enable Data Guard related Db parameters for standby env
    Enable force logging and archivelog mode in standby env
    Populate standby database metadata
    Configure network parameters for local listener on standby env
    Reset Db sizing and hidden parameters for ODA best practice
    Restart Listener on standby env
    Create services for standby db
    Finished August 25, 2020 05:53:40 UTC
    *******************************************************************************************
    Step 7: Configure and enable Data Guard (Primary site)
    Description: DG Config service creation - ConfigureDg
    Job ID: 0b79511f-794a-4bc2-936d-5c651110467f
    Started August 25, 2020 05:53:40 UTC
    Config and enable Data Guard
    Post check Data Guard configuration
    Finished August 25, 2020 05:55:06 UTC
    *******************************************************************************************
    Step 8: Enable Flashback (Standby site)
    Description: DG Config service creation - EnableFlashback
    Job ID: b526445e-67df-4c35-a7ca-8420298b8bd2
    Started August 25, 2020 05:55:06 UTC
    Enable FlashBack
    Finished August 25, 2020 05:55:17 UTC
    *******************************************************************************************
    Step 9: Re-enable Data Guard (Primary site)
    Description: DG Config service creation - ReenableDg
    Job ID: 4833133f-da65-44a9-beb7-2c4d347c9120
    Started August 25, 2020 05:55:23 UTC
    Re-enable Data Guard if inconsistent properties found
    Post check Data Guard configuration
    Finished August 25, 2020 05:55:29 UTC
    *******************************************************************************************
    Step 10: Create Data Guard status (Primary site)
    Description: DG Status service creation - NewDgconfig
    Job ID: 430d0613-bcd3-4e34-9418-c5f4dfddc052
    Started August 25, 2020 05:55:33 UTC
    Create Data Guard status
    Finished August 25, 2020 05:55:37 UTC
    *******************************************************************************************
    Step 11: Create Data Guard status (Standby site)
    Description: DG Status service creation - NewDgconfig
    Job ID: 93bcdd39-657f-4d7c-b893-c50dc5e708c4
    Started August 25, 2020 05:55:40 UTC
    Create Data Guard status
    Finished August 25, 2020 05:55:43 UTC
    *******************************************************************************************
    Configure Data Guard pcpub_scpub completed
    *******************************************************************************************

    Note: The TrustStore_password is the value in the TrustStorePassword field in the /opt/oracle/dcs/dcscli/dcscli.conf file on the standby system.

  6. Check the status of Oracle Data Guard and ensure it is working:
    # odacli describe-dataguardstatus 
  7. Switch over to the standby database:
    # odacli switchover-dataguard -i 75f23ce0-006a-4aeb-ba6d-b4b60275c19 -u houdg02 
  8. Deconfigure Oracle Data Guard. The process also deletes the standby database on the old Oracle Database Appliance hardware machine.
    # odacli deconfigure-dataguard -i 8396aac4-f7e7-42e4-a2e8-0cbbc89ce31b
    Standby site address: test_domain
    BUI username for Standby site (default: oda-admin): 
    BUI password for Standby site: 
    TrustStore path for Standby DCS server : /cacerts.a
    TrustStore password for Standby DCS server: TrustStore_Password
    The TrustStore of the Standby site should be removed unless it is necessary for some other purpose. Do you want to delete it? (Y/N, default:Y): n
    Standby database will be deleted after Data Guard configuration is removed. Are you sure you want to proceed? (Y/N): y
    Deconfigure Dataguard Started
    *******************************************************************************************
    Step 1: Deconfigure Data Guard (Primary site)
    Description: Deconfigure DG service
    Job ID: 8deb3e4c-09cd-4593-8184-f7706dd2ec8a
    Started
    Deconfigure Data Guard service
    Cleanup broker resources
    Finished
    *******************************************************************************************
    Step 2: Delete Data Guard status (Primary site)
    Description: DG Status service creation - UpdateDgconfig
    Job ID: 59c61629-6c7d-474c-8c29-c0a9565d91a3
    Started
    Update Data Guard status
    Finished
    *******************************************************************************************
    Step 3: Delete Data Guard status (Standby site)
    Description: DG Status service creation - UpdateDgconfig
    Job ID: 93dcf4cd-1019-4bcd-984a-d3efeb3fae6e
    Started
    Update Data Guard status
    Finished
    *******************************************************************************************
    Step 4: Delete Standby database (Standby site)
    Description: Database service deletion with db name: panda with id : 30dd49da-a54f-4a9a-abbf-d3a4e39abee5
    Job ID: 0b1cb921-fd41-4e01-86df-beff3adb6de0
    Started
    Validate db 30dd49da-a54f-4a9a-abbf-d3a4e39abee5 for deletion
    Database Deletion
    Unregister Db From Cluster
    Kill Pmon Process
    Database Files Deletion
    Deleting Volume
    Delete File Groups of Database panda
    Finished
    *******************************************************************************************
    Data Guard configuration is removed

For more information about these command options, see the Oracle Database Appliance Command Line Reference chapter in this guide.

Patching Oracle Data Guard Databases on Oracle Database Appliance

Understand how you can patch primary and standby databases on Oracle Data Guard using ODACLI commands.

Patching Oracle Data Guard primary and standby databases using ODACLI commands

Before patching the database homes, upload the RDBMS Clone Files for the database version, to the repository. See Updating Oracle Database Appliance Repository with Database Clone Files Using the CLI for the procedure to update the repository with the latest RDBMS Clone Files. Also ensure that the primary Oracle Database Appliance system and the standby Oracle Database Appliance system are on the same Oracle Database Appliance release. It is recommended that the two systems be on the latest Oracle Database Appliance release. See Patching Oracle Database Appliance Bare Metal Systems Using the Command-Line for the procedure to patch your Oracle Database Appliance deployment.

Follow these steps to patch the databases in your Oracle Data Guard configuration on Oracle Database Appliance:
  1. Run the following command on the standby database:
    # odacli update-dbhome
  2. After patching job on the standby database is successful, run the following command on the primary database:
    # odacli update-dbhome
  3. Confirm that the patching jobs are successful:
    # /opt/oracle/dcs/bin/odacli list-jobs
  4. Confirm the existing Data Guard configuration is working properly by running the following command on both primary and standby systems:
    odacli describe-dataguardstatus -i dgid

For more information about these command options, see the Oracle Database Appliance Command Line Reference chapter in this guide.

Upgrading Oracle Data Guard Databases on Oracle Database Appliance

Understand how you can upgrade primary and standby databases on Oracle Data Guard using ODACLI commands.

Upgrading Oracle Data Guard primary and standby databases using ODACLI commands

Before upgrading the database homes, upload the RDBMS Clone Files for the database version, to the repository. See Updating Oracle Database Appliance Repository with Database Clone Files Using the CLI for the procedure to update the repository with the latest RDBMS Clone Files. Ensure that the primary Oracle Database Appliance system and the standby Oracle Database Appliance system are on the same Oracle Database Appliance release, and on Oracle Database Appliance release 19.8 or later. It is recommended that the two systems be on the latest Oracle Database Appliance release. See Patching Oracle Database Appliance Bare Metal Systems Using the Command-Line for the procedure to patch your Oracle Database Appliance deployment.

Follow these steps to upgrade the databases in your Oracle Data Guard configuration on Oracle Database Appliance:
  1. Run the following command to disable log transport and apply:
    EDIT DATABASE primary_database SET STATE=‘TRANSPORT-OFF’;
    EDIT DATABASE standby_database SET STATE=‘APPLY-OFF’;
  2. Upgrade the standby database:
    # odacli upgrade-database -i standby_databaseId -to destination_DbHomeId
  3. Upgrade the primary database:
    # odacli upgrade-database -i primary_databaseId -to destination_DbHomeId
  4. Run the following command to enable log transport and apply:
    EDIT DATABASE primary_database SET STATE=‘TRANSPORT-ON’;
    EDIT DATABASE standby_database SET STATE=‘APPLY-ON’;
  5. Confirm the existing Data Guard configuration is working properly by running the following command on both primary and standby systems several times:
    odacli describe-dataguardstatus -i dgid

For more information about these command options, see the Oracle Database Appliance Command Line Reference chapter in this guide.

Enabling Oracle Active Data Guard on Existing Configurations

Understand how you can enable Oracle Active Data Guard on existing configurations.

Oracle Active Data Guard is licensed option to the Oracle Database Enterprise Edition and enables advanced capabilities that extend the basic Oracle Data Guard functionality.

Oracle Active Data Guard function requires database to be open as read-only while enabling the redo log apply option. Follow these steps to enable Oracle Active Data Guard on existing configurations:
  1. Modify database to have read-only start option:
    srvctl modify database -d standby_db_unique_name -startoption "read only" 
    srvctl stop database -d standby_db_unique_name 
    srvctl start database -d standby_db_unique_name 

    To check if Oracle Data Guard has read-only start option set, run the following command:

    srvctl config database -d standby_db_unique_name | grep "Start options"
  2. Enable redo log apply by running the following PL/SQL commands:
    ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; 
    ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Deconfiguring Oracle Data Guard on Oracle Database Appliance

Deconfigure Oracle Data Guard status using ODACLI commands.

Deconfiguring Oracle Data Guard Status using ODACLI commands

Follow these steps:
  • To deconfigure Oracle Data Guard and delete the standby database, run the following command on the primary system:
    # odacli deconfigure-dataguard -i 8396aac4-f7e7-42e4-a2e8-0cbbc89ce31b
    Standby site address: test_domain
    BUI username for Standby site (default: oda-admin): 
    BUI password for Standby site: 
    TrustStore path for Standby DCS server : /cacerts.a
    TrustStore password for Standby DCS server: TrustStore_Password
    The TrustStore of the Standby site should be removed unless it is necessary for some other purpose. Do you want to delete it? (Y/N, default:Y): n
    Standby database will be deleted after Data Guard configuration is removed. Are you sure you want to proceed? (Y/N): y
    Deconfigure Dataguard Started
    *******************************************************************************************
    Step 1: Deconfigure Data Guard (Primary site)
    Description: Deconfigure DG service
    Job ID: 8deb3e4c-09cd-4593-8184-f7706dd2ec8a
    Started
    Deconfigure Data Guard service
    Cleanup broker resources
    Finished
    *******************************************************************************************
    Step 2: Delete Data Guard status (Primary site)
    Description: DG Status service creation - UpdateDgconfig
    Job ID: 59c61629-6c7d-474c-8c29-c0a9565d91a3
    Started
    Update Data Guard status
    Finished
    *******************************************************************************************
    Step 3: Delete Data Guard status (Standby site)
    Description: DG Status service creation - UpdateDgconfig
    Job ID: 93dcf4cd-1019-4bcd-984a-d3efeb3fae6e
    Started
    Update Data Guard status
    Finished
    *******************************************************************************************
    Step 4: Delete Standby database (Standby site)
    Description: Database service deletion with db name: panda with id : 30dd49da-a54f-4a9a-abbf-d3a4e39abee5
    Job ID: 0b1cb921-fd41-4e01-86df-beff3adb6de0
    Started
    Validate db 30dd49da-a54f-4a9a-abbf-d3a4e39abee5 for deletion
    Database Deletion
    Unregister Db From Cluster
    Kill Pmon Process
    Database Files Deletion
    Deleting Volume
    Delete File Groups of Database panda
    Finished
    *******************************************************************************************
    Data Guard configuration is removed

    For deconfiguring Oracle Data Guard, you must specify the Oracle Data Guard Configuration ID. Run the odacli list-dataguardstatus command to find the Oracle Data Guard Configuration ID.

For more information about these command options, see the Oracle Database Appliance Command Line Reference chapter in this guide.