Entomo
Entomo

Reputation: 275

DB2 docker Shared memory segments cannot be allocated

I am trying to setup a docker image with a DB2 database. The installation is completed without any problems, but I get the following error when I try to restart the database:

SQL1084C Shared memory segments cannot be allocated. SQLSTATE=57019

I based the Dockerfile on this one: https://github.com/jeffbonhag/db2-docker where he states the same problem should be addressed by adding the command

sysctl kernel.shmmax=18446744073692774399

to allow the kernel to allocate more memory but the error persists.

The docker daemon itself runs in Ubuntu 14.04 which runs inside Parallels on MacOSX.

EDIT: After some search I found out that this is related to the following command:

UPDATE DB CFG FOR S0MXAT01 USING locklist 100000;

Upvotes: 1

Views: 1059

Answers (2)

Ember Crooks
Ember Crooks

Reputation: 69

In case others run into this - If you're rolling your own container and leave memory set at automatic, it may try to allocate all the memory on the host to Db2, leading to this error. Sometimes the initial start works out ok, but you end up with odd crashes weeks or months down the line.

The "official" db2 container (the developer community edition one) handles this. If you're building your own container, you'll likely need to set DATABASE_MEMORY and/or INSTANCE_MEMORY to reasonable limits based on the size of your container and restart Db2 in the container. This can be done in your entrypoint script.

Upvotes: 0

pavel_sustr
pavel_sustr

Reputation: 307

You are over-allocating the database memory heap, i.e. docker is unable to satisfy the memory requirements. Have a look at the following link to the manuals. This will give you a breakdown of what is located in the database memory:

Bufferpools
The database heap
The locklist
The utility heap
The package cache
The catalog cache
The shared sort heap, if it is enabled
A 20% overflow area

You can fiddle around with (decrease) any of this heaps until docker is happy.

Upvotes: 2

Related Questions