Upgrading by re-initializing Db2 HADR databases

You can disable HADR to upgrade the Db2 primary and standby database instances.

Before you begin

You must stop and disable HADR on your primary and standby database instances:

  • On the primary and standby database instances, run the following command from the Db2 engine pod to stop HADR:
    manage_hadr -stop
  • On the primary HADR database instances, Exec into the Db2 engine pod and remove the /mnt/blumeta0/home/db2inst1/governor/db2.yml file to ensure that automation does not detect it as an HADR instance.
  • If you have configured HADR using a Db2uHADR custom resource (CR), then run the following command to delete the CR:
    oc delete db2uhadr <db2uhadr instance name>

Transition standby database instances to Active state:

  • On the standby database instances, Exec into the Db2 engine pod and run the following command:
    su - db2inst1 -c "db2 rollforward db <DBNAME> complete"
  • On the standby database instances, Exec into the Db2 engine pod and run the following command:
    su - db2inst1 -c "db2 connect to <DBNAME>

Procedure

  1. From the command-line, select the Edit Db2uCluster or Edit Db2uInstance tab.
  2. 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 or Edit Db2uInstance.
  3. 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.
    Note: For more information about Db2 versions for different IBM® Software Hub platforms, see Db2 compatible versions for IBM Software Hub versions.

    This executes the db2ckupgrade command in a Kubernetes job to check if your current instance has the required upgrade compatibility. If the db2ckupgrade command in the Kubernetes job is successful, it will initiate the upgrade on your primary instance. If the db2ckupgrade command returns UpgradeCheckFailed, see Troubleshooting db2ckupgrade failure during the service instance upgrade to resolve the issue

    When the upgrade is completed, your custom resource changes to a Ready state and displays version 12.1.0.0 in the status. The upgrade job also runs post-upgrade operations, including applying database and registry configuration, as well as enabling additional features.
  4. To upgrade stand-by instances, repeat the steps on each standby instance.
    Note: The upgrade job will not run post-upgrade operations on the stand-by instances.
  5. Re-initialize HADR:
    1. Complete the steps in Configuring and starting HADR for Db2.
    2. Monitor the upgrade progress to ensure primary and standby instances in your HADR deployment are in PEER state. Exec into the Db2 engine pod on your primary instance and run the following command:
      manage_hadr -status