Db2 reference
This topic lists the configurable parameters and their default values for the Db2 Community Edition Version 11.5.4.0 deployment on OCP. It also contains sample code for the create_database.sh script.
Configurable parameters and default values for Db2 Community Edition (on OCP)
The following table lists the configurable parameters and default values for Db2 Community
Edition Version 11.5.4.0.
Parameter | Description | |
---|---|---|
dedicated | Enforce that Db2 is scheduled on worker nodes that haved been labeled and tainted with icp4data=${value}. Use with option global.nodeLabel.value below. | true |
subType | Database subtype can be either [smp, mpp] for db2wh. For db2oltp, the subtype is smp. | smp |
arch | The helm chart will try to detect the architecture based on the master node. Choose an explicit architecture here to overwrite it. | x86_64 |
mln.total | The total number of MLNs to be used and evenly spread out to the number of worker nodes. | 1 |
global.dbType | Database type can be either [db2wh, db2oltp] | db2oltp |
global.nodeLabel.value | Value for the node label in order to deploy Db2 on a dedicated node. The node must be labeled and tainted with icp4data=${value} | |
images.universalTag | The tag specified here will be used by all images except those that explicitly specify a tag. | latest |
images.pullPolicy | Always, Never, or IfNotPresent. Defaults to Always | IfNotPresent |
images.auth.image.tag | The tag for the version of the LDAP authentication container | 11.5.4.0-56 |
images.auth.image.repository | The container is deployed to serve as an LDAP server for database authentication if ldap.enabled is true and no ldap server is not specified | icr.io/obs/hdm/db2u/db2u.auxiliary.auth |
images.rest.image.tag | The container tag that is used to pull the version of the rest container. | 11.5.4.0-56 |
images.rest.image.repository | The REST container image, which is used to perform host the REST sever | icr.io/obs/hdm/db2u/db2u.rest |
images.etcd.image.tag | The etcd conatiner tag that used to pull the version of the needed container. | 3.3.10-56 |
images.etcd.image.repository | The etcd container is used in MPP configurations to automate the failover of MPP nodes | icr.io/obs/hdm/db2u/etcd |
images.instdb.image.tag | The container tag that is used to pull the version of the Database and instance payload container | 11.5.4.0-56 |
images.instdb.image.repository | This container carries the payload required to restore a database and instance into a newly deployed release. | icr.io/obs/hdm/db2u/db2u.instdb |
images.db2u.replicas | The number of Db2 Warehouse pods that will serve the database. Replica count of 1 signifies SMP and 2 and more is an MPP configuration. | 1 |
images.db2u.image.tag | The container tag that is used to pull the version of Db2 Warehouse main engine container. | 11.5.4.0-56 |
images.db2u.image.repository | The main database engine for the Db2 Warehouse release | icr.io/obs/hdm/db2u/db2u |
images.tools.image.tag | The container tag that is used to pull the version of the tools container. | 11.5.4.0-56 |
images.tools.image.repository | The tools container image, which is used to perform outside of the engine operations | icr.io/obs/hdm/db2u/db2u.tools |
database.name | The name of the database. Defaults to BLUDB | BLUDB |
database.pageSize | The default database page size. Defaults to 32768. | 32768 |
database.bluadminPwd | Password for the LDAP database administrator which is the main LDAP user | |
database.codeset | The default database codeset. Defaults to UTF-8. | UTF-8 |
database.collation | The default database collation sequence. Defaults to IDENTITY. | IDENTITY |
database.territory | The default database territory. Defaults to US. | US |
storage.storageClassName | Choose a specific storage class name to use during deployment. A storage class offers the foundation for dynamic provisioning. | |
storage.existingClaimName | Name of an existing Persistent Volume Claim that references a Persistent Volume | |
storage.useDynamicProvisioning | If dynamic provisioning is available in the cluster this option will automatically provision the requested volume if set to true. | False |
instance.db2Support4K | Db2 supports storage devices that use a 4KB sector size in production environments. Default to false. | False |
limit.cpu | CPU cores limit to apply to Db2. Db2 won't be able to exceed the provided value. | 2 |
limit.memory | Memory limit to apply to Db2. Db2 won't be able to exceed the provided value. | 4.3Gi |
Sample code for the create_database.sh script
When setting up a Db2 database for the application discovery service on OCP, you have to copy and
paste the following code into the create_database.sh
script.
#!/bin/sh
#/*******************************************************************************
#*
#* Copyright © Aricent Holdings Luxembourg S.a.r.l. 2020. All rights reserved.
#*
#******************************************************************************/
#//
#////////////////////////////// End Standard Header /////////////////////////////*/
############### Begin Standard Header - Do not add comments here ###############
#
# File: %W%
# Version: %I%
# Modified: %G% %U%
# Build: %R% %L%
#
# Licensed Materials - Property of IBM
#
# Restricted Materials of IBM
#
# 5724-N55
#
# (C) COPYRIGHT IBM CORP. 2007, 2011. All Rights Reserved.
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
############################# End Standard Header ##############################
# set -x
if test -z "$1"
then
echo "Usage: $0 <database_name>"
exit 1
fi
tune_db_noauto() {
echo "SUCCESS: Create database $1 completed."
db2 <<EOF
connect to $1
alter bufferpool IBMDEFAULTBP SIZE 240000
create bufferpool BUF8K immediate size 384 pagesize 8k
create bufferpool BUF32K immediate size 384 pagesize 32k
connect reset
connect to $1
create tablespace userspace2 pagesize 32k managed by system using ('usercont2') bufferpool BUF32K
create large tablespace largespace2 pagesize 32k managed by database using (file 'largedata' 2560) bufferpool BUF32K
create system temporary tablespace largetemp2 pagesize 32k managed by system using ('systemp2') bufferpool BUF32K
create tablespace USERSPACE3 pagesize 8k managed by system using ('usercont3') bufferpool BUF8K
alter bufferpool BUF8K SIZE 40000
alter bufferpool BUF32K SIZE 8000
update db cfg using LOGFILSIZ 8192
update db cfg using LOGBUFSZ 1024
update db cfg using LOGPRIMARY 12
update db cfg using LOGSECOND 40
update db cfg using CATALOGCACHE_SZ 4000
update db cfg using PCKCACHESZ 4096
update db cfg using AVG_APPLS 3
update db cfg using NUM_IOCLEANERS automatic
update db cfg using NUM_IOSERVERS 10
update db cfg using DFT_DEGREE ANY
update db cfg using APP_CTL_HEAP_SZ 4000
update db cfg using MAXLOCKS 35 LOCKLIST 20000
update db cfg using SHEAPTHRES_SHR MANUAL SORTHEAP 8000
update db cfg using AUTO_MAINT OFF
update db cfg using UTIL_HEAP_SZ 8000
update db cfg using DBHEAP 8000
update db cfg using APPLHEAPSZ 2000
disconnect $1
quit
EOF
db2set DB2_EVALUNCOMMITTED=YES
db2set DB2_SELECTIVITY=DSCC
}
tune_db_auto() {
echo "SUCCESS: Create database $1 completed."
if test "$version" -ne "9"
then
USE_AUTOMATIC=YES
PARAM_VAL=AUTOMATIC
else
USE_AUTOMATIC=
fi
db2 connect to $1
if [ -z "$USE_AUTOMATIC" ]; then PARAM_VAL=240000; fi
db2 alter bufferpool IBMDEFAULTBP SIZE $PARAM_VAL
db2 <<EOF
create bufferpool BUF8K immediate size 384 pagesize 8k
create bufferpool BUF32K immediate size 384 pagesize 32k
connect reset
connect to $1
create tablespace userspace2 pagesize 32k managed by automatic storage bufferpool BUF32K
create large tablespace largespace2 pagesize 32k managed by automatic storage bufferpool BUF32K
create system temporary tablespace largetemp2 pagesize 32k managed by automatic storage bufferpool BUF32K
create tablespace USERSPACE3 pagesize 8k managed by automatic storage bufferpool BUF8K
update db cfg using LOGFILSIZ 8192
update db cfg using LOGBUFSZ 1024
update db cfg using LOGPRIMARY 12
update db cfg using LOGSECOND 40
update db cfg using CATALOGCACHE_SZ 4000
update db cfg using PCKCACHESZ 4096
update db cfg using AVG_APPLS 3
update db cfg using NUM_IOCLEANERS automatic
update db cfg using NUM_IOSERVERS 10
update db cfg using DFT_DEGREE ANY
update db cfg using APP_CTL_HEAP_SZ 4000
update db cfg using MAXLOCKS 35 LOCKLIST 20000
update db cfg using AUTO_MAINT OFF
EOF
if [ -z "$USE_AUTOMATIC" ]; then PARAM_VAL=40000; fi
db2 alter bufferpool BUF8K SIZE $PARAM_VAL
if [ -z "$USE_AUTOMATIC" ]; then PARAM_VAL=8000; fi
db2 alter bufferpool BUF32K SIZE $PARAM_VAL
if [ -z "$USE_AUTOMATIC" ]
then
db2 update db cfg using SHEAPTHRES_SHR MANUAL SORTHEAP 8000
else
db2 update db cfg using SHEAPTHRES_SHR AUTOMATIC SORTHEAP AUTOMATIC
fi
if [ -z "$USE_AUTOMATIC" ]; then PARAM_VAL=8000; fi
db2 update db cfg using UTIL_HEAP_SZ $PARAM_VAL
if [ -z "$USE_AUTOMATIC" ]; then PARAM_VAL=8000; fi
db2 update db cfg using DBHEAP $PARAM_VAL
if [ -z "$USE_AUTOMATIC" ]; then PARAM_VAL=2000; fi
db2 update db cfg using APPLHEAPSZ $PARAM_VAL
db2 disconnect $1
db2 quit
echo ""
echo "-------------------$1 Instance Created Successfully----------------------"
echo ""
db2set DB2_EVALUNCOMMITTED=YES
db2set -immediate DB2_SELECTIVITY=DSCC 2>&1 >/dev/null || db2set DB2_SELECTIVITY=DSCC
}
db2cfexp /tmp/db2cfg.$$ maintain
output=`cat /tmp/db2cfg.$$ | grep -i "^\[DB>.*:$1\]"`
rm -f /tmp/db2cfg.$$
# Get db2 version from db2cfexp command. Donot use db2level because
# output could be translated
db2cfexp /tmp/db2cfg.$$ maintain
version_str=`cat /tmp/db2cfg.$$ | grep "APPLICATION=" | awk '{print $2}'`
echo "DB2 version $version_str"
# Check if db already exists
dbName=`db2 list db directory | grep "Database name" | awk '{print $4}' | grep -w -i $1`
dbName=`echo $dbName | tr '[:upper:]' '[:lower:]'`
userDbName=`echo $1 | tr '[:upper:]' '[:lower:]'`
if [ "$userDbName" = "$dbName" ]
then
echo ""
echo "INFO: Database with same name $1 already exists."
exit 3
fi
release=`echo $version_str | cut -c 3`
version=`echo $version_str | cut -c 1`
rm -f /tmp/db2cfg.$$
if test "$version" -eq 9 -a "$release" -eq 8 -o "$version" -eq 0 -a "$release" -eq 1 -o "$version" -eq 0 -a "$release" -eq 5 -o "$version" -eq 1 -a "$release" -eq 1 -o "$version" -eq 1 -a "$release" -eq 5
then
db2 create db $1 using codeset UTF8 territory US
if test "$?" -eq 0
then
tune_db_auto $1
else
echo "ERROR: Create database $1 failed."
exit 2
fi
else
if test "$version" -eq 9
then
db2 create db $1 automatic storage no using codeset UTF8 territory US
if test "$?" -eq 0
then
tune_db_noauto $1
else
echo "ERROR: Create database $1 failed."
exit 2
fi
else
echo "Unsupported DB2 version $version_str"
exit 1
fi
fi