Exec into the Db2 pod

To complete common administration tasks, you must be able to run the exec command on the Db2 pod.

Best practice: You can run the commands in this task exactly as written if you set up environment variables. For instructions, see Setting up installation environment variables.

Ensure that you source the environment variables before you run the commands in this task.

Procedure

  1. Find the Db2uCluster or Db2uInstance resource names and create Db2uCluster or Db2uInstance environment variables by running the following commands:
    oc get db2ucluster,db2uinstance --all-namespaces
    export DB2_CR_ID=<db2ucluster_resource_name/db2uinstance_resource_name>
  2. Find the name of your Db2 pod for your database deployment:
    db2_podname=$(oc -n ${PROJECT_CPD_INST_OPERANDS} get po --selector name=dashmpp-head-0 | grep ${DB2_CR_ID} | awk {'print $1'})
  3. Run the exec command to exec into the Db2 pod:
    oc -n ${PROJECT_CPD_INST_OPERANDS} exec -it ${db2_podname} -- bash