Db2 – The database manager failed to allocate shared memory because an operating system kernel memory limit has been reached

db2memory

I have installed IBM DB2 10.5.5 and I want to create a new database there.

When I entered command

db2 create database test1

I am getting a error saying

SQL1084C  The database manager failed to allocate shared memory because an 
operating system kernel memory limit has been reached.  SQLSTATE=57019

Following is the output I get when I run "ipcs -l"

 ------ Shared Memory Limits --------
max number of segments = 10000
max seg size (kbytes) = 4882812
max total shared memory (kbytes) = 33554432
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 4096
max semaphores per array = 250
max semaphores system wide = 1024000
max ops per semop call = 32
semaphore max value = 32767

------ Messages Limits --------
max queues system wide = 16384
max size of message (bytes) = 65536
default max size of queue (bytes) = 16384

What is the reason for this? How can I fix it?
I am running on Ubuntu 14.04 with 8GB physical memory.

Best Answer

I just had the same problem! In my case the problem was just the memory of the DB2 instance.

In windows type:

db2 get dbm cfg | findstr MEMORY

In linux:

db2 get dbm cfg | grep MEMORY

You will get something like that:

Global instance memory (4KB)          (INSTANCE_MEMORY) = 500000

The solution in my case was simply set the same threshold value but by activating the automatic mode:

db2 update dbm cfg using INSTANCE_MEMORY 100000 automatic immediate

The command "immediate" apply the settings now without the need to restart the instance. So if you get the settings again will have:

Global instance memory (4KB)          (INSTANCE_MEMORY) = AUTOMATIC(5000000)

Now try to connect to your database again. I believe that will again connect normally.

According to the DB2 documentation:

This parameter specifies the maximum amount of memory that can be allocated for a database partition if you are using DB2® database products with memory usage restrictions or if you set it to a specific value. Otherwise, the AUTOMATIC setting allows instance memory to grow as needed.

Font: IBM Knowledge Center