Shutting down and restarting a Db2 Warehouse instance

You can temporarily shut down a Db2 Warehouse instance that you are not using to reduce resource consumption.

Shutting down an instance

  1. Run the following command to retrieve a list of your instances for Db2uCluster and Db2uInstance:
    oc get db2ucluster,db2uinstance --all-namespaces
    Find the instance_id of the instance that you want to shut down and export it with export INSTANCE=<instance_id>.
  2. Run the following command for Db2uCluster or Db2uInstance to patch on the instance that you want to shut down:

    For Db2uCluster:

    oc patch db2u ${INSTANCE} -n ${PROJECT_CPD_INST_OPERANDS} --type=merge --patch '{"metadata":  {"annotations": {"db2u.databases.ibm.com/maintenance-shutdown":  "true"}}}'

    For Db2uInstance:

    oc patch db2 ${INSTANCE} -n ${PROJECT_CPD_INST_OPERANDS} --type=merge --patch '{"metadata":  {"annotations": {"db2u.databases.ibm.com/maintenance-shutdown":  "true"}}}'
  3. Wait for the Db2uCluster or Db2uInstance to show Ready status under STATE and Shutdown status under MAINTENANCESTATE.
  4. Ensure that the engine pod and the etcd pod have been terminated.

Restarting an instance

  1. Run the following command to retrieve a list of your instances for Db2uCluster and Db2uInstance:
    oc get db2ucluster,db2uinstance --all-namespaces
    Find the instance_id of the instance that you want to restart.
  2. Run the following command on the instance that you want to restart:

    For Db2uCluster:

    oc patch db2u ${INSTANCE} -n ${PROJECT_CPD_INST_OPERANDS} --type=merge --patch '{"metadata":  {"annotations": {"db2u.databases.ibm.com/maintenance-shutdown":  "false"}}}'

    For Db2uInstance:

    oc patch db2 ${INSTANCE} -n ${PROJECT_CPD_INST_OPERANDS} --type=merge --patch '{"metadata":  {"annotations": {"db2u.databases.ibm.com/maintenance-shutdown":  "false"}}}'
  3. Wait for the Db2uCluster or Db2uInstance to show Ready status under STATE and None status under MAINTENANCESTATE.
  4. Ensure that the engine pod and the etcd pod are started and running.