4 Scenario: Registering Manually Configured Oracle Data Guard with DCS

This scenario describes registering manually configured Oracle Data Guard with the DCS stack.

Environment

Understand the primary and standby database environment topologies used in the subsequent Data Guard setup example using Oracle Database Appliance.

Description of oda_with_data_guard.png follows
Description of the illustration oda_with_data_guard.png
Component Primary Oracle Database Appliance Standby Oracle Database Appliance
Host Names proddb1, proddb2 stbydb1, stbydb2
Database Name hun hun
Database Unique Name buda pest

Registering Oracle Data Guard with DCS

Understand the steps to register Oracle Data Guard with DCS.

Follow these steps:

  1. Verify that the database is registered on the primary and the standby system.
    [root@proddb1 ~]# odacli list-databases 
    ID DB Name DB Type DB Version CDB Class Shape Storage Status DbHomeID 
    ---------------------------------------- ---------- -------- -------------------- ---------- -------- -------- ---------- ------------ --------------------
    ebefcfa2-0315-4771-9881-373294a6b626 hun RAC 19.15.0.0.220419 true OLTP odb1 ASM CONFIGURED 14402597-639a-4e87-b655-aeae36cfa3a5
    
    [root@stdbydb1 ~]# odacli list-databases 
    ID DB Name DB Type DB Version CDB Class Shape Storage Status DbHomeID 
    ---------------------------------------- ---------- -------- -------------------- ---------- -------- -------- ---------- ------------ --------------------
    ebefcfa2-0315-4771-9881-373294a6b626 hun RAC 19.15.0.0.220419 true OLTP odb1 ASM CONFIGURED 575fca61-abbc-47ed-9530-37ad7ec5caa0
  2. Identify the home from where the database is running on the primary.
    [root@proddb1 ~]# odacli list-dbhomes 
    ID Name DB Version Home Location Status 
    ---------------------------------------- -------------------- ---------------------------------------- ---------------------------------------------
    14402597-639a-4e87-b655-aeae36cfa3a5 OraDB19000_home1 19.15.0.0.220419 /u01/app/odaorahome/oracle/product/19.0.0.0/dbhome_1 CONFIGURED
  3. Verify the status of the Data Guard on the primary. Status should be healthy for the registration.
    [oracle@proddb1 ~]$ export ORACLE_HOME=/u01/app/odaorahome/oracle/product/19.0.0.0/dbhome_1
    [oracle@proddb1 ~]$ export PATH=$ORACLE_HOME/bin:$PATH
    [oracle@proddb1 ~]$ dgmgrl sys/WElcome_12##@pest
    DGMGRL for Linux: Release 19.0.0.0.0 - Production on Fri May 6 13:41:52 2022
    Version 19.15.0.0.0
    Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
    Welcome to DGMGRL, type "help" for information.
    Connected to "pest"
    Connected as SYSDBA.
    DGMGRL> show configuration
    Configuration - buda_pest
    Protection Mode: MaxPerformance
    Members:
    buda - Primary database
    pest - Physical standby database
    Fast-Start Failover: Disabled
    Configuration Status:
    SUCCESS (status updated 38 seconds ago)
    DGMGRL> validate database pest
    Database Role: Physical standby database
    Primary Database: buda
    Ready for Switchover: Yes
    Ready for Failover: Yes (Primary Running)
    Managed by Clusterware:
    buda: YES
    pest: YES
    DGMGRL> exit

    Ensure that the Oracle Data Guard configuration name is in the format db_unique_name_of_primary_ db_unique_name_of_standby. If multiple Oracle Data Guard configurations have the same name in dgmgrl, then you can only register the first Oracle Data Guard configuration with DCS. Subsequent registrations with the same name fail because each Oracle Data Guard configuration name must be unique.

    Before renaming:
    DGMGRL> show configuration
    Configuration - dgconfig
    Protection Mode: MaxPerformance
    
    Members:
    buda - Primary database
    pest - Physical standby database
    Fast-Start Failover: DISABLED
    Configuration Status:
    SUCCESS (status updated 6 seconds ago)
    
    After renaming:
    DGMGRL> EDIT CONFIGURATION RENAME TO buda_pest;
    Succeeded.
    
    DGMGRL> show configuration
    Configuration - buda_pest
    Protection Mode: MaxPerformance
    Members:
    buda - Primary database
    pest - Physical standby database
    Fast-Start Failover: DISABLED
    Configuration Status:
    SUCCESS (status updated 37 seconds ago)

    On Oracle Database Appliance release 19.15 and earlier, the odacli register-database command expects VIPs in the tnsnames.ora and not the SCAN. The $ORACLE_HOME/network/admin/tnsnames.ora file must be similar to the following:

    BUDA =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = proddb1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = proddb2-vip)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = buda.domain.com)
    )
    )
    PEST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = stdbydb1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = stdbydb2-vip)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = pest.domain.com)
    )
    )
  4. Register Oracle Data Guard in DCS on the first node of the primary. If the primary runs on a DB system, then register Oracle Data Guard with the first node of the DB system.
    [root@proddb1 ~]# odacli register-dataguard
    Standby site address: stdbydb1
    BUI username for Standby site (default: oda-admin):
    BUI password for Standby site:
    root@stdbydb1 's password:
    Database name for Data Guard configuration: hun
    Primary database SYS password:
    *******************************************************************************************
    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 (TCP): 1521
    Standby database listener port (TCP): 1521
    Transport type: ASYNC
    Protection mode: MAX_PERFORMANCE
    Data Guard configuration name: buda_pest
    Does the above Data Guard configuration match your actual configuration? (Y/N, default:N):
    *******************************************************************************************
    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 (TCP) (default: 1521):
    Standby database listener port (TCP) (default: 1521):
    Transport type [ASYNC, FASTSYNC, SYNC] (default: ASYNC):
    Protection mode [MAX_PROTECTION, MAX_PERFORMANCE, MAX_AVAILABILITY] (default: MAX_PERFORMANCE):
    Data Guard configuration name (default: buda_pest): buda_pest
    *******************************************************************************************
    Register Data Guard buda_pest started
    *******************************************************************************************
    Step 1: Validate register Data Guard configuration request (Primary site)
    Description: Validate DG Config Creation for db hun
    Job ID: fc5436d2-67db-4d4c-927c-9053c56dc510
    Started May 06, 2022 13:49:33 PM GMT
    Validate if database ID exists
    Validate if dg config name exists
    Validate database role
    Validate if database is configured with Data Guard already
    Validate tnsnames.ora
    Validate database connection
    Validate if data guard in good status
    Precheck switchover DataGuard
    Validate if input matches DGMGRL output
    Validate if flashback enabled
    Finished May 06, 2022 13:49:40 PM GMT
    *******************************************************************************************
    Step 2: Validate register Data Guard configuration request (Standby site)
    Description: Validate DG Config Creation for db hun
    Job ID: 54224175-eb0a-4e07-a84d-b758692dc55c
    Started May 06, 2022 13:49:42 PM GMT
    Validate if database ID exists
    Validate if dg config name exists
    Validate database role
    Validate if database is configured with Data Guard already
    Validate tnsnames.ora
    Validate database connection
    Validate if data guard in good status
    Validate if input matches DGMGRL output
    Validate if flashback enabled
    Finished May 06, 2022 13:49:46 PM GMT
    *******************************************************************************************
    Step 3: Create Data Guard status (Primary site)
    Description: DG Status operation for db hun - RegisterDg
    Job ID: c6dcec88-2e21-4bc0-a243-6ab61885be88
    Started May 06, 2022 13:49:47 PM GMT
    Create Data Guard status
    Finished May 06, 2022 13:49:53 PM GMT
    *******************************************************************************************
    Step 4: Create Data Guard status (Standby site)
    Description: DG Status operation for db hun - RegisterDg
    Job ID: 44f312ad-97b0-4eff-8d47-7134433011c5
    Started May 06, 2022 13:49:54 PM GMT
    Create Data Guard status
    Finished May 06, 2022 13:50:01 PM GMT
    *******************************************************************************************
    Register Data Guard buda_pest completed
    *******************************************************************************************
  5. Verify the registration.
    [root@proddb1 ~]# odacli list-dataguardstatus
    Updated about 7 minute(s) ago
    ID Name Database Name Role Protection Mode Apply Lag Transport Lag Apply Rate Status
    ---------------------------------------- -------------------------------- -------------------- ---------- ------------------ --------------- --------------- ---------------
    cd86f70d-31d5-4798-8abf-a8148ec2e389 buda_pest hun PRIMARY MAX_PERFORMANCE 0 seconds 0 seconds 5.00 KByte/s CONFIGURED
    [root@proddb2 ~]# odacli list-dataguardstatus
    Updated about 8 minute(s) ago
    ID Name Database Name Role Protection Mode Apply Lag Transport Lag Apply Rate Status
    ---------------------------------------- -------------------------------- -------------------- ---------- ------------------ --------------- --------------- ---------------
    cd86f70d-31d5-4798-8abf-a8148ec2e389 buda_pest hun PRIMARY MAX_PERFORMANCE 0 seconds 0 seconds 5.00 KByte/s CONFIGURED
    [root@stdbydb1 ~]# odacli list-dataguardstatus
    Updated about 8 minute(s) ago
    ID Name Database Name Role Protection Mode Apply Lag Transport Lag Apply Rate Status
    ---------------------------------------- -------------------------------- -------------------- ---------- ------------------ --------------- --------------- ---------------
    cd86f70d-31d5-4798-8abf-a8148ec2e389 buda_pest hun STANDBY MAX_PERFORMANCE 0 seconds 0 seconds 5.00 KByte/s CONFIGURED
    [root@stdbydb2 ~]# odacli list-dataguardstatus
    Updated about 8 minute(s) ago
    ID Name Database Name Role Protection Mode Apply Lag Transport Lag Apply Rate Status
    ---------------------------------------- -------------------------------- -------------------- ---------- ------------------ --------------- --------------- ---------------
    cd86f70d-31d5-4798-8abf-a8148ec2e389 buda_pest hun STANDBY MAX_PERFORMANCE 0 seconds 0 seconds 5.00 KByte/s CONFIGURED
  6. Verify that switchover, failover, and reinstate operations work.
    [root@proddb1 ~]# odacli switchover-dataguard -u pest -i cd86f70d-31d5-4798-8abf-a8148ec2e389
    Password for target database:
    {
    "jobId" : "2821ca72-eb6e-462f-8a7b-5f976a401673",
    "status" : "Created",
    "message" : null,
    "reports" : [ ],
    "createTimestamp" : "May 06, 2022 14:01:31 PM GMT",
    "resourceList" : [ ],
    "description" : "Dataguard operation for buda_pest - SwitchoverDg",
    "updatedTime" : "May 06, 2022 14:01:31 PM GMT"
    }
    [root@proddb1 ~]# odacli describe-job -i "2821ca72-eb6e-462f-8a7b-5f976a401673"
    Job details
    ----------------------------------------------------------------
    ID: 2821ca72-eb6e-462f-8a7b-5f976a401673
    Description: Dataguard operation for buda_pest - SwitchoverDg
    Status: Success
    Created: May 6, 2022 2:01:31 PM GMT
    Message:
    Task Name Start Time End Time Status
    ---------------------------------------- ----------------------------------- ----------------------------------- ----------
    Precheck switchover DataGuard May 6, 2022 2:01:31 PM GMT May 6, 2022 2:01:34 PM GMT Success
    Switchover DataGuard May 6, 2022 2:01:34 PM GMT May 6, 2022 2:02:53 PM GMT Success
    Postcheck switchover DataGuard May 6, 2022 2:02:53 PM GMT May 6, 2022 2:02:54 PM GMT Success
    Check if DataGuard config is updated May 6, 2022 2:04:14 PM GMT May 6, 2022 2:04:24 PM GMT Success
    [root@stdbydb1 ~]# odacli switchover-dataguard -u buda -i cd86f70d-31d5-4798-8abf-a8148ec2e389
    Password for target database:
    {
    "jobId" : "7d7ef3f3-f48b-449f-a2b8-9a5de0882ff3",
    "status" : "Created",
    "message" : null,
    "reports" : [ ],
    "createTimestamp" : "May 06, 2022 14:06:28 PM GMT",
    "resourceList" : [ ],
    "description" : "Dataguard operation for buda_pest - SwitchoverDg",
    "updatedTime" : "May 06, 2022 14:06:28 PM GMT"
    }
    [root@stdbydb1 ~]# odacli describe-job -i "7d7ef3f3-f48b-449f-a2b8-9a5de0882ff3"
    Job details
    ----------------------------------------------------------------
    ID: 7d7ef3f3-f48b-449f-a2b8-9a5de0882ff3
    Description: Dataguard operation for buda_pest - SwitchoverDg
    Status: Success
    Created: May 6, 2022 2:06:28 PM GMT
    Message:
    Task Name Start Time End Time Status
    ---------------------------------------- ----------------------------------- ----------------------------------- ----------
    Precheck switchover DataGuard May 6, 2022 2:06:28 PM GMT May 6, 2022 2:06:31 PM GMT Success
    Switchover DataGuard May 6, 2022 2:06:31 PM GMT May 6, 2022 2:07:36 PM GMT Success
    Postcheck switchover DataGuard May 6, 2022 2:07:36 PM GMT May 6, 2022 2:07:37 PM GMT Success
    Check if DataGuard config is updated May 6, 2022 2:08:37 PM GMT May 6, 2022 2:08:47 PM GMT Success
    [root@stdbydb1 ~]# odacli list-dataguardstatus
    Updated about 19 minute(s) ago
    ID Name Database Name Role Protection Mode Apply Lag Transport Lag Apply Rate Status
    ---------------------------------------- -------------------------------- -------------------- ---------- ------------------ --------------- --------------- --------------- ----------
    cd86f70d-31d5-4798-8abf-a8148ec2e389 buda_pest hun STANDBY MAX_PERFORMANCE 0 seconds 0 seconds 3.29 MByte/s CONFIGURED
    [root@stdbydb1 ~]# odacli failover-dataguard -u pest -i cd86f70d-31d5-4798-8abf-a8148ec2e389
    Password for target database:
    {
    "jobId" : "e6cd3092-94fb-4fbd-9dce-cdf9aad4638a",
    "status" : "Created",
    "message" : null,
    "reports" : [ ],
    "createTimestamp" : "May 06, 2022 14:20:46 PM GMT",
    "resourceList" : [ ],
    "description" : "Dataguard operation for buda_pest - FailoverDg",
    "updatedTime" : "May 06, 2022 14:20:46 PM GMT"
    }
    [root@stdbydb1 ~]# odacli describe-job -i e6cd3092-94fb-4fbd-9dce-cdf9aad4638a
    Job details
    ----------------------------------------------------------------
    ID: e6cd3092-94fb-4fbd-9dce-cdf9aad4638a
    Description: Dataguard operation for buda_pest - FailoverDg
    Status: Success
    Created: May 6, 2022 2:20:46 PM GMT
    Message:
    Task Name Start Time End Time Status
    ---------------------------------------- ----------------------------------- ----------------------------------- ----------
    Precheck failover DataGuard May 6, 2022 2:20:46 PM GMT May 6, 2022 2:20:47 PM GMT Success
    Failover DataGuard May 6, 2022 2:20:47 PM GMT May 6, 2022 2:21:08 PM GMT Success
    Postcheck DataGuard status May 6, 2022 2:21:08 PM GMT May 6, 2022 2:21:09 PM GMT Success
    Check if DataGuard config is updated May 6, 2022 2:21:19 PM GMT May 6, 2022 2:21:29 PM GMT Success
    [root@stdbydb1 ~]# odacli reinstate-dataguard -u buda -i cd86f70d-31d5-4798-8abf-a8148ec2e389
    Password for target database:
    {
    "jobId" : "cb82e0ea-558d-4eb6-ad7a-82c373da7504",
    "status" : "Created",
    "message" : null,
    "reports" : [ ],
    "createTimestamp" : "May 06, 2022 14:26:50 PM GMT",
    "resourceList" : [ ],
    "description" : "Dataguard operation for buda_pest - ReinstateDg",
    "updatedTime" : "May 06, 2022 14:26:50 PM GMT"
    }
    [root@stdbydb1 ~]# odacli describe-job -i "cb82e0ea-558d-4eb6-ad7a-82c373da7504"
    Job details
    ----------------------------------------------------------------
    ID: cb82e0ea-558d-4eb6-ad7a-82c373da7504
    Description: Dataguard operation for buda_pest - ReinstateDg
    Status: Success
    Created: May 6, 2022 2:26:50 PM GMT
    Message:
    Task Name Start Time End Time Status
    ---------------------------------------- ----------------------------------- ----------------------------------- ----------
    Precheck reinstate DataGuard May 6, 2022 2:26:50 PM GMT May 6, 2022 2:26:51 PM GMT Success
    Reinstate DataGuard May 6, 2022 2:26:51 PM GMT May 6, 2022 2:28:36 PM GMT Success
    Postcheck DataGuard status May 6, 2022 2:28:36 PM GMT May 6, 2022 2:28:37 PM GMT Success
    Check if DataGuard config is updated May 6, 2022 2:28:47 PM GMT May 6, 2022 2:28:57 PM GMT