I have a DB2 and TDS installation on docker instance, when I try to start my TDS instance I get the following error
GLPSRV200I Initializing primary database and its connections.
GLPRDB001E Error code -1 from function:" SQLConnect " ldapdb2b .
12/11/2017 10:51:34 0 0 SQL1042C An unexpected system error occurred.
SQL1032N No start database manager command was issued. SQLSTATE=57019
GLPRDB004E The directory server is unable to connect to the database.
GLPSRV064E Failed to initialize be_config.
GLPSRV040E Server starting in configuration only mode due to errors.
Digging deeper, I accessed the logs on instance owner home /home/dsrdbm01/idsslapd-dsrdbm01/logs/ and tailed the db2cli.log to find the following:
2017-12-11-10:50:32.native retcode = -1032; state = "57019"; message = "SQL1032N No start database manager command was issued. SQLSTATE=57019"
2017-12-11-10:50:32native retcode = -1032; state = "08001"; message = "[IBM][CLI Driver] SQL1032N No start database manager command was issued.` SQLSTATE=57019
I figured that I needed to start the DB manager using the db2start command, so I access the db2 bin from the installation folder on /opt/IBM/db2/V9.7/bin/, SU'ed as instance owner and then typed db2start to get the following:
[dsrdbm01@b4aa75a27ceb bin]$ db2start
12/11/2017 11:03:11 0 0 SQL1042C An unexpected system error occurred.
SQL1032N No start database manager command was issued. SQLSTATE=57019
Below are the system details:
CentOS Linux release 7.3.1611 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
CentOS Linux release 7.3.1611 (Core)
EDIT: Running DB2Diag I got the result below:
Now I am in a closed loop, any help is appreciated.
On UNIX operating systems, after allocating the initial database memory size on database activation, DB2 allocates additional memory as needed to support dynamic requirements.
DB2 has a problem where it needs more shared memory than Docker originally provides, and hence the problem above happens
To solve this, DB2 needs to run in docker under what is called "Privileged Mode". Docker support site defines it as follows
The --privileged flag gives all capabilities to the container, and it also lifts all the limitations enforced by the device cgroup controller. In other words, the container can then do almost everything that the host can do. This flag exists to allow special use-cases, like running Docker within Docker.
To resolve the error above, you need to run the container in privileged mode, that is:
$ docker run --privileged=true ...
This will increase the max shared memory size, and consequently resolves the whole situation.