How to Patch Oracle Database on the Oracle Cloud

I was waiting the latest PSU for Oracle Database 11.2.0.4 on the Oracle Database Cloud Service, and today I noticed that it’s available. So let’s see how we can update our Oracle Databases in the cloud.

First we go to the database home to see if any updates is available. As you can see, in the administration box, there is an available patch. We click on it to see the details of the patch.

It’s the PSU Update 11.2.0.4.161018! I can read the readme file of the patch (from Oracle support) when I click the readme link. On the right side, there’s an action menu to run a precheck (prerequisites check) and to apply the patch. I run the precheck first, so I can be sure that I won’t have any problem when applying the patch.

Oh, the prerequisites checks failed!

Honestly, this is not my first time to apply a patch on Oracle Database Cloud Service. In my previous try about 2 or 3 months ago, I applied the latest PSU without any problem. It was a very smooth process, took less than hour. This time, the prerequisites failed.

Unfortunately, database home page doesn’t show any details about which prerequisite is failed. I wanted to try my chance with command line tools. Oracle Cloud provides dbaascli tool to manage Database Service including patching but some of its functions require root privileges. So I logged in to my cloud server via SSH as “opc” user – this user has sudo rights so I can switch to root user. And I issued “dbaascli dbpatchm –run -prereq” command to precheck the avaliable database patch.

[root@TEST11 ~]# dbaascli dbpatchm --run -prereq
DBAAS CLI version 1.0.0
Executing command dbpatchm --run -prereq -cli
/var/opt/oracle/patch/dbpatchm -prereq -cli
Starting DBPATCHM
Logfile is /var/opt/oracle/log/dbpatchm/dbpatchm_2016-12-30_05:34:12.log
Config file is /var/opt/oracle/patch/dbpatchm.cfg

INFO: cdb is set to : no 
INFO: dbversion detected : 11204 
INFO: patching type : psu 

WARN: inventory check: patch 23698582 installed is a oneoff - which could be lost in upgrade process 
WARN: and it can be reinstalled manually if needed, post upgrade. 
WARN: inventory check: patch 19272701 installed is a oneoff - which could be lost in upgrade process 
WARN: and it can be reinstalled manually if needed, post upgrade. 
WARN: inventory check: patch 20475845 installed is a oneoff - which could be lost in upgrade process 
WARN: and it can be reinstalled manually if needed, post upgrade. 
WARN: inventory check: patch 19469538 installed is a oneoff - which could be lost in upgrade process 
WARN: and it can be reinstalled manually if needed, post upgrade. 
WARN: inventory check: patch 22366322 installed is a oneoff - which could be lost in upgrade process 
WARN: and it can be reinstalled manually if needed, post upgrade. 
WARN: inventory check: patch 19490948 installed is a oneoff - which could be lost in upgrade process 
WARN: and it can be reinstalled manually if needed, post upgrade. 
WARN: inventory check: patch 20869721 installed is a oneoff - which could be lost in upgrade process 
WARN: and it can be reinstalled manually if needed, post upgrade. 
WARN: inventory check: patch 18043064 installed is a oneoff - which could be lost in upgrade process 
WARN: and it can be reinstalled manually if needed, post upgrade. 
WARN: inventory check: patch 23745609 installed is a oneoff - which could be lost in upgrade process 
WARN: and it can be reinstalled manually if needed, post upgrade. 
WARN: inventory check: patch 23177551 installed is a oneoff - which could be lost in upgrade process 
WARN: and it can be reinstalled manually if needed, post upgrade. 
WARN: inventory check: patch 23054359 installed is a psu - upgrade will bring in newer s/w bits 
INFO: there are interim patches installed - please check /var/opt/oracle/log/dbpatchm/invlog for details 
oss_patch: Database version is required 
dbpatchm Execution completed

No luck! I found a thread on Oracle Community saying we need to update dbaascli package (cloud tooling).

So I tried to check my version:

[root@TEST11 ~]# dbaascli dbpatchm --run -list_tools
DBAAS CLI version 1.0.0
Executing command dbpatchm --run -list_tools -cli
/var/opt/oracle/patch/dbpatchm -list_tools -cli
Starting DBPATCHM
Logfile is /var/opt/oracle/log/dbpatchm/dbpatchm_2016-12-30_05:40:51.log
Config file is /var/opt/oracle/patch/dbpatchm.cfg

INFO: cdb is set to : no 
INFO: dbversion detected : 11204 
INFO: patching type : psu 

dbpatchm Execution completed

Not very informative at the beginning! Then I read the log file and see that there’s an update available for dbaascli:

2016-12-30 05:40:53 - Output from cmd rpm -qa|grep -i dbaastools run on localhost  is:
2016-12-30 05:40:54 - dbaastools-1.0-1+16.4.5.0.0_161107.1102.x86_64
2016-12-30 05:40:54 - cmd took 1 seconds
2016-12-30 05:40:54 - INFO: rpmstr is : dbaastools-1.0-1+16.4.5.0.0_161107.1102.x86_64 
2016-12-30 05:40:54 - INFO: rpmdate is : 161107 
2016-12-30 05:40:54 - INFO: rpmdate returned from get_rpm_date : 161107 
2016-12-30 05:40:55 - INFO: total rpm's available for this version: 2 
2016-12-30 05:40:55 -    --------------
2016-12-30 05:40:55 -    | rpm      : 16.4.3.1_161117.0929
2016-12-30 05:40:55 -    | dated    : 161117
2016-12-30 05:40:55 -    | description: DBAAS Tools for Oracle Public Cloud
2016-12-30 05:40:55 -    --------------
2016-12-30 05:40:55 -    --------------
2016-12-30 05:40:55 -    | rpm      : 16.4.5.1_161213.1526
2016-12-30 05:40:55 -    | dated    : 161213
2016-12-30 05:40:55 -    | description: DBAAS Tools for Oracle Public Cloud
2016-12-30 05:40:55 -    --------------

According to the Oracle documents, I need to update the dbaascli package using dbaascli itself:

[root@TEST11 ~]# dbaascli dbpatchm --run -toolsinst -rpmversion=16.4.5.1_161213.1526
DBAAS CLI version 1.0.0
Executing command dbpatchm --run -toolsinst -rpmversion=16.4.5.1_161213.1526 -cli
/var/opt/oracle/patch/dbpatchm -toolsinst -rpmversion=16.4.5.1_161213.1526 -cli
Starting DBPATCHM
Logfile is /var/opt/oracle/log/dbpatchm/dbpatchm_2016-12-30_05:47:10.log

WARN : Parameter toolsinst passed via cmdline is not a valid parameter. Please check the usage.
Config file is /var/opt/oracle/patch/dbpatchm.cfg

INFO: cdb is set to : no 
INFO: dbversion detected : 11204 
INFO: patching type : psu 

INFO: existing dbaastools version - dbaastools-1.0-1+16.4.5.0.0_161107.1102.x86_64
 
INFO: updated dbaastools rpm to - dbaastools.rpm 
dbpatchm Execution completed

There’s a warning but it seems it’s updated. I execued “dbaascli dbpatchm –run -list_tools” again, check the logs and saw that it’s updated.

I used dbaascli to check prerequisites and see the same output with my previous one. So I felt like it didn’t work. To be sure, I also tried to check prerequisites on the Oracle Database Cloud Service Console, and it completed OK this time.

I tried to compare logs of my previous dbaascli runs, and I noticed that even you use web console to patch your database or check prerequisites of a patch, and I discovered that my first attempt failed because of dbaastools version!

2016-12-29 06:59:45 - INFO: Conflicting Patchid : 23745609 
2016-12-29 06:59:45 - INFO: Patchid 23745609 is NOT PSU 
2016-12-29 06:59:45 - INFO: Conflicting Patchid : 24006111 
2016-12-29 06:59:45 - INFO: Patchid 24006111 is PSU 
2016-12-29 06:59:45 - INFO: Conflicting patchid 23745609 to be checked with rollback string
2016-12-29 06:59:45 - INFO: Patchid 23745609 is PRESENT in rollback string 
2016-12-29 06:59:45 - force & ignore_patch_conflict are : 0 & 0
2016-12-29 06:59:45 - 
INFO: dbaastools version check
2016-12-29 06:59:45 - Current dbaastools version - dbaastools-1.0-1+16.4.5.0.0_161107.1102.x86_64

2016-12-29 06:59:45 - Output from cmd rm -f /var/opt/oracle/log/dbpatchm/inst_type.txt run on localhost  is:
2016-12-29 06:59:45 - cmd took 0 seconds
2016-12-29 06:59:46 - INFO: DB status is: 1 and is_stdby is set to : no
2016-12-29 06:59:47 - INFO: dbversion is 11.2.0.4.160719 
2016-12-29 06:59:48 - 
INFO: recommended version: 161117, required version: 161117 and url: https://storage.us2.oraclecloud.com/v1/dbcsswlibp-usoracle29538/dbaas_patch/dbaastools.rpm 
2016-12-29 06:59:48 - ERROR: please update the dbaastools version from https://storage.us2.oraclecloud.com/v1/dbcsswlibp-usoracle29538/dbaas_patch/dbaastools.rp
m
2016-12-29 06:59:48 - 
INFO: cstate updated for 1

At least I found where the logs are located!

You can find the logs of database patching process in /var/opt/oracle/log/dbpatchm/ folder.

I clicked “patch” on the action button. It asks me to enter a note and if I want to force the patch apply, I just entered “it’s so easy to patch :)” and click “patch” button.

I waited about 25 minutes to see the latest patch is applied and database is up! After all this work, I remembered that some people say there’s no need for DBAs for managing databases in the cloud 🙂

关注dbDao.com的新浪微博

扫码加入微信Oracle小密圈,了解Oracle最新技术下载分享资源

TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569