To apply a Patch on a Database which is hosted by Oracle is done with one mouse click. This service is available only if you have selected the full database service during the DBaaS order process.
To the manual: https://docs.oracle.com/cloud/latest/dbcs_dbaas/CSDBI/GUID-50BDEF7D-A30E-4B32-BAE7-486538413E2D.htm#CSDBI3422
Patchset Availability
As soon as a new Oracle patchset is available, you can see that in the database management dashboard of the selected database. The precheck function verifies if the selected database is ready to patch.
Precheck Result
After 2 until 3 minutes and a refresh of the page you see the result.
Command Line Interface dbpatchm
If you have no web access, all these steps can be executed manually in the shell. Therefore a command line tool called dbpatchm is available. You have to login as user root before using this tool.
List of available commands:
bash-4.1# dbaascli dbpatchm DBAAS CLI version 1.0.0 Executing command dbpatchm Command Error Command: dbpatchm Help for DB patching Parameters: --run Format: Not defined Required: YES dbpatchm --run -prereq dbpatchm --run -setup dbpatchm --run -config dbpatchm --run -apply dbpatchm --run -clonedb dbpatchm --run -cleanup dbpatchm --run -reset dbpatchm --run -list_patches dbpatchm --run -rollback
To the dbpatchm Documentation: https://docs.oracle.com/cloud/latest/dbcs_dbaas/CSDBI/GUID-50BDEF7D-A30E-4B32-BAE7-486538413E2D.htm#CSDBI3422
Patch Apply
If the prerequisite check is successful, we can apply the patch by selecting Patch.
If there are any Java Cloud Services (Weblogic Servers) which are using the selected database too, you can force to apply the patchset.
The patch progress is show in the dashboard.
In the background, Oracle transfers a new Oracle image where the selected PSU is already applied, extract it and changes the /u01/app location afterwards. During the patch apply process, the image is located under /u01/donwload:
oracle@TrivadisExPerf:/u01/download/ [TVDEXPER] ls -la total 3306792 drwxr-x--- 2 oracle oinstall 4096 Sep 7 12:34 . drwxr-xr-x 8 oracle oinstall 4096 Sep 7 12:34 .. -rw-r----- 1 oracle oinstall 3386140254 Jul 23 20:00 db12.1.0.2.0_EE_PSU_1507.tar.gz
Patch installed
After 45 minutes, the database is patched and up and running again.
The verification with OPatch shows the correct patch numbers. Here is an extract from the OPatch output. You can see that the apply-date is the 14th of July and that Oracle has installed bundle patch with patches for the RDBMS and the OJVM. I remember, in the background Oracle extracts a fully patched ORACLE_BASE / ORACLE_HOME directory for later usage.
oracle@TrivadisExPerf:/u01/app/oracle/product/12.1.0/dbhome_1/OPatch/ [TVDEXPER] ./opatch lsinventory ... Patch 21068507 : applied on Tue Jul 14 23:05:57 UTC 2015 Unique Patch ID: 18985494 Patch description: "Database PSU 12.1.0.2.4, Oracle JavaVM Component (Jul2015)" Created on 18 Jun 2015, 21:51:33 hrs PST8PDT Bugs fixed: 19895326, 19877336, 19699946, 19153980, 20408829, 21047766, 19231857 19895362, 19909862, 19855285, 20415564, 19245191, 21047803, 19223010 20408866, 21068507 Patch 20831110 : applied on Tue Jul 14 23:04:16 UTC 2015 Unique Patch ID: 18977826 Patch description: "Database Patch Set Update : 12.1.0.2.4 (20831110)" Created on 11 Jul 2015, 00:45:40 hrs PST8PDT Sub-patch 20299023; "Database Patch Set Update : 12.1.0.2.3 (20299023)" Sub-patch 19769480; "Database Patch Set Update : 12.1.0.2.2 (19769480)" ...
The data dictionary is up to date too – the query on dba_registry_patch shows the correct PSU number:
SQL> SELECT patch_id, patch_uid, version, status, description 2 FROM dba_registry_sqlpatch 3 WHERE bundle_series = 'PSU'; PATCH_ID PATCH_UID VERSION STATUS ---------- ---------- -------------------- --------------- DESCRIPTION -------------------------------------------------------------------------------- 20299023 18703022 12.1.0.2 SUCCESS Database Patch Set Update : 12.1.0.2.3 (20299023) 20831110 18977826 12.1.0.2 SUCCESS Database Patch Set Update : 12.1.0.2.4 (20831110)
Patching kills the EM12c Agent
Oracle is creating a new directory for the software, the old stuff which was in directory /u01/app is copied in /u01/app.ORG. So the EM12c Agent is not available anymore.
You have two possibilities to get the EM12c agent back:
- Copy the installation directories from /u01/app.ORG back into /u01/app and re-attach the Agent Home in the inventory
- Clean up the agent in EM12c and execute a reinstall
To avoid future problems, you can attach a new disk and use them for the agent or for other tools.
Summary
Patching a DBaaS database in the Oracle Cloud is very easy. All important steps are done automatically. In the background Oracle creates a new ORACLE_BASE directory in /u01. But you have to take care about installing your own tools or for example an EM12c agent. Also the database logs are no more available in the base directory. But you can find the in an subfolder of the direcory /u01/app.ORG where the old stuff is located.