Exec into the Db2 pod

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

Before you begin

To be able to copy commands and run them on your system without modification, complete a one-time setup of a variety of installation environment variables. For example, the PROJECT_CPD_INSTANCE environment variable defines the namespace of your database deployment. For more information, see Setting up installation environment variables.

Procedure

  1. To find the respective db2ucluster resource name and create a db2ucluster environment variable, run the following commands:
    oc get db2ucluster --all-namespaces
    db2ucluster=db2ucluster_resource_name
  2. Find the name of your Db2 pod for your database deployment:
    db2_podname=$(oc -n ${PROJECT_CPD_INSTANCE} get po --selector name=dashmpp-head-0 | grep ${db2ucluster} | awk {'print $1'})
  3. Run the exec command to exec into the Db2 pod:
    oc -n ${PROJECT_CPD_INSTANCE} exec -it ${db2_podname} -- bash