Previous Next JavaScript must be enabled to correctly display this content

## 5 Scenario: Patching Integrated Oracle Data Guard

This scenario describes how to patch Integrated Oracle Data Guard on Oracle Database Appliance on the DCS stack.

- Environment
  Understand the primary and standby database environment topologies used in the subsequent Data Guard setup example using Oracle Database Appliance.
- Patching Integrated Oracle Data Guard
  This scenario describes patching a database with ODACLI that you configured Oracle Data Guard with `odacli configure-dataguard` or if you registered Oracle Data Guard using `odacli register-dataguard`.

### Environment

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

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 | texas | texas
Database Unique Name | austin | houston
Instance Name | texas1, texas2 | texas1, texas2
Grid Infrastructure Software Installation | /u01/app/19.18.0.0/grid | /u01/app/19.18.0.0/grid
Source Oracle Database Software Installation | /u01/app/odaorahome/oracle/product/19.0.0.0/db_home4 | /u01/app/odaorahome/oracle/product/19.0.0.0/db_home1
Target Oracle Database Software Installation | /u01/app/odaorahome/oracle/product/19.0.0.0/db_home5 | /u01/app/odaorahome/oracle/product/19.0.0.0/db_home5

Parent topic: Scenario: Patching Integrated Oracle Data Guard

### Patching Integrated Oracle Data Guard

This scenario describes patching a database with ODACLI that you configured Oracle Data Guard with `odacli configure-dataguard` or if you registered Oracle Data Guard using `odacli register-dataguard`.

Prerequisites:

- Patching individual Oracle databases on Oracle Database Appliance is available in Oracle Database Appliance release 19.17 and later.
- Server and optionally, storage are already patched to the latest version on the source and target Oracle Database Appliance bare metal system.
- If database runs on a DB system, the server level of DB system is patched to the latest release on the source and target systems.
- Repository is updated with the target database clone files on the source and target appliances.

Notes for patching server and storage:

- Patch server and storage on the standby Oracle Database Appliance, switchover the database, patch the former primary server and storage, switch back the database
- Server and storage prepatch reports provide information about whether local patching is applicable. If local patching is available, then patch the primary and the standby server and storage in a rolling fashion: node by node using the `--local` flag.

Follow these steps to patch the database:

1. Create a new database home using the new database version on source and target systems.

       # odacli create-dbhome -v 19.18.0.0.230117

       Primary:

       [root@proddb1 ]# odacli list-dbhomes

       ID                                       Name                 DB Version                               Home Location                                 Status
       ---------------------------------------- -------------------- ---------------------------------------- --------------------------------------------- ----------
       cf4b5561-a965-43c1-afb9-99a7c96ee143     OraDB19000_home4     19.17.0.0.221018                         /u01/app/odaorahome/oracle/product/19.0.0.0/dbhome_4 CONFIGURED
       f90adcc1-f64a-41ce-b72d-154db155b1fa     OraDB19000_home5     19.18.0.0.230117                         /u01/app/odaorahome/oracle/product/19.0.0.0/dbhome_5 CONFIGURED

       Standby:

       [root@stbydb1 ]# odacli list-dbhomes

       ID                                       Name                 DB Version                               Home Location                                 Status
       ---------------------------------------- -------------------- ---------------------------------------- --------------------------------------------- ----------
       2df4aede-e3a1-438f-8eb8-28a960f8c0b5     OraDB19000_home1     19.17.0.0.221018                         /u01/app/odaorahome/oracle/product/19.0.0.0/dbhome_1 CONFIGURED
       fe72fa84-b609-4cea-b040-4fd7308008c8     OraDB19000_home5     19.18.0.0.230117                          /u01/app/odaorahome/oracle/product/19.0.0.0/dbhome_5 CONFIGURED

2. Verify the Oracle Database Appliance system where the standby database is running.

       [root@stbydb1 ~]# odacli list-dataguardstatus

       Updated about 3 day(s) ago

       It can take up to several minutes to update Data Guard status. You can re-run the command to obtain the latest status.

       ID                                       Name                             Database Name        Role       Protection Mode    Apply Lag       Transport Lag   Apply Rate      Status

       ---------------------------------------- -------------------------------- -------------------- ---------- ------------------ --------------- --------------- --------------- ----------

       6e97c0a7-f6c9-4ec6-96b9-3a28210d408b     austin_huston                    texas                STANDBY    MAX_PERFORMANCE    0 seconds       0 seconds       6.00 KByte/s    CONFIGURED

3. Create the prepatch report for the standby database.

       [root@stbydb1 ~]# odacli create-prepatchreport -db -dbid 4814ef49-a675-4dd4-84eb-9fca8386ca6a -to fe72fa84-b609-4cea-b040-4fd7308008c8

       Job details
       ----------------------------------------------------------------
                            ID:  dfa9e187-7b1d-4ad7-b874-8eb2060ed924
                   Description:  Patch pre-checks for [SINGLEDB, ORACHKSINGLEDB]: Target DB is texas, Destination DbHome is OraDB19000_home5
                        Status:  Created
                       Created:  March 17, 2023 1:40:01 PM GMT
                       Message:  Use 'odacli describe-prepatchreport -i dfa9e187-7b1d-4ad7-b874-8eb2060ed924' to check details of results

       Task Name                                Start Time                          End Time                            Status
       ---------------------------------------- ----------------------------------- ----------------------------------- ----------

       [root@stbydb1 ~]# while true; do odacli describe-prepatchreport -i dfa9e187-7b1d-4ad7-b874-8eb2060ed924; sleep 30; done

       Patch pre-check report
       ------------------------------------------------------------------------
                        Job ID:  dfa9e187-7b1d-4ad7-b874-8eb2060ed924
                   Description:  Patch pre-checks for [SINGLEDB, ORACHKSINGLEDB]: Target DB is texas, Destination DbHome is OraDB19000_home5
                        Status:  SUCCESS
                       Created:  March 17, 2023 1:40:01 PM GMT
                        Result:  All pre-checks succeeded

       Node Name
       ---------------
       stbydb1

       Pre-Check                      Status   Comments
       ------------------------------ -------- --------------------------------------
       __SINGLEDB__
       Is system provisioned           Success   Verified system is provisioned
       Validate dbHomesOnACFS          Success   User has configured disk group for
       configured                                Database homes on ACFS
       Validate Oracle base            Success   Successfully validated Oracle Base
       Evaluate DB clone availability  Success   Successfully validated clone file
                                                 exists
       Evaluate DB patching with RHP   Success   Successfully validated patching DB
                                                 with RHP.
       Validate command execution      Success   Validated command execution

       __ORACHK__
       Running orachk for a single     Success   Successfully ran Orachk
       database
       Validate command execution      Success   Validated command execution

       Node Name
       ---------------
       stbydb2

       Pre-Check                      Status   Comments
       ------------------------------ -------- --------------------------------------
       __SINGLEDB__
       Is system provisioned           Success   Verified system is provisioned
       Validate dbHomesOnACFS          Success   User has configured disk group for
       configured                                Database homes on ACFS
       Validate Oracle base            Success   Successfully validated Oracle Base
       Evaluate DB clone availability  Success   Successfully validated clone file
                                                 exists
       Evaluate DB patching with RHP   Success   Successfully validated patching DB
                                                 with RHP.
       Validate command execution      Success   Validated command execution

       __ORACHK__
       Running orachk for a single     Success   Successfully ran Orachk
       database
       Validate command execution      Success   Validated command execution

4. Patch the standby database.

       root@stbydb1 ~]# odacli update-database -i 4814ef49-a675-4dd4-84eb-9fca8386ca6a -to fe72fa84-b609-4cea-b040-4fd7308008c8
       {
         "jobId" : "611c7a43-53d1-4e0f-be3f-3354a386cbd8",
         "status" : "Created",
         "message" : null,
         "reports" : [ ],
         "createTimestamp" : "March 17, 2023 14:00:32 PM GMT",
         "resourceList" : [ ],
         "description" : "DB Patching: database ID is 4814ef49-a675-4dd4-84eb-9fca8386ca6a",
         "updatedTime" : "March 17, 2023 14:00:32 PM GMT",
         "jobType" : null
       }

       [root@stbydb1 ~]# odacli describe-job -i 611c7a43-53d1-4e0f-be3f-3354a386cbd8

       Job details
       ----------------------------------------------------------------
                            ID:  611c7a43-53d1-4e0f-be3f-3354a386cbd8
                   Description:  DB Patching: database ID is 4814ef49-a675-4dd4-84eb-9fca8386ca6a
                        Status:  Success
                       Created:  March 17, 2023 2:00:32 PM GMT
                       Message:

       Task Name                                Node Name                 Start Time                          End Time                            Status
       ---------------------------------------- ------------------------- ----------------------------------- ----------------------------------- ----------
       Creating wallet for DB Client            stbydb1                March 17, 2023 2:01:17 PM GMT       March 17, 2023 2:01:18 PM GMT       Success
       Patch databases by RHP                   stbydb1                March 17, 2023 2:01:18 PM GMT       March 17, 2023 2:08:41 PM GMT       Success
       Updating database metadata               stbydb2                March 17, 2023 2:08:41 PM GMT       March 17, 2023 2:08:41 PM GMT       Success
       Set log_archive_dest for Database        stbydb1                March 17, 2023 2:08:41 PM GMT       March 17, 2023 2:08:45 PM GMT       Success
       Generating and saving BOM                stbydb1                March 17, 2023 2:08:45 PM GMT       March 17, 2023 2:09:41 PM GMT       Success
       Generating and saving BOM                stbydb2                March 17, 2023 2:08:45 PM GMT       March 17, 2023 2:09:36 PM GMT       Success
       TDE parameter update                     stbydb2                March 17, 2023 2:10:32 PM GMT       March 17, 2023 2:10:33 PM GMT       Success

       Database is running from the new home:

       root@stbydb1 ~]# odacli list-databases

       ID                                       DB Name    DB Type  DB Version           CDB        Class    Shape    Storage    Status        DbHomeID
       ---------------------------------------- ---------- -------- -------------------- ---------- -------- -------- ---------- ------------ ----------------------------------------
       980a09c0-dba4-404b-b0ac-985504f7c469     hun        RAC      19.17.0.0.221018     true       OLTP     odb1     ASM        CONFIGURED   2df4aede-e3a1-438f-8eb8-28a960f8c0b5
       4814ef49-a675-4dd4-84eb-9fca8386ca6a     texas      RAC      19.18.0.0.230117     true       OLTP     odb1     ASM        CONFIGURED   fe72fa84-b609-4cea-b040-4fd7308008c8

5. Switchover the database.

       [root@proddb1 ~]# odacli switchover-dataguard -i 6e97c0a7-f6c9-4ec6-96b9-3a28210d408b -u huston
       Password for target database:
       {
         "jobId" : "41a03f89-bbc9-4d37-9548-5f3d3f1d3977",
         "status" : "Created",
         "message" : null,
         "reports" : [ ],
         "createTimestamp" : "March 17, 2023 15:16:32 PM CET",
         "resourceList" : [ ],
         "description" : "Dataguard operation for austin_huston - SwitchoverDg",
         "updatedTime" : "March 17, 2023 15:16:32 PM CET",
         "jobType" : null
       }

       [root@proddb1 ~]# odacli describe-job -i 41a03f89-bbc9-4d37-9548-5f3d3f1d3977

       Job details
       ----------------------------------------------------------------
                            ID:  41a03f89-bbc9-4d37-9548-5f3d3f1d3977
                   Description:  Dataguard operation for austin_huston - SwitchoverDg
                        Status:  Success
                       Created:  March 17, 2023 3:16:32 PM CET
                       Message:

       Task Name                                Node Name                 Start Time                          End Time                            Status
       ---------------------------------------- ------------------------- ----------------------------------- ----------------------------------- ----------
       Precheck switchover DataGuard            proddb1                March 17, 2023 3:16:32 PM CET       March 17, 2023 3:16:34 PM CET       Success
       Switchover DataGuard                     proddb1                March 17, 2023 3:16:34 PM CET       March 17, 2023 3:17:29 PM CET       Success
       Postcheck switchover DataGuard           proddb1                March 17, 2023 3:17:29 PM CET       March 17, 2023 3:18:31 PM CET       Success
       Check if DataGuard config is updated     proddb2                March 17, 2023 3:18:41 PM CET       March 17, 2023 3:18:51 PM CET       Success

       [root@proddb1 ~]# odacli list-dataguardstatus
       Updated about 3 day(s) ago
       It can take up to several minutes to update Data Guard status. You can re-run the command to obtain the latest status.
       ID                                       Name                             Database Name        Role       Protection Mode    Apply Lag       Transport Lag   Apply Rate      Status
       ---------------------------------------- -------------------------------- -------------------- ---------- ------------------ --------------- --------------- --------------- ----------
       6e97c0a7-f6c9-4ec6-96b9-3a28210d408b     austin_huston                    texas                STANDBY    MAX_PERFORMANCE    0 seconds       0 seconds       2.33 MByte/s    CONFIGURED

       [root@stbydb1 ~]# odacli list-dataguardstatus
       Updated about 3 day(s) ago
       It can take up to several minutes to update Data Guard status. You can re-run the command to obtain the latest status.
       ID                                       Name                             Database Name        Role       Protection Mode    Apply Lag       Transport Lag   Apply Rate      Status
       ---------------------------------------- -------------------------------- -------------------- ---------- ------------------ --------------- --------------- --------------- ----------
       6e97c0a7-f6c9-4ec6-96b9-3a28210d408b     austin_huston                    texas                PRIMARY    MAX_PERFORMANCE    0 seconds       0 seconds       2.19 MByte/s    CONFIGURED

6. Create a prepatch report for the new standby system.

       [root@proddb1 ~]# odacli create-prepatchreport -db -dbid 5ec47358-6027-4ad8-948a-831fcc73f338 -to f90adcc1-f64a-41ce-b72d-154db155b1fa

       Job details
       ----------------------------------------------------------------
                            ID:  e564bfc6-09a9-420b-9c47-19529ad93f92
                   Description:  Patch pre-checks for [SINGLEDB, ORACHKSINGLEDB]: Target DB is texas, Destination DbHome is OraDB19000_home5
                        Status:  Created
                       Created:  March 17, 2023 3:25:59 PM CET
                       Message:  Use 'odacli describe-prepatchreport -i e564bfc6-09a9-420b-9c47-19529ad93f92' to check details of results

       [root@proddb1 ~]# odacli describe-prepatchreport -i e564bfc6-09a9-420b-9c47-19529ad93f92

       Patch pre-check report
       ------------------------------------------------------------------------
                        Job ID:  e564bfc6-09a9-420b-9c47-19529ad93f92
                   Description:  Patch pre-checks for [SINGLEDB, ORACHKSINGLEDB]: Target DB is texas, Destination DbHome is OraDB19000_home5
                        Status:  SUCCESS
                       Created:  March 17, 2023 3:25:59 PM CET
                        Result:  One or more pre-checks failed for [ORACHK]

       Node Name
       ---------------
       proddb1

       Pre-Check                      Status   Comments
       ------------------------------ -------- --------------------------------------
       __SINGLEDB__
       Is system provisioned           Success   Verified system is provisioned
       Validate dbHomesOnACFS          Success   User has configured disk group for
       configured                                Database homes on ACFS
       Validate Oracle base            Success   Successfully validated Oracle Base
       Evaluate DB clone availability  Success   Successfully validated clone file
                                                 exists
       Evaluate DB patching with RHP   Success   Successfully validated patching DB
                                                 with RHP.
       Validate command execution      Success   Validated command execution

       __ORACHK__
       Running orachk for a single     Success   Successfully ran Orachk database
       Validate command execution      Success   Validated command execution

       Node Name
       ---------------
       proddb2

       Pre-Check                      Status   Comments
       ------------------------------ -------- --------------------------------------
       __SINGLEDB__
       Is system provisioned           Success   Verified system is provisioned
       Validate dbHomesOnACFS          Success   User has configured disk group for
       configured                                Database homes on ACFS
       Validate Oracle base            Success   Successfully validated Oracle Base
       Evaluate DB clone availability  Success   Successfully validated clone file
                                                 exists
       Evaluate DB patching with RHP   Success   Successfully validated patching DB
                                                 with RHP.
       Validate command execution      Success   Validated command execution

       __ORACHK__
       Running orachk for a single     Success   Successfully ran Orachk database
       Validate command execution      Success   Validated command execution

7. Patch the standby database.

       [root@proddb1 ~]# odacli update-database -i 5ec47358-6027-4ad8-948a-831fcc73f338 -to f90adcc1-f64a-41ce-b72d-154db155b1fa
       {
         "jobId" : "cb70fa38-62bb-422d-b6b7-efb684e744fa",
         "status" : "Created",
         "message" : null,
         "reports" : [ ],
         "createTimestamp" : "March 17, 2023 15:42:59 PM CET",
         "resourceList" : [ ],
         "description" : "DB Patching: database ID is 5ec47358-6027-4ad8-948a-831fcc73f338",
         "updatedTime" : "March 17, 2023 15:42:59 PM CET",
         "jobType" : null
       }

       [root@proddb1 ~]# while true; do odacli describe-job -i cb70fa38-62bb-422d-b6b7-efb684e744fa; sleep 30; done

       Job details
       ----------------------------------------------------------------
                            ID:  cb70fa38-62bb-422d-b6b7-efb684e744fa
                   Description:  DB Patching: database ID is 5ec47358-6027-4ad8-948a-831fcc73f338
                        Status:  Success
                       Created:  March 17, 2023 3:42:59 PM CET
                       Message:

       Task Name                                Node Name                 Start Time                          End Time                            Status
       ---------------------------------------- ------------------------- ----------------------------------- ----------------------------------- ----------
       Creating wallet for DB Client            proddb1                March 17, 2023 3:43:42 PM CET       March 17, 2023 3:43:42 PM CET       Success
       Patch databases by RHP                   proddb1                March 17, 2023 3:43:42 PM CET       March 17, 2023 3:49:17 PM CET       Success
       Updating database metadata               proddb2                March 17, 2023 3:49:17 PM CET       March 17, 2023 3:49:17 PM CET       Success
       Set log_archive_dest for Database        proddb1                March 17, 2023 3:49:17 PM CET       March 17, 2023 3:49:20 PM CET       Success
       Generating and saving BOM                proddb1                March 17, 2023 3:49:20 PM CET       March 17, 2023 3:50:23 PM CET       Success
       Generating and saving BOM                proddb2                March 17, 2023 3:49:20 PM CET       March 17, 2023 3:50:20 PM CET       Success
       TDE parameter update                     proddb2                March 17, 2023 3:50:53 PM CET       March 17, 2023 3:50:53 PM CET       Success

8. Create a datapatch type prepatch report on the current primary system:

       [root@stbydb1 ~]# odacli create-prepatchreport -dbid 4814ef49-a675-4dd4-84eb-9fca8386ca6a -dp

       [root@stbydb1 ~]# odacli describe-prepatchreport -i 6b8523c1-b2cf-4559-9f6e-ef1e7c7beb37

       Patch pre-check report
       ------------------------------------------------------------------------
                        Job ID:  6b8523c1-b2cf-4559-9f6e-ef1e7c7beb37
                   Description:  Patch pre-checks for [DATAPATCH]: Target DB is texas
                        Status:  SUCCESS
                       Created:  March 17, 2023 4:16:38 PM GMT
                        Result:  All pre-checks succeeded

       Node Name
       ---------------
       stbydb1

       Pre-Check                      Status   Comments
       ------------------------------ -------- --------------------------------------
       __DATAPATCH__
       Is system provisioned           Success   Verified system is provisioned
       Validate database role          Success   Successfully validated database role
       Evaluate DB data patching       Success   The following patches need to be
       with OPatch                               applied : [34765931]. The following
                                                 patches need to be rolled back:
                                                 [34411846, 34282948]. The following
                                                 patches are release updates:
                                                 [34786990].
       Validate command execution      Success   Validated command execution

       Node Name
       ---------------
       stbydb2

       Pre-Check                      Status   Comments
       ------------------------------ -------- --------------------------------------
       __DATAPATCH__
       Is system provisioned           Success   Verified system is provisioned
       Validate database role          Success   Successfully validated database role
       Evaluate DB data patching       Success   The following patches need to be
       with OPatch                               applied : [34765931]. The following
                                                 patches need to be rolled back:
                                                 [34411846, 34282948]. The following
                                                 patches are release updates:
                                                 [34786990].
       Validate command execution      Success   Validated command execution

9. Apply datapatch on the current primary system.

       [root@stbydb1 ~]# odacli update-database -i 4814ef49-a675-4dd4-84eb-9fca8386ca6a -dp
       {
         "jobId" : "3cb0135a-7b31-4113-afe4-8b1cb0747d80",
         "status" : "Created",
         "message" : null,
         "reports" : [ ],
         "createTimestamp" : "March 17, 2023 16:38:30 PM GMT",
         "resourceList" : [ ],
         "description" : "DB Patching: database ID is 4814ef49-a675-4dd4-84eb-9fca8386ca6a",
         "updatedTime" : "March 17, 2023 16:38:30 PM GMT",
         "jobType" : null
       }

       [root@stbydb1 ~]# while true; do odacli describe-job -i 3cb0135a-7b31-4113-afe4-8b1cb0747d80; sleep 30; done

       Job details
       ----------------------------------------------------------------
                            ID:  3cb0135a-7b31-4113-afe4-8b1cb0747d80
                   Description:  DB Patching: database ID is 4814ef49-a675-4dd4-84eb-9fca8386ca6a
                        Status:  Success
                       Created:  March 17, 2023 4:38:30 PM GMT
                       Message:

       Task Name                                Node Name                 Start Time                          End Time                            Status
       ---------------------------------------- ------------------------- ----------------------------------- ----------------------------------- ----------
       Datapatch apply                          stbydb1                March 17, 2023 4:38:39 PM GMT       March 17, 2023 4:42:42 PM GMT       Success

10. Optionally, switch to the primary system.

        [root@stbydb1 ~]# odacli switchover-dataguard -i 6e97c0a7-f6c9-4ec6-96b9-3a28210d408b -u austin
        Password for target database:
        {
          "jobId" : "44aa5d2a-b255-4df2-8f85-6b721cda4339",
          "status" : "Created",
          "message" : null,
          "reports" : [ ],
          "createTimestamp" : "March 17, 2023 17:01:33 PM GMT",
          "resourceList" : [ ],
          "description" : "Dataguard operation for austin_huston - SwitchoverDg",
          "updatedTime" : "March 17, 2023 17:01:33 PM GMT",
          "jobType" : null
        }

Parent topic: Scenario: Patching Integrated Oracle Data Guard