You can upgrade your Db2 or Db2 Warehouse server by editing the source YAML of the custom
resource (CR) that is associated with your Db2 or Db2 Warehouse on Red Hat
OpenShift cluster.
Before you begin
- To upgrade to Db2 or Db2 Warehouse version
12.1, ensure that you are on Db2 or Db2 Warehouse
version 11.5.9.0- cn2 or later.
- Ensure that the Db2uCluster is in a Ready state.
- Ensure that you have a back up of your current instance.
About this task
When you have updated the CR version, the Db2® Operator
automatically reconciles all the objects that were created and managed by the Db2 Operator when
the CR was first created.
The
Db2
Operator also edits the Db2 engine
OpenShift statefulset (Db2uCluster) or Db2uEngine (Db2uInstance)
CR to point to the updated images, causing your Db2 engine pods to
be recreated using the new images. This process automatically updates or upgrades Db2 on your
OpenShift
cluster.
If you have a Db2 or Db2 Warehouse license key, you can add the license to
the custom resource (CR) during the upgrade. You must first encode the license before adding it.
Procedure
- If you have a Db2 or Db2 Warehouse license,
encode the license to base64 by running the following command:
Db2:
LICENSE_KEY="./db2adv_vpc.lic"
cat ${LICENSE_KEY} | base64 | tr -d '\n'
Db2
Warehouse:
LICENSE_KEY="./dashdb_c.lic"
cat ${LICENSE_KEY} | base64 | tr -d '\n'
Save the encoded output, as you
will add it to your YAML file later in this procedure.
- From the console of your OpenShift cluster, select the Db2uCluster
tab.
- From the table, locate the custom resource (CR) that is linked to your
Db2
deployment and, from the far-right column, click the ellipses (...) and select Edit
Db2uCluster.
- In the text box that appears, go through the
YAML file and change the value of
version, under spec, to the
target version number:
spec:
version: "s12.1.<x>.<y>-cn<z>>"
where <x> is the latest mod pack number,
<y> is the latest fix pack number, and <z> is the latest container layer enhanced release
number.
If you are updating with a license, locate the
license key and
add the encode string from
step 1 as the
value key as shown in the following example:
spec:
license:
value: <ENCODED STRING FROM STEP 1>
Make the change to the
license key at the same time as editing the
version.
- Save your changes to the YAML file.
This executes the db2ckupgrade command in a Kubernetes job to check if your
current instance has the required upgrade compatibility.
- If the db2ckupgrade Kubernetes job fails, your Db2 or Db2 Warehouse custom resource changes to a
UpgradeCheckFailed state. Check the logs in the
${SUPPORTDIR}/db2_upgrade_check.log file on your Db2 engine pods to
troubleshoot.
- After you troubleshoot and resolve the issue that caused the upgrade job to fail, revert
your Db2 or Db2 Warehouse instance to the previous version on which you initiated the upgrade
process. This changes the state of your custom resource to Ready.
Access and edit the YAML file as mentioned in Step
3 and change the version.
- Follow the instruction in Step 3 to
perform the upgrade process again to upgrade your Db2 version to
12.1.
When the
db2ckupgrade validation is completed, a Kubernetes job is initiated
that upgrades your Db2 or Db2 Warehouse instance and databases. If the upgrade process is
successful, your custom resource changes to a
Ready state and displays the version
you specified in the YAML file in the status.
Note: If your Db2 or Db2 Warehouse instance upgrade
completes successfully but the database upgrade and post-upgrade tasks fail to run, you must
manually perform those upgrades. Run the following commands as the
db2inst1 from
your Db2 engine pod:
- For Db2 or Db2 Warehouse database upgrade, run the
db2_update_upgrade
--databases command.
- For Db2 or Db2 Warehouse post-upgrade operations, run the
db2_update_upgrade
--post-upgrade command.
For more information, see
db2ckupgrade - Check database for upgrade command.
If the upgrade process fails, you must review the upgrade logs to identify the issue. The logs
are present in the ${SUPPORTDIR}/upgrade_update.log file on your Db2 engine
pods.