You can change configuration settings after you deploy your instance by editing the Db2uCluster or Db2uInstance custom resource.
About this task
After you deploy your Db2 instance, you can edit the Db2uCluster or Db2uInstance custom resource to change the following
Db2 configuration settings:
Note: Modifying configuration settings can impact system behavior and
stability.
Procedure
- Find the Db2uCluster or Db2uInstance custom resource
that you want to configure and assign it to an environment variable.
- Retrieve a list of your Db2uCluster and Db2uInstance custom resources from
in the IBM® Software
Hub web client, or by running the following
command:
oc get db2ucluster,db2uinstance -n ${PROJECT_CPD_INST_OPERANDS}
- Set the Db2uCluster or Db2uInstance custom
resource name to the DB2_CR_ID environment variable:
DB2_CR_ID=<db2ucluster_cr_name/db2uinstance_cr_name>
For example, DB2_CR_ID=db2oltp-1748840598043123
- Run the following command to edit the
Db2uCluster or
Db2uInstance custom resource:
oc edit db2ucluster ${DB2_CR_ID} -n ${PROJECT_CPD_INST_OPERANDS}
oc edit db2uinstance ${DB2_CR_ID} -n ${PROJECT_CPD_INST_OPERANDS}
- Change the following configuration settings.
- Database configuration parameters
- To find your database configuration parameters, see the
yaml path
spec.environment.database.dbConfig. Under the key dbConfig,
you can add, edit, or delete a key-value pair. Values must be enclosed in quotation marks.
For example, setting the parameter LOGPRIMARY to 50 for the database
BLUDB would appear as follows:
spec:
environment:
database:
dbConfig:
LOGPRIMARY: "50"
name: BLUDB
For more information, see Database configuration parameters in the Db2
documentation.
- Database manager configuration parameters
- To find your database manager configuration parameters, see the
yaml path:
spec.environment.instance.dbmConfig.Under the key dbmConfig,
you can add, edit, or delete a key-value pair. Values must be enclosed in quotation marks. For
example, setting the parameter DIAGSIZE to 50 would appear as
follows:
spec:
environment:
instance:
dbmConfig:
DIAGSIZE: "100"
For more information, see Database manager configuration parameters in Db2 documentation.
- Registry and environment variables
- Registry configuration parameters are found under the
yaml path:
spec.environment.instance.registry.Under the key registry, you
can add, edit, or delete a key-value pair. Values must be enclosed in quotation marks. For example,
setting the parameter DB2_DISPATCHER_PEEKTIMEOUT to 5 would appear as
follows:
spec:
environment:
instance:
registry:
DB2_DISPATCHER_PEEKTIMEOUT: "5"
For more information, see Registry and environment variables in the Db2
documentation.
- To change the name of the default Db2 database,
complete the following steps.
- Run the following command, substituting the new default database name for
MYDB:
oc patch db2ucluster -n ${PROJECT_CPD_INST_OPERANDS} ${DB2_CR} --type merge -p '{"spec":{"environment":{"database":{"name":"MYDB"}}}}'
oc patch db2uinstance -n ${PROJECT_CPD_INST_OPERANDS} ${DB2_CR} --type merge -p '{"spec":{"environment":{"database":{"name":"MYDB"}}}}'
- Verify that the corresponding db2uconfig configMap reflects the
changed DBNAME value:
oc get cm -n ${PROJECT_CPD_INST_OPERANDS} -o yaml c-${DB2_CR}-db2uconfig | grep DBNAME
- Find the engine pod of the database that you want to change by running the following
command:
DB2_ENG_POD=$(oc get po -l app=${DB2_CR},type=engine)
- Delete one or more corresponding Db2 engine pods to enable the
configMap changes to take effect.
oc delete pods -n ${PROJECT_CPD_INST_OPERANDS} ${DB2_ENG_POD}
- Exec into the Db2 engine pod as the
db2inst1 user and
use the following command to apply the updates:
oc exec -it c-${DB2_CR_ID}-db2u-0 -- su - db2inst1 -c "/db2u/scripts/apply-db2cfg-settings.sh --setting all"