Installing DB2 Express C on linux
For anyone else trying to install DB2 Express C, the free community edition of IBM's DB2, on his linux system and running into problems:
- You need to source sqllib/db2profile in every shell where you are going to run commands from sqllib/bin: code:
1
confusion@ulm:~$ . sqllib/db2profile
- Running the db2val validation program multiple times in a row can yield different results. For instance, on the first attempt, it told me it couldn't find the sqllib/logs directory. However, that one was already present (perhaps created by db2val?) and when I ran the validation program again, it noticed that.
- If db2val fails to start your instance with
then you probably need to increase the maximum amount of shared memory the kernel may allocate:SQL1220N The database manager shared memory set cannot be allocated.code:1
sysctl -w kernel.shmmax=268435456
The default is 32M and this increases it to 256M, which turned out to be enough. For 64-bit systems, they advise pushing it to 1GB.
Edit: As moto-moi points out in the comments, this is a temporary change that will disappear with a reboot. To make it permanent, follow his instructions. - If running code:returns
1
confusion@ulm:~$ sqllib/adm/db2start
then you probably forgot the first step I described here.SQL10007N Message "-1390" could not be retrieved. Reason code: "3". - If you try to make a connection from your favorite programming language and you receive
then you probably did a non-root install. Unfortunately, DB2 doesn't have any DB-level users: all user management, including authentication, is delegated to the OS. On a *nix system, the routine checking the password usually requires root privileges. The problem is that the file sqllib/security/db2ckpw needs to be owned by root and needs to have its setuid bit set:ROOT CAPABILITY REQUIRED
code:1 2
chown root db2ckpw chmod u+s db2ckpw
I first found the file sqllib/security32/db2ckpw, but that doesn't seem to be used on linux. Might be the Windows version? Afterwards, perform a
code:1 2 3
db2 force applications all db2stop db2start
The first command breaks all connections, otherwise the db2stop probably won't work. - Keep an eye on sqllib/db2dump/db2diag.log: that's where interesting logging about DB2's functioning ends up. The db2diag command can be used to extract information from that file and can be used to tail it, if you haven't done so already.
- A warning I encountered in the db2diag log was
This can be solved by issuingThe user per process file descriptor limit of 1024 is less than the maxfilop setting of 30720
code:1
ulimit -n 32768
However, that usually won't work, as the default limits prevent you from going above 1024. To overcome that limit, add the following line to /etc/security/limits.conf
code:1
your_db2_user hard nofile 32768
After that, you need to open a new shell (for that user) (if you are running an X environment: restart X) and the new shell will have it maximum number of file descriptors set to 32768 after you issue the ulimit command. Now all you need to do is restart DB2.
06-'09 Be sure to know enough of the language you are arguing against
06-'09 A simple Java puzzler
Comments
Thanx! Quite helpful. 

code:
1
| sysctl -w kernel.shmmax=268435456 |
You would be better of to add this line to /etc/sysctl.conf and run sysctl -p /etc/sysctl.conf, that way you are sure the value is correct and it is also used the next time you restart the machine.
Comments are closed