Troubleshooting
Problem
Some Db2 instances are not applying custom database configurations that were specified while deploying the instance. These instances require script modifications to be fixed.
Environment
This workaround is applicable to the Db2 service in IBM Cloud Pak for Data versions 4.6.0 to 4.6.3. The issue was fixed in Cloud Pak for Data 4.6.4.
Resolving The Problem
- To start resolving the problem, run the following commands:
source ${HOME}/.bashrc
source ${DB2U_SCRIPTS}/include/db2_functions.sh
- Exec into the Db2 pod and run the following command:
apply-db2cfg-settings
- Download the following file:
- Extract patch.zip.
- Copy over db2_memtune_functions.sh and db2_functions.sh to the cluster hosting the Db2 instance.
- Create a script titled patch_script_cm.sh with the following content:
#!/bin/bash # Example usage: ./patch_script_cm.sh db2u-oltp-v1 standalone-rc db2_memtune_functions.sh /db2u/scripts/include 644 false DB2U_ID=$1 NAMESPACE=$2 FILE="db2_memtune_functions.sh" MOUNT_PATH="/db2u/scripts/include" PERM=644 READ_ONLY=false FILENAME=$(basename -- "${FILE}") EXTENSION="${FILENAME##*.}" FILENAME="${FILENAME%.*}" CM=$(echo "${FILENAME}-${EXTENSION}" | tr '_' '-') echo "-------------------------------------------------" echo -e "(Re)creating configmap ${CM}...\n" kubectl create -n ${NAMESPACE} configmap ${CM} --from-file=${FILE}=${FILE} -o yaml --dry-run=client | kubectl apply -f - echo -e "\n-------------------------------------------------" echo -e "Mounting ${CM} CM to ${DB2U_ID} statefulset..." DB2U_STS=c-${DB2U_ID}-db2u oc set volume statefulset/${DB2U_STS} -n ${NAMESPACE} --add --name=${CM} --type=configmap --containers=db2u --mount-path="${MOUNT_PATH}/${FILE}" --sub-path="${FILE}" --configmap-name=${CM} --default-mode="${PERM}" --read-only=${READ_ONLY} --overwrite
- Run your script twice.
- Retrieve the respective db2ucluster resource name and create a db2ucluster environment variable for your instance. Refer to the following example for the commands:
oc get db2ucluster --all-namespaces
DB2U_ID=db2ucluster_resource_name
- Configure your NAMESPACE variables. Refer to the following example for the command:
NAMESPACE=$(oc get db2ucluster --all-namespaces | grep ${db2ucluster} | awk {'print $1'})
- DB2U_ID and NAMESPACE use the newly created variables.
- When you run the script for the first time, use db2_memtune_functions.sh as the third parameter.
- When you run the script for the second time, use db2_functions.sh as the third parameter.
- Refer to the following example for the commands:
chmod +x ./patch_script_cm.sh
./patch_script_cm.sh ${DB2U_ID} ${NAMESPACE} db2_memtune_functions.sh
./patch_script_cm.sh ${DB2U_ID} ${NAMESPACE} db2_functions.sh
The following warning appears:+ oc set volume statefulset/c-db2u-oltp-v1-db2u -n standalone-rc --add --name=db2-memtune-functions-sh --type=configmap --containers=db2u --mount-path=/db2u/scripts/include/db2_memtune_functions.sh --sub-path=db2_memtune_functions.sh --configmap-name=db2-memtune-functions-sh --default-mode=755 --read-only=false --overwrite warning: volume "db2-memtune-functions-sh" did not previously exist and was not overwritten. A new volume with this name has been created instead.statefulset.apps/c-db2u-oltp-v1-db2u volume updated
The warning prompt is due to the creation of the new volume. The --overwrite command is being run so the script can be reusable.
- Confirm that the new file is being used.
Inspect the StatefulSet and confirm that the new configmap mount db2-memtune-functions-sh exists. After the restart of the pod, check the timestamp of the "/db2u/scripts/include/db2_memtune_functions.sh" file within the pod to ensure that the new file is being used.
- Retrieve the respective db2ucluster resource name and create a db2ucluster environment variable for your instance. Refer to the following example for the commands:
- Before you upgrade to CPD 4.6.4 or higher, you need to remove the volume created from this procedure. Refer to the following example for the commands:
oc set volume statefulset/c-${DB2U_ID}-db2u -n ${NAMESPACE} --remove --name=db2-memtune-functions-sh
oc set volume statefulset/c-${DB2U_ID}-db2u -n ${NAMESPACE} --remove --name=db2-functions-sh
Document Location
Worldwide
[{"Type":"MASTER","Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SS5MAX","label":"IBM Cloud Pak for Data Db2"},"ARM Category":[{"code":"a8m0z000000GoylAAC","label":"Troubleshooting"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]
Was this topic helpful?
Document Information
Modified date:
12 May 2023
UID
ibm16955985