Infrastructure at your Service

Jérôme Dubar

Configure Data Guard with odacli on ODA

Introduction

I always thought integration of Data Guard was a missing feature on Oracle Database Appliance. For sure, you can configure Data Guard manually as you do on a classic server, but as an appliance, ODA should have proposed an easier way for configuring that. After years of waiting for this feature, it’s now available, and I just tested it. And I’m here to give you my feedback.

Disclaimer

You’ll need 2 ODAs for building such configuration. Data Guard on a single ODA is not supported and wouldn’t make sense.

I did this test on 2 brand new X8-2M ODAs deployed with the latest version 19.9. It should also work starting from 19.8, as it was the first version to include this feature.

The DEMO database used in this test is also version 19.9. I don’t know if it should work with previous versions, it’s probably OK for 18c and 12.2, but I’m not sure for 12.1 and 11.2.

This configuration through odacli is linked to your ODA system configuration, especially regarding the domain. If you do not want to use the db_domain on your primary database and you removed this parameter, you’ll have to know that the standby will anyway be configured with this db_domain inherited from the system’s db domain. And the Data Guard configuration will fail at step 7.

Another piece of advice regarding the use of this feature: you’ll need db_create_online_log_dest_1 parameter to be set. I’m used to remove this parameter to allow multiplexing of the redologs between db_create_file_dest and db_recovery_file_dest (the default behavior when no db_create_online_log_dest_X is configured) but it’s better to use both db_create_online_log_dest_1 and db_create_online_log_dest_2 for using the odacli’s Data Guard feature.

You should be aware that if you already have your own backup configuration without using odacli can be a problem. Make sure to understand that creating a backup configuration for a database with odacli will interfere with your existing backup configuration.

Data Guard configuration is related to a database: you’ll need to apply this procedure for each database for which you want a disaster recovery option.

Data Guard is free of charge on Enterprise Edition, but make sure to never open your standby database in read only mode. For opening a standby database read only while applying the changes from primary, the Active Guard option is needed. Standard Edition does not support Data Guard, but you can use Dbvisit standby as a third party disaster recovery solution.

Finally, I would recommend to test this feature before applying it to your production databases. The goal being to be able to decide if this feature fits your needs or not. You can still configure Data Guard manually as you always did.

Create a backup configuration for your database

If you’re not familiar with backup configuration on ODA, you just need to know that you can manage your backup from odacli. It’s not a new feature, it’s not used very often but it can simplify your job and it relies on RMAN, meaning that it’s reliable.

For configuring Data Guard on ODA you first need to create a backup configuration for your primary. You can do the backup to OCI (the Oracle public Cloud) or nfs, most of us will probably use a classic nfs share. Let’s consider a nfs share /Rback/DEMO for our DEMO database, and a 10-day retention:

odacli create-backupconfig -n nfsRbackDEMO -w 10 -d NFS -c /Rback/DEMO

Backupconfig creation is fast:

odacli describe-job -i "15066dd7-485c-4bd9-9cdb-4259252b9ede"

Job details
----------------------------------------------------------------
                     ID:  15066dd7-485c-4bd9-9cdb-4259252b9ede
            Description:  create backup config:nfsRbackDEMO
                 Status:  Success
                Created:  November 18, 2020 9:06:46 AM CET
                Message:  backup config creation

Task Name                                Start Time                          End Time                            Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Backup config metadata persist           November 18, 2020 9:06:47 AM CET    November 18, 2020 9:06:47 AM CET    Success

Associate the backup config to the database

This backup configuration now needs to be linked to your DEMO database:

odacli modify-database -in DEMO -bin nfsRbackDEMO

odacli describe-job -i "b8f70d11-bc2f-49e2-81e3-5072305302ef"

Job details
----------------------------------------------------------------
                     ID:  b8f70d11-bc2f-49e2-81e3-5072305302ef
            Description:  Modify database : DEMO
                 Status:  Success
                Created:  November 18, 2020 9:14:29 AM CET
                Message:  Modify database

Task Name                                Start Time                          End Time                            Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Validate OMF parameter values            November 18, 2020 9:14:31 AM CET    November 18, 2020 9:14:32 AM CET    Success
update db with backupconfig attributes   November 18, 2020 9:14:39 AM CET    November 18, 2020 9:14:42 AM CET    Success
Enable Database Autobackup               November 18, 2020 9:14:42 AM CET    November 18, 2020 9:14:42 AM CET    Success
Enable Archivelog Autobackup             November 18, 2020 9:14:42 AM CET    November 18, 2020 9:14:42 AM CET    Success
Configure Control file Auto Backup Format November 18, 2020 9:14:42 AM CET    November 18, 2020 9:14:44 AM CET    Success
Backup Current Control file              November 18, 2020 9:14:44 AM CET    November 18, 2020 9:14:50 AM CET    Success
Update metadata for database:DEMO        November 18, 2020 9:14:50 AM CET    November 18, 2020 9:14:50 AM CET    Success

As you can see, applying this backup configuration will change some RMAN parameters, for example the path for the autobackup of the controfile.

Create a first backup of your primary with odacli

Now you can easily take an incremental level 0 backup of your database, an incremental level 0 being actually a full backup. The -ka option is for keeping archivelogs on disk:

odacli create-backup --backupType Regular-L0 -in DEMO -ka

odacli describe-job -i 56a941f7-2f26-4d87-b159-1e02de183db6

Job details
----------------------------------------------------------------
                     ID:  56a941f7-2f26-4d87-b159-1e02de183db6
            Description:  Create Regular-L0 Backup with TAG-auto for Db:DEMO in NFS:/Rback/DEMO/orabackups/oda00770p/database/3800776698/DEMO_770P
                 Status:  Success
                Created:  November 18, 2020 9:18:07 AM CET
                Message:

Task Name                                Start Time                          End Time                            Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Validate backup config                   November 18, 2020 9:18:09 AM CET    November 18, 2020 9:18:09 AM CET    Success
NFS location existence validation        November 18, 2020 9:18:09 AM CET    November 18, 2020 9:18:09 AM CET    Success
Backup Validations                       November 18, 2020 9:18:09 AM CET    November 18, 2020 9:18:11 AM CET    Success
Recovery Window validation               November 18, 2020 9:18:11 AM CET    November 18, 2020 9:18:13 AM CET    Success
Archivelog deletion policy configuration November 18, 2020 9:18:13 AM CET    November 18, 2020 9:18:14 AM CET    Success
Database backup                          November 18, 2020 9:18:14 AM CET    November 18, 2020 9:19:00 AM CET    Success

Backup can take few minutes to few hours depending on your database size.

Export the backup report to a json file

Each backup done with odacli generates a backup report, you’ll need to save backup report’s description in a json file that will be used on standby server. In this example, I put the json file on the nfs share to avoid having to copy the file from primary to standby server.

odacli list-backupreports | tail -n 2 | grep -v ^$ | awk '{print $1}'
1b64bcc5-dec7-4373-bf95-f8bdd18bdf08

odacli describe-backupreport -i 1b64bcc5-dec7-4373-bf95-f8bdd18bdf08 > /Rback/DEMO/br_DEMO_`date +"%Y%m%d_%H%M%S"`.json

Restore the database on standby server

Assuming your standby server has also the same nfs share mounted, you can restore the database on it. The irestore-database feature will create the database with odacli, and you may know that if you don’t specify a dbhome, a new dbhome will be created. So don’t forget to pick up the dbhome corresponding to your needs if you don’t want a new dbhome. You also need to give to odacli a new db_unique_name for your database (having different db_unique_names for primary and standby is a requirement for Data Guard) and specify the database role: STANDBY.

odacli list-dbhomes

odacli irestore-database -dh 82559355-db72-4616-b968-13b8509466fc -r /Rback/DEMO/br_DEMO_20201118_092635.json -u DEMO_769P -ro STANDBY
Password for SYS user:
{
  "jobId" : "775b58d4-8296-41fa-9c89-7d8761c0b69b",
  "status" : "Created",
  "message" : null,
  "reports" : [ ],
  "createTimestamp" : "November 18, 2020 11:35:20 AM CET",
  "resourceList" : [ ],
  "description" : "Database service recovery with db name: DEMO",
  "updatedTime" : "November 18, 2020 11:35:20 AM CET"
}

The restore can take minutes to hours depending on the size of the database.

odacli describe-job -i "775b58d4-8296-41fa-9c89-7d8761c0b69b"

Job details
----------------------------------------------------------------
                     ID:  775b58d4-8296-41fa-9c89-7d8761c0b69b
            Description:  Database service recovery with db name: DEMO
                 Status:  Success
                Created:  November 18, 2020 11:35:20 AM CET
                Message:

Task Name                                Start Time                          End Time                            Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Check if cluster ware is running         November 18, 2020 11:35:21 AM CET   November 18, 2020 11:35:21 AM CET   Success
Creating DbStorage for DbRestore         November 18, 2020 11:35:21 AM CET   November 18, 2020 11:35:21 AM CET   Success
Validating DiskSpace for DATA            November 18, 2020 11:35:21 AM CET   November 18, 2020 11:35:21 AM CET   Success
Generating SSH key                       November 18, 2020 11:35:21 AM CET   November 18, 2020 11:35:21 AM CET   Success
SSH key                                  November 18, 2020 11:35:21 AM CET   November 18, 2020 11:35:21 AM CET   Success
SSH key scan                             November 18, 2020 11:35:21 AM CET   November 18, 2020 11:35:21 AM CET   Success
Create TDE And Audit Dir Locations       November 18, 2020 11:35:21 AM CET   November 18, 2020 11:35:21 AM CET   Success
Create pfile for Auxiliary Instance      November 18, 2020 11:35:21 AM CET   November 18, 2020 11:35:21 AM CET   Success
Deleting FRA                             November 18, 2020 11:35:21 AM CET   November 18, 2020 11:35:22 AM CET   Success
Rman duplicate                           November 18, 2020 11:35:22 AM CET   November 18, 2020 11:37:49 AM CET   Success
Delete RECO FileGroup DEMO_769P          November 18, 2020 11:37:49 AM CET   November 18, 2020 11:37:50 AM CET   Success
Create RECO FileGroup DEMO_769P          November 18, 2020 11:37:50 AM CET   November 18, 2020 11:37:50 AM CET   Success
Delete RECO FileGroup DEMO_769P_9999     November 18, 2020 11:37:50 AM CET   November 18, 2020 11:37:50 AM CET   Success
Creating pfile from spfile               November 18, 2020 11:37:50 AM CET   November 18, 2020 11:37:51 AM CET   Success
Set PFile Ownership                      November 18, 2020 11:37:51 AM CET   November 18, 2020 11:37:51 AM CET   Success
Customize Db Parameters                  November 18, 2020 11:37:51 AM CET   November 18, 2020 11:37:52 AM CET   Success
Shutdown And Start database              November 18, 2020 11:37:52 AM CET   November 18, 2020 11:38:33 AM CET   Success
Create spfile for restore db             November 18, 2020 11:38:33 AM CET   November 18, 2020 11:38:34 AM CET   Success
Set PFile Ownership                      November 18, 2020 11:38:34 AM CET   November 18, 2020 11:38:34 AM CET   Success
Shutdown And Mount database              November 18, 2020 11:38:34 AM CET   November 18, 2020 11:39:19 AM CET   Success
Enable block change tracking             November 18, 2020 11:39:19 AM CET   November 18, 2020 11:39:27 AM CET   Success
Register Database taskflow               November 18, 2020 11:39:37 AM CET   November 18, 2020 11:42:11 AM CET   Success
Create SPFile in shared loc              November 18, 2020 11:39:37 AM CET   November 18, 2020 11:39:52 AM CET   Success
Delete Local Spfile                      November 18, 2020 11:39:52 AM CET   November 18, 2020 11:39:52 AM CET   Success
Register DB with clusterware             November 18, 2020 11:39:52 AM CET   November 18, 2020 11:40:36 AM CET   Success
Set SysPassword and Create PwFile        November 18, 2020 11:40:36 AM CET   November 18, 2020 11:40:38 AM CET   Success
Creating pfile                           November 18, 2020 11:40:38 AM CET   November 18, 2020 11:40:38 AM CET   Success
Updating db env                          November 18, 2020 11:40:38 AM CET   November 18, 2020 11:40:39 AM CET   Success
Enable DbSizing Template                 November 18, 2020 11:40:39 AM CET   November 18, 2020 11:41:25 AM CET   Success
Create tns entry                         November 18, 2020 11:41:25 AM CET   November 18, 2020 11:41:26 AM CET   Success
Running datapatch                        November 18, 2020 11:41:26 AM CET   November 18, 2020 11:41:27 AM CET   Success
Set CPU pool                             November 18, 2020 11:41:27 AM CET   November 18, 2020 11:41:27 AM CET   Success
Reset Associated Networks                November 18, 2020 11:42:11 AM CET   November 18, 2020 11:42:13 AM CET   Success
Copy Pwfile to Shared Storage            November 18, 2020 11:42:13 AM CET   November 18, 2020 11:42:17 AM CET   Success

Copy the TrustStore file from standby server to primary

You need to copy a file from standby server to primary server. This file will only be used during initial Data Guard configuration:

scp /opt/oracle/dcs/dcscli/cacerts [email protected]:/opt/oracle/dcs/dcscli/cacerts.oda00769p

Create a json file for Data Guard configuration

You can configure Data Guard in interactive mode, but it’s better to prepare a json file with all the parameters. You can later duplicate this json file for your other databases.

vi /home/oracle/scripts/DEMO_DTG.json

{
  "name": "DEMO_DTG",
  "protectionMode": "MAX_AVAILABILITY",
  "enableFlashback": true,
  "enableActiveDg": false,
  "replicationGroups": [
    {
      "sourceEndPoints": [
        {
          "endpointType": "PRIMARY",
          "hostName": "oda00770p.intranet.ch",
          "listenerPort": 1521,
          "databaseUniqueName": "DEMO_770P",
          "ipAddress": "125.150.226.239"
        }
      ],
      "targetEndPoints": [
        {
          "endpointType": "STANDBY",
          "hostName": "oda00769p.intranet.ch",
          "listenerPort": 1521,
          "databaseUniqueName": "DEMO_769P",
          "ipAddress": "125.150.226.237"
        }
      ],
      "transportType": "SYNC"
    }
  ]
}

Configure Data Guard with odacli

Now you can configure Data Guard with your json file as an input. You will be asked to manually give the standby server’s name, the password of the ODA webconsole, the path of the file you copied from standby to primary (the TrustStore file), the password of this TrustStore, and the primary SYS password. The password for the TrustStore can be found on standby server here:

cat /opt/oracle/dcs/dcscli/dcscli.conf  | grep TrustStorePassword
TrustStorePassword=changeit


odacli configure-dataguard -r /home/oracle/scripts/DEMO_DTG.json
Standby site address: oda00769p.intranet.ch
BUI username for Standby site (default: oda-admin):
BUI password for Standby site:
TrustStore path for Standby DCS server: /opt/oracle/dcs/dcscli/cacerts.oda00769p
TrustStore password for Standby DCS server:
Primary database syspassword:
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 DEMO_DTG started
*******************************************************************************************
Step 1: Validate Data Guard configuration request (Primary site)
Description: Validate DG Config Creation
Job ID: b666ee0c-225a-4228-aadf-64eb14ef2dff
Started November 18, 2020 15:29:54 PM CET
Validate create Data Guard configuration request
Finished November 18, 2020 15:29:58 PM CET
*******************************************************************************************
Step 2: Validate Data Guard configuration request (Standby site)
Description: Validate DG Config Creation
Job ID: 5bca9b36-9920-4991-ba23-b45043af639c
Started November 18, 2020 15:29:58 PM CET
Validate create Data Guard configuration request
Finished November 18, 2020 15:30:00 PM CET
*******************************************************************************************
Step 3: Download password file from Primary database (Primary site)
Description: Download orapwd file from Primary database
Started November 18, 2020 15:30:00 PM CET
Prepare orapwd file for Primary database DEMO
Finished November 18, 2020 15:30:04 PM CET
*******************************************************************************************
Step 4: Upload password file to Standby database (Standby site)
Description: Upload orapwd file to Standby database
Started November 18, 2020 15:30:04 PM CET
Write orapwd file to Standby database DEMO
Finished November 18, 2020 15:30:10 PM CET
*******************************************************************************************
Step 5: Configure Primary database (Primary site)
Description: DG Config service creation - ConfigurePrimary
Job ID: de288bc9-579f-4a1c-8db4-0328d3cfcc1e
Started November 18, 2020 15:30:10 PM CET
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 November 18, 2020 15:30:24 PM CET
*******************************************************************************************
Step 6: Configure Standby database (Standby site)
Description: DG Config service creation - ConfigureStandby
Job ID: 0b3dbf45-5023-4b5f-a978-a8a512e58c5f
Started November 18, 2020 15:30:24 PM CET
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 November 18, 2020 15:31:42 PM CET
*******************************************************************************************
Step 7: Configure and enable Data Guard (Primary site)
Description: DG Config service creation - ConfigureDg
Job ID: c89f51ef-7dc5-410b-8421-f7892353babc
Started November 18, 2020 15:31:42 PM CET
Config and enable Data Guard
Post check Data Guard configuration
Finished November 18, 2020 15:33:09 PM CET
*******************************************************************************************
Step 8: Enable Flashback (Standby site)
Description: DG Config service creation - EnableFlashback
Job ID: cdd1899c-f7be-40e9-8bc1-0396acd62c20
Started November 18, 2020 15:33:09 PM CET
Enable FlashBack
Finished November 18, 2020 15:33:19 PM CET
*******************************************************************************************
Step 9: Re-enable Data Guard (Primary site)
Description: DG Config service creation - ReenableDg
Job ID: 391fe101-b286-4664-85a7-09a9679a5027
Started November 18, 2020 15:33:19 PM CET
Post check Data Guard configuration
Finished November 18, 2020 15:33:21 PM CET
*******************************************************************************************
Step 10: Create Data Guard status (Primary site)
Description: DG Status service creation - NewDgconfig
Job ID: 587f7f95-8a4f-4be6-aaa4-a1b6f4fdffa3
Started November 18, 2020 15:33:21 PM CET
Create Data Guard status
Finished November 18, 2020 15:33:23 PM CET
*******************************************************************************************
Step 11: Create Data Guard status (Standby site)
Description: DG Status service creation - NewDgconfig
Job ID: d1cee908-3333-4f1b-b91d-70ae9f13f7dd
Started November 18, 2020 15:33:23 PM CET
Create Data Guard status
Finished November 18, 2020 15:33:25 PM CET
*******************************************************************************************
Configure Data Guard DEMO_DTG completed
*******************************************************************************************

Now configuration is done. Note that this configuration is not a unique job but an interactive process that will span multiple jobs on your 2 ODAs.

Is it really working?

It was my first question. Let’s check that:

[email protected]:/home/oracle/ [DEMO] dgmgrl /
DGMGRL for Linux: Release 19.0.0.0.0 - Production on Wed Nov 18 15:54:40 2020
Version 19.9.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected to "DEMO_770P"
Connected as SYSDG.
DGMGRL> show configuration;

Configuration - DEMO_DTG

  Protection Mode: MaxAvailability
  Members:
  DEMO_770P - Primary database
    DEMO_769P - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 19 seconds ago)




DGMGRL> show database 'DEMO_769P';

Database - DEMO_769P

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      0 seconds (computed 1 second ago)
  Apply Lag:          0 seconds (computed 1 second ago)
  Average Apply Rate: 0 Byte/s
  Real Time Query:    OFF
  Instance(s):
    DEMO

Database Status:
SUCCESS

Yes it’s working fine.

Switchover test

To make sure it’s working, let’s do a switchover from primary server. You first need to pick up the dataguardstatus id:

odacli list-dataguardstatus

ID                                       Name                             Database Name        Role       Protection Mode    Apply Lag       Transport Lag   Apply Rate      Status
---------------------------------------- -------------------------------- -------------------- ---------- ------------------ --------------- --------------- --------------- ----------
d859288f-29fd-45a6-b1b3-c4bb8b52dfd7     DEMO_DTG                         DEMO                 Primary    MaxAvailability    12 seconds      0 seconds       528.00 KByte/s  Configured

odacli describe-dataguardstatus -i d859288f-29fd-45a6-b1b3-c4bb8b52dfd7
Dataguard Status details
----------------------------------------------------------------
                     ID: d859288f-29fd-45a6-b1b3-c4bb8b52dfd7
                   Name: DEMO_DTG
          Database Name: DEMO
                   Role: Primary
        Protection Mode: MaxAvailability
              Apply Lag: 0 seconds
          Transport Lag: 0 seconds
             Apply Rate: 0 Byte/s
                 Status: Configured
           Updated Time: November 18, 2020 3:56:37 PM CET


odacli switchover-dataguard -i d859288f-29fd-45a6-b1b3-c4bb8b52dfd7 -u DEMO_769P


odacli describe-job -i "11d03cf3-d9a1-467b-8226-4363732161d5"

Job details
----------------------------------------------------------------
                     ID:  11d03cf3-d9a1-467b-8226-4363732161d5
            Description:  Dataguard Lifecycle operation service - SwitchoverDg
                 Status:  Success
                Created:  November 18, 2020 3:59:18 PM CET
                Message:

Task Name                                Start Time                          End Time                            Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Precheck switchover DataGuard            November 18, 2020 3:59:18 PM CET    November 18, 2020 3:59:21 PM CET    Success
Switchover DataGuard                     November 18, 2020 3:59:21 PM CET    November 18, 2020 4:00:15 PM CET    Success
Postcheck switchover DataGuard           November 18, 2020 4:00:15 PM CET    November 18, 2020 4:00:16 PM CET    Success
Check if DataGuard config is updated     November 18, 2020 4:00:16 PM CET    November 18, 2020 4:00:36 PM CET    Success

Switchover is OK. Let’s check with dgmgrl:

[email protected]:/home/oracle/ [DEMO] dgmgrl /
DGMGRL for Linux: Release 19.0.0.0.0 - Production on Wed Nov 18 16:16:14 2020
Version 19.9.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected to "DEMO_769P"
Connected as SYSDG.
DGMGRL> show configuration;

Configuration - DEMO_DTG

  Protection Mode: MaxAvailability
  Members:
  DEMO_769P - Primary database
    DEMO_770P - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 37 seconds ago)

DGMGRL> show database 'DEMO_770P';

Database - DEMO_770P

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      0 seconds (computed 1 second ago)
  Apply Lag:          0 seconds (computed 1 second ago)
  Average Apply Rate: 14.00 KByte/s
  Real Time Query:    OFF
  Instance(s):
    DEMO

Database Status:
SUCCESS

Nice!

Switchback test

Now I’m quite confident for the switchback. Let’s try from standby server:

[[email protected] ~]# odacli list-dataguardstatus

ID                                       Name                             Database Name        Role       Protection Mode    Apply Lag       Transport Lag   Apply Rate      Status
---------------------------------------- -------------------------------- -------------------- ---------- ------------------ --------------- --------------- --------------- ----------
d859288f-29fd-45a6-b1b3-c4bb8b52dfd7     DEMO_DTG                         DEMO                 Standby    MaxAvailability    0 seconds       0 seconds       2.00 KByte/s    Configured

[[email protected] ~]# odacli describe-dataguardstatus -i d859288f-29fd-45a6-b1b3-c4bb8b52dfd7
Dataguard Status details
----------------------------------------------------------------
                     ID: d859288f-29fd-45a6-b1b3-c4bb8b52dfd7
                   Name: DEMO_DTG
          Database Name: DEMO
                   Role: Primary
        Protection Mode: MaxAvailability
              Apply Lag: 0 seconds
          Transport Lag: 0 seconds
             Apply Rate: 14.00 KByte/s
                 Status: Configured
           Updated Time: November 18, 2020 4:17:12 PM CET




[[email protected] ~]#  odacli switchover-dataguard -i d859288f-29fd-45a6-b1b3-c4bb8b52dfd7 -u DEMO_770P
Password for target database:
{
  "jobId" : "99bbbaff-4716-4d84-ada6-1da256a93242",
  "status" : "Created",
  "message" : null,
  "reports" : [ ],
  "createTimestamp" : "November 18, 2020 16:19:15 PM CET",
  "resourceList" : [ ],
  "description" : "Dataguard Lifecycle operation service - SwitchoverDg",
  "updatedTime" : "November 18, 2020 16:19:15 PM CET"
}
You have new mail in /var/spool/mail/root
[[email protected] ~]# odacli describe-job -i "99bbbaff-4716-4d84-ada6-1da256a93242"


Job details
----------------------------------------------------------------
                     ID:  99bbbaff-4716-4d84-ada6-1da256a93242
            Description:  Dataguard Lifecycle operation service - SwitchoverDg
                 Status:  Success
                Created:  November 18, 2020 4:19:15 PM CET
                Message:

Task Name                                Start Time                          End Time                            Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Precheck switchover DataGuard            November 18, 2020 4:19:15 PM CET    November 18, 2020 4:19:18 PM CET    Success
Switchover DataGuard                     November 18, 2020 4:19:18 PM CET    November 18, 2020 4:20:06 PM CET    Success
Postcheck switchover DataGuard           November 18, 2020 4:20:06 PM CET    November 18, 2020 4:20:07 PM CET    Success
Check if DataGuard config is updated     November 18, 2020 4:20:07 PM CET    November 18, 2020 4:20:27 PM CET    Success

Yes it worked. Brilliant. You can also check with dgmgrl or by querying current_scn on standby database. Everything is fine regarding this feature.

Conclusion

The Data Guard configuration with odacli is a game changer. Compared to manual configuration, it’s much easier to do, it’s faster to deploy on all your databases and it’s as reliable because it’s just an interface on top of DGMGRL and RMAN. I highly recommend using this feature! Good job Oracle’s ODA team! You just made ODA even better.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Jérôme Dubar
Jérôme Dubar

Consultant