Preparing to back up or restore Db2

Before you can run the db2 backup or db2 restore commands, you need to identify the pod where the Db2 database service is deployed.

Procedure

  1. To identify the Db2 container, run the following command on any pod in your cluster:
    kubectl get pods -n ${PROJECT_CPD_INSTANCE} | grep db2u

    This command returns a list of one or more pods for the Db2 database configuration. For a single-pod configuration, the catalog pod is always the same as the physical pod.

    A sample SMP configuration:
    db2oltp-1556786589-db2u-0                            1/1     Running     0          3h54m
  2. Exit that bash shell and open a new shell to the single pod that hosts your Db2 database service.
    kubectl exec -it -n ${PROJECT_CPD_INSTANCE} db2oltp-pod -- bash

    Replace db2oltp-pod with the name of the pod that you found in the previous step.

What to do next

After you open a bash shell, you can proceed with Backing up a Db2 database offline or Restoring Db2 by using commands.