Applying Patch to DB System with dbcli

 

In this article, I will show you how to apply the latest patch to an Oracle Cloud Database System using the command line tool dbcli.

We have two ways of patching the database:

-           Using the Oracle Cloud GUI.

-           Using the console tool dbcli.

1.       First step, not always needed but strongly recommended. Create a backup using GUI.




2.     This is the only action executed by the GUI console. Now, we access the server residing the database using the OPC user and the we change to the root user. All the actions performed now must be executed using the root user.

 

ssh opc@130.XXX.100.20

sudo su -

[root@drdb1 ~]#

 

3.     The next step is optional, we will check our environment. so we need to know that for the patching process we are going to patch the Grid Infrastructure first, and the database home or homes. The command to check the environment is dcli list- or dbcli describe- followed by the component we want to list:

 

 

[root@drdb ~]# dbcli describe-dbsystem -d

WARNING: The 'describe-dbsystem' command is deprecated and will be desupported in a future release. Instead, use the 'describe-system' command.

 

DbSystem Information

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

                     ID: 86ed8df4-8607-4912-88eb-717a06aa81c0

               Platform: Vmdb

        Data Disk Count: 8

         CPU Core Count: 4

                Created: January 5, 2021 7:14:38 PM UTC

 

System Information

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

                   Name: 4b3kbaga

            Domain Name: subnetdrc.drvcnyul.oraclevcn.com

              Time Zone: UTC

             DB Edition: Se

            DNS Servers:

            NTP Servers: 169.254.169.254

 

Disk Group Information

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

DG Name                   Redundancy                Percentage

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

Data                      External                  100

Reco                      External                  100

 

 

DcsCli Details

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

                Version: 23.1.1.4.0-SNAPSHOT

            BuildNumber: 3

              GitNumber: 9d65af05eb2572915dd43e1625d68a5a83631f51

              BuildTime: null

 

DcsAgent Details

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

                Version: 23.1.1.4.0-SNAPSHOT

            BuildNumber: 3

              GitNumber: 9d65af05eb2572915dd43e1625d68a5a83631f51

              BuildTime: null

 

DcsAdmin Details

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

                Version: 20.3.4.0.0-SNAPSHOT

            BuildNumber: jenkins-dcs-admin-20.3.4.0.0-10

              GitNumber: b3fc2a4166259a327c8a48d448ad9796e178fc18

              BuildTime: 2020-09-10_0436 UTC

[root@swcdrdb ~]#

 

 

[root@swcdrdb ~]# dbcli list-dbhomes

 

ID                                       Name                 DB Version                               Home Location                                 Status

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

5b32210b-8f13-4451-91c2-3cf7703565ec     OraDB19000_home1     19.15.0.0.0                              /u01/app/oracle/product/19.0.0.0/dbhome_1     Configured

 

4.     The fist operative step will be uprade the dbcli tool, this step is like update the OPatch component when we work with On Premise databases.

 

[root@swcdrdb ~]# cliadm update-dbcli

 

Job details

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

                     ID:  b0afe37d-a612-4ee3-b689-4a8adbe80552

            Description:  DcsCli patching

                 Status:  Created

                Created:  April 5, 2023 5:15:00 PM UTC

                Message:  Dcs cli will be updated

 

The upgrade process will take some minutes, to check the status of the job we use the below two command and wait until the job finished successfully.


dbcli list-jobs

dbcli describe-job -I <job id>

 

5.     Check for available patches, once you have updated the dcli tool, we can check the list of actual version and available patches in the components.

 

[root@swcdrdb ~]# dbcli describe-component

System Version

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

21.2.3.0.0

 

Component                                Installed Version    Available Version

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

GI                                        19.18.0.0.0           up-to-date

DB                                        19.15.0.0.0           19.18.0.0

 

[root@swcdrdb ~]#

 

As you can see GI is already up to date. If the GI had available version for update we would do as below

 

6.     When we are using Oracle Cloud Infrastructure, the first step is patching GI and then patching the Database. We cannot unify the patch as we do usually in On Premise servers. So, lets start with GI. The command is update-server

 

 

[root@swcdrdb ~]# dbcli update-server

{

  “jobId” : “fa0996a6-7f99-48b2-92dc-5c1fb8e20481”,

  “status” : “Created”,

  “message” : null,

  “reports” : [ ],

  “createTimestamp” : “ April 21, 2020 8:50:30 PM UTC”,

  “resourceList” : [ ],

  “description” : “Server Patching”,

  “updatedTime” : “April 21, 2020 8:50:30 PM UTC”,

  “percentageProgress” : null

}

 

Please pay attention to the jobId returned by the command, we will use that to check the status of the Job.

 

7.     After launching the job, we can check the status using the describe-job command and the Job Id we got from the last step.  Repeat the step until the job finished successfully.

 

dbcli list-jobs

dbcli describe-job -I <job id>

 

8.     Once the job finished, we can run the describe-component again to check the applied patch.

[root@swcdrdb ~]# dbcli describe-component

System Version

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

21.2.3.0.0

 

Component                                Installed Version    Available Version

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

GI                                        19.18.0.0.0           up-to-date

DB                                        19.15.0.0.0           19.18.0.0

 

9.     Next step, patching the database. First, we have to query the db home id and then patch the result id.

 

 [root@swcdrdb ~]# dbcli list-dbhomes

 

ID                                       Name                 DB Version                               Home Location                                 Status

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

5b32210b-8f13-4451-91c2-3cf7703565ec     OraDB19000_home1     19.15.0.0.0                              /u01/app/oracle/product/19.0.0.0/dbhome_1     Configured

 

root@swcdrdb ~]# dbcli update-dbhome -i 5b32210b-8f13-4451-91c2-3cf7703565ec

{

  "jobId" : "53aecb87-33a5-4e0d-b430-db563402a8d8",

  "status" : "Created",

  "message" : null,

  "reports" : [ ],

  "createTimestamp" : "April 21, 2020 09:29:36 AM UTC",

  "resourceList" : [ ],

  "description" : "DB Home Prechecks",

  "updatedTime" : "April 21, 2020 09:29:36 AM UTC",

  "percentageProgress" : null

}

 

10.  Check the job status until the job finish successfully.

      

dbcli list-jobs

dbcli describe-job -I <job id>

 

11.  When the process finished, describe the components once again. Both components should be up-to-date

 

[root@drdb ~]# dbcli describe-component

System Version

18.1.1.4.0

 

Component                                Installed Version    Available Version

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

GI                                        19.18.0.0.0          up-to-date

DB                                        19.18.0.0.0          up-to-date

 

12.  As final step, we should guarantee that all our pluggable database are working fine. You can use many queries to verify the actual status, here some examples:

SQL> select con_id, dbid, name, open_mode from v$pdbs;

 

SQL> select owner,object_name,object_type, status, con_id from cdb_objects

where status='INVALID'

union

select owner, index_name,table_name, status, con_id from cdb_indexes

where status ='UNUSABLE';

 

SQL> select * from registry$history;

 

SQL> select * from dba_registry_sqlpatch;

No comments:

Post a Comment