Upgrading by re-initializing HADR deployments

You can disable HADR to upgrade the Db2 or Db2 Warehouse primary and standby database instances and re-enabling it.

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 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

Note: If your deployment uses the restricted-v2 SCC, commands that require switching users or elevated privileges are not supported. Perform all steps as the Db2 instance user within the container. For more information, see Deploying Db2 or Db2 Warehouse with non-root deployment.

  1. From the console of your OpenShift cluster, select the Db2uCluster 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.
  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.

    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.

    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 steps 1-3 on each standby instance.
    Note: The upgrade job will not run post-upgrade operations on the stand-by instances.
  5. Re-initialize HADR:
    1. Perform all the steps in Configuring and starting HADR.
    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