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.

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. 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.
    • 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
    root@test_domain's password:
    BUI username for Standby site (default: oda-admin):
    BUI password for Standby site:
    Database name for Data Guard configuration: test_db
    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: test_dg
    Active Data Guard: disabled
    Do you want to edit this Data Guard configuration? (Y/N, default: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 test_dg started
    *******************************************************************************************
    Step 1: Validate Data Guard configuration request (Primary site)
    Description: Validate DG Config Creation for db test_db
    Job ID: 523a38ac-e641-46e2-bf38-ecfb641e5dc9
    Started December 08, 2020 21:08:59 PM UTC
    Validate create Data Guard configuration request
    Finished December 08, 2020 21:09:02 PM UTC
    *******************************************************************************************
    Step 2: Validate Data Guard configuration request (Standby site)
    Description: Validate DG Config Creation for db test_db
    Job ID: 712843f9-65ca-4aea-95eb-4e5c461f3672
    Started December 08, 2020 21:09:03 PM UTC
    Validate create Data Guard configuration request
    Finished December 08, 2020 21:09:05 PM UTC
    *******************************************************************************************
    Step 3: Download password file from Primary database (Primary site)
    Description: Download orapwd file from Primary database
    Started December 08, 2020 21:09:05 PM UTC
    Prepare orapwd file for Primary database test_db
    Finished December 08, 2020 21:09:10 PM UTC
    *******************************************************************************************
    Step 4: Upload password file to Standby database (Standby site)
    Description: Upload orapwd file to Standby database
    Started December 08, 2020 21:09:10 PM UTC
    Write orapwd file to Standby database test_db
    Finished December 08, 2020 21:09:19 PM UTC
    *******************************************************************************************
    Step 5: Configure Primary database (Primary site)
    Description: DG Config service for db test_db - ConfigurePrimary
    Job ID: ad8486a2-bea6-47ff-a8ab-330be98987ab
    Started December 08, 2020 21:09:19 PM 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 December 08, 2020 21:09:35 PM UTC
    *******************************************************************************************
    Step 6: Configure Standby database (Standby site)
    Description: DG Config service for db test_db - ConfigureStandby
    Job ID: 47876bb8-8fef-41a6-a0b6-92b184c74900
    Started December 08, 2020 21:09:37 PM 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 December 08, 2020 21:11:02 PM UTC
    *******************************************************************************************
    Step 7: Configure and enable Data Guard (Primary site)
    Description: DG Config service for db test_db - ConfigureDg
    Job ID: 64674e50-3eea-48d0-a25e-bc61401a3d71
    Started December 08, 2020 21:11:02 PM UTC
    Config and enable Data Guard
    Post check Data Guard configuration
    Finished December 08, 2020 21:12:21 PM UTC
    *******************************************************************************************
    Step 8: Enable Flashback (Standby site)
    Description: DG Config service for db test_db - EnableFlashback
    Job ID: 6f461b2f-88e1-41bf-9ca8-d91bc7d4bf97
    Started December 08, 2020 21:12:22 PM UTC
    Enable FlashBack
    Finished December 08, 2020 21:12:33 PM UTC
    *******************************************************************************************
    Step 9: Re-enable Data Guard (Primary site)
    Description: DG Config service for db test_db - ReenableDg
    Job ID: 3a4a404d-e1b5-4c4e-9db1-545676eebc77
    Started December 08, 2020 21:12:34 PM UTC
    Re-enable Data Guard if inconsistent properties found
    Post check Data Guard configuration
    Finished December 08, 2020 21:12:36 PM UTC
    *******************************************************************************************
    Step 10: Create Data Guard status (Primary site)
    Description: DG Status service for db test_db - NewDgconfig
    Job ID: 572dea8d-5682-4193-a984-0aebb072be45
    Started December 08, 2020 21:12:36 PM UTC
    Create Data Guard status
    Finished December 08, 2020 21:12:39 PM UTC
    *******************************************************************************************
    Step 11: Create Data Guard status (Standby site)
    Description: DG Status service for db test_db - NewDgconfig
    Job ID: 75e55d7f-49c3-4e2d-8907-a7130cc05034
    Started December 08, 2020 21:12:40 PM UTC
    Create Data Guard status
    Finished December 08, 2020 21:12:41 PM UTC
    *******************************************************************************************
    Configure Data Guard test_dg completed
    *******************************************************************************************
    Example with Oracle Data Guard custom configuration:
    # odacli configure-dataguard
    Standby site address: test_domain
    root@test_db's password:
    BUI username for Standby site (default: oda-admin):
    BUI password for Standby site:
    Database name for Data Guard configuration: test_db
    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: test_dg
    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_test_dg
    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
    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_test_dg started
    *******************************************************************************************
    Step 1: Validate Data Guard configuration request (Primary site)
    Description: Validate DG Config Creation for db test_db
    Job ID: 523a38ac-e641-46e2-bf38-ecfb641e5dc9
    Started December 08, 2020 21:08:59 PM UTC
    Validate create Data Guard configuration request
    Finished December 08, 2020 21:09:02 PM UTC
    *******************************************************************************************
    Step 2: Validate Data Guard configuration request (Standby site)
    Description: Validate DG Config Creation for db test_db
    Job ID: 712843f9-65ca-4aea-95eb-4e5c461f3672
    Started December 08, 2020 21:09:03 PM UTC
    Validate create Data Guard configuration request
    Finished December 08, 2020 21:09:05 PM UTC
    *******************************************************************************************
    Step 3: Download password file from Primary database (Primary site)
    Description: Download orapwd file from Primary database
    Started December 08, 2020 21:09:05 PM UTC
    Prepare orapwd file for Primary database test_db
    Finished December 08, 2020 21:09:10 PM UTC
    *******************************************************************************************
    Step 4: Upload password file to Standby database (Standby site)
    Description: Upload orapwd file to Standby database
    Started December 08, 2020 21:09:10 PM UTC
    Write orapwd file to Standby database test_db
    Finished December 08, 2020 21:09:19 PM UTC
    *******************************************************************************************
    Step 5: Configure Primary database (Primary site)
    Description: DG Config service creation for db test_db - ConfigurePrimary
    Job ID: ad8486a2-bea6-47ff-a8ab-330be98987ab
    Started December 08, 2020 21:09:19 PM 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 December 08, 2020 21:09:35 PM UTC
    *******************************************************************************************
    Step 6: Configure Standby database (Standby site)
    Description: DG Config service creation for db test_db - ConfigureStandby
    Job ID: 47876bb8-8fef-41a6-a0b6-92b184c74900
    Started December 08, 2020 21:09:37 PM 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 December 08, 2020 21:11:02 PM UTC
    *******************************************************************************************
    Step 7: Configure and enable Data Guard (Primary site)
    Description: DG Config service creation for db test_db - ConfigureDg
    Job ID: 64674e50-3eea-48d0-a25e-bc61401a3d71
    Started December 08, 2020 21:11:02 PM UTC
    Config and enable Data Guard
    Post check Data Guard configuration
    Finished December 08, 2020 21:12:21 PM UTC
    *******************************************************************************************
    Step 8: Enable Flashback (Standby site)
    Description: DG Config service creation for db test_db - EnableFlashback
    Job ID: 6f461b2f-88e1-41bf-9ca8-d91bc7d4bf97
    Started December 08, 2020 21:12:22 PM UTC
    Enable FlashBack
    Finished December 08, 2020 21:12:33 PM UTC
    *******************************************************************************************
    Step 9: Re-enable Data Guard (Primary site)
    Description: DG Config service creation for db test_db - ReenableDg
    Job ID: 3a4a404d-e1b5-4c4e-9db1-545676eebc77
    Started December 08, 2020 21:12:34 PM UTC
    Re-enable Data Guard if inconsistent properties found
    Post check Data Guard configuration
    Finished December 08, 2020 21:12:36 PM UTC
    *******************************************************************************************
    Step 10: Enable Active Data Guard (Standby site)
    Description: DG Config service creation for db test_db - EnableActivedg
    Job ID: 3117c046-2d71-453d-9950-c85bed19f5f2
    Started December 08, 2020 21:12:38 PM UTC
    Started
    Open standby db
    Restart standby db
    Finished December 08, 2020 21:12:45 PM UTC
    *******************************************************************************************
    Step 11: Create Data Guard status (Primary site)
    Description: DG Status service creation for db test_db - NewDgconfig
    Job ID: 572dea8d-5682-4193-a984-0aebb072be45
    Started December 08, 2020 21:12:46 PM UTC
    Create Data Guard status
    Finished December 08, 2020 21:12:49 PM UTC
    *******************************************************************************************
    Step 12: Create Data Guard status (Standby site)
    Description: DG Status service creation for db test_db - NewDgconfig
    Job ID: 75e55d7f-49c3-4e2d-8907-a7130cc05034
    Started December 08, 2020 21:12:52 PM UTC
    Create Data Guard status
    Finished December 08, 2020 21:12:55 PM UTC
    *******************************************************************************************
    Configure Data Guard custom_test_dg 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: 
    Primary database syspassword: 
    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. Configure Oracle Data Guard, by running the following command on the primary system:
    # odacli configure-dataguard
    Standby site address: test_domain
    root@test_domain's password:
    BUI username for Standby site (default: oda-admin):
    BUI password for Standby site:
    Database name for Data Guard configuration: test_db
    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: test_dg
    Active Data Guard: disabled
    Do you want to edit this Data Guard configuration? (Y/N, default: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 test_dg started
    *******************************************************************************************
    Step 1: Validate Data Guard configuration request (Primary site)
    Description: Validate DG Config Creation for db test_db
    Job ID: 523a38ac-e641-46e2-bf38-ecfb641e5dc9
    Started December 08, 2020 21:08:59 PM UTC
    Validate create Data Guard configuration request
    Finished December 08, 2020 21:09:02 PM UTC
    *******************************************************************************************
    Step 2: Validate Data Guard configuration request (Standby site)
    Description: Validate DG Config Creation for db test_db
    Job ID: 712843f9-65ca-4aea-95eb-4e5c461f3672
    Started December 08, 2020 21:09:03 PM UTC
    Validate create Data Guard configuration request
    Finished December 08, 2020 21:09:05 PM UTC
    *******************************************************************************************
    Step 3: Download password file from Primary database (Primary site)
    Description: Download orapwd file from Primary database
    Started December 08, 2020 21:09:05 PM UTC
    Prepare orapwd file for Primary database test_db
    Finished December 08, 2020 21:09:10 PM UTC
    *******************************************************************************************
    Step 4: Upload password file to Standby database (Standby site)
    Description: Upload orapwd file to Standby database
    Started December 08, 2020 21:09:10 PM UTC
    Write orapwd file to Standby database test_db
    Finished December 08, 2020 21:09:19 PM UTC
    *******************************************************************************************
    Step 5: Configure Primary database (Primary site)
    Description: DG Config service creation for db test_db - ConfigurePrimary
    Job ID: ad8486a2-bea6-47ff-a8ab-330be98987ab
    Started December 08, 2020 21:09:19 PM 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 December 08, 2020 21:09:35 PM UTC
    *******************************************************************************************
    Step 6: Configure Standby database (Standby site)
    Description: DG Config service creation for db test_db - ConfigureStandby
    Job ID: 47876bb8-8fef-41a6-a0b6-92b184c74900
    Started December 08, 2020 21:09:37 PM 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 December 08, 2020 21:11:02 PM UTC
    *******************************************************************************************
    Step 7: Configure and enable Data Guard (Primary site)
    Description: DG Config service creation for db test_db - ConfigureDg
    Job ID: 64674e50-3eea-48d0-a25e-bc61401a3d71
    Started December 08, 2020 21:11:02 PM UTC
    Config and enable Data Guard
    Post check Data Guard configuration
    Finished December 08, 2020 21:12:21 PM UTC
    *******************************************************************************************
    Step 8: Enable Flashback (Standby site)
    Description: DG Config service creation for db test_db - EnableFlashback
    Job ID: 6f461b2f-88e1-41bf-9ca8-d91bc7d4bf97
    Started December 08, 2020 21:12:22 PM UTC
    Enable FlashBack
    Finished December 08, 2020 21:12:33 PM UTC
    *******************************************************************************************
    Step 9: Re-enable Data Guard (Primary site)
    Description: DG Config service creation for db test_db - ReenableDg
    Job ID: 3a4a404d-e1b5-4c4e-9db1-545676eebc77
    Started December 08, 2020 21:12:34 PM UTC
    Re-enable Data Guard if inconsistent properties found
    Post check Data Guard configuration
    Finished December 08, 2020 21:12:36 PM UTC
    *******************************************************************************************
    Step 10: Create Data Guard status (Primary site)
    Description: DG Status service creation for db test_db - NewDgconfig
    Job ID: 572dea8d-5682-4193-a984-0aebb072be45
    Started December 08, 2020 21:12:36 PM UTC
    Create Data Guard status
    Finished December 08, 2020 21:12:39 PM UTC
    *******************************************************************************************
    Step 11: Create Data Guard status (Standby site)
    Description: DG Status service creation for db test_db - NewDgconfig
    Job ID: 75e55d7f-49c3-4e2d-8907-a7130cc05034
    Started December 08, 2020 21:12:40 PM UTC
    Create Data Guard status
    Finished December 08, 2020 21:12:41 PM UTC
    *******************************************************************************************
    Configure Data Guard test_dg completed
    *******************************************************************************************
  5. Check the status of Oracle Data Guard and ensure it is working:
    # odacli describe-dataguardstatus 
  6. Switch over to the standby database:
    # odacli switchover-dataguard -i 75f23ce0-006a-4aeb-ba6d-b4b60275c19 -u houdg02 
  7. 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
    root@test_domain's password:
    BUI username for Standby site (default: oda-admin): 
    BUI password for Standby site: 
    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: d181fa4b-5bc9-431f-8f83-75ff44c934ff
    Started December 09, 2020 18:59:17 PM UTC
    Deconfigure Data Guard service
    Cleanup broker resources
    Finished December 09, 2020 19:00:14 PM UTC
    *******************************************************************************************
    Step 2: Delete Data Guard status (Primary site)
    Description: DG Status service creation - UpdateDgconfig
    Job ID: 2873f1f2-9355-4cd2-8245-893957ba5d48
    Started December 09, 2020 19:00:14 PM UTC
    Update Data Guard status
    Finished December 09, 2020 19:00:14 PM UTC
    *******************************************************************************************
    Step 3: Delete Data Guard status (Standby site)
    Description: DG Status service creation - UpdateDgconfig
    Job ID: c4bdf567-6525-49f1-b59c-75866e3ce207
    Started December 09, 2020 19:00:15 PM UTC
    Update Data Guard status
    Finished December 09, 2020 19:00:16 PM UTC
    *******************************************************************************************
    Step 4: Delete Standby database (Standby site)
    Description: Database service deletion with db name: test_db with id : d8006215-bbd3-41d0-a37e-a4181adef042
    Job ID: e207cac9-4f96-46fa-b120-462ae877bdc1
    Started December 09, 2020 19:00:19 PM UTC
    Validate db d8006215-bbd3-41d0-a37e-a4181adef042 for deletion
    Database Deletion By RHP
    Unregister Db From Cluster
    Kill Pmon Process
    Database Files Deletion
    Delete File Groups of Database test_db
    Finished December 09, 2020 19:01:07 PM UTC
    *******************************************************************************************
    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
    root@test_domain's password: 
    BUI username for Standby site (default: oda-admin): 
    BUI password for Standby site: 
    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: d181fa4b-5bc9-431f-8f83-75ff44c934ff
    Started December 09, 2020 18:59:17 PM UTC
    Deconfigure Data Guard service
    Cleanup broker resources
    Finished December 09, 2020 19:00:14 PM UTC
    *******************************************************************************************
    Step 2: Delete Data Guard status (Primary site)
    Description: DG Status service creation - UpdateDgconfig
    Job ID: 2873f1f2-9355-4cd2-8245-893957ba5d48
    Started December 09, 2020 19:00:14 PM UTC
    Update Data Guard status
    Finished December 09, 2020 19:00:14 PM UTC
    *******************************************************************************************
    Step 3: Delete Data Guard status (Standby site)
    Description: DG Status service creation - UpdateDgconfig
    Job ID: c4bdf567-6525-49f1-b59c-75866e3ce207
    Started December 09, 2020 19:00:15 PM UTC
    Update Data Guard status
    Finished December 09, 2020 19:00:16 PM UTC
    *******************************************************************************************
    Step 4: Delete Standby database (Standby site)
    Description: Database service deletion with db name: test_db with id : d8006215-bbd3-41d0-a37e-a4181adef042
    Job ID: e207cac9-4f96-46fa-b120-462ae877bdc1
    Started December 09, 2020 19:00:19 PM UTC
    Validate db d8006215-bbd3-41d0-a37e-a4181adef042 for deletion
    Database Deletion By RHP
    Unregister Db From Cluster
    Kill Pmon Process
    Database Files Deletion
    Delete File Groups of Database test_db
    Finished December 09, 2020 19:01:07 PM UTC
    *******************************************************************************************
    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.