DB21015E on RedHat 5.6

max queues system wide = 16
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536

$ sysctl -a | grep shm
 vm.hugetlb_shm_group = 0
 kernel.shmmni = 4096
 kernel.shmall = 4294967296
 kernel.shmmax = 68719476736

So we have a maximum of 4096 shared memory segments, 128 Semaphore Arrays and 250 Semaphores per Array available. Looks reasonably good so far.

The most concerning parameter in terms of DB2 is this one, and that goes well together with the msgget() system call:

max queues system wide = 16

According to the DB2 Documentation, the maximum number of message queues (MSGMNI) has to be set to at least 16384. Also, the maximum number of Semaphore Arrays should be 1024.

OK, let’s do it:

sysctl -w kernel.msgmni=16384
sysctl -w kernel.sem="250 32000 100 1024"

Et voila, it’s working:

$ db2 connect to INSTANCE

Database Connection Information

Database server = DB2/LINUXX8664 9.7.1
 SQL authorization ID = USER
 Local database alias = INSTANCE

Now, let’s make the change persistent:

echo "kernel.msgmni=16384" >>/etc/sysctl.conf
echo "kernel.sem=\"250 32000 100 1024\"" >>/etc/sysctl.conf

That’s it! Now your DB2 adventures can begin …

Note: Please see the [official DB2 documentation]((http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.qb.server.doc%2Fdoc%2Ft0008238.html).