环境:Linux REDHAT5
DB2 FOR Linux 32bit
由于该版本无法改变安装目录,默认安装在/opt下,所以事先要分配足够的空间给/目录,或者专门为/opt分配空间。
安装过程无任何异常,但是安装完毕后,执行db2start出错:
1.06/18/2008 17:25:00 0 0 SQL1220N The database manager shared memory set cannot be allocated

2.查找帮助db2 ? SQL1220N。发现可能是共享内存设置少了。有以下建议。
On Linux 32-bit, increase the kernel parameter shmmax to 256 MB. On Linux 64-bit, increase the kernel parameter shmmax to 1GB.
用ipcs -l命令看了一下系统配置
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 3939665
max total shared memory (kbytes) = 4G
min seg size (bytes) = 1
系统有4G的最大共享内存。
vi /etc/sysctl.conf 查看结果
kernel.core_uses_pid = 1
kernel.shmmax=4034217728
kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024
db2licm -l 查看,db2序列号为永久的,不过期。
这个修改了之后还是无法启动
网上搜索。IBM网站有这么一篇文章。提到了这个问题的处理方法。
Problem
This technote provides troubleshooting methods for when you attempt to start an instance (db2start) and encounter the following error: SQL1220N The database manager shared memory set cannot be allocated.
Cause
One possibility is that during the creation of the instance the file sqllib/.ftok was not created.
Problem Details
After the creation of a new instance the db2start command can fail with the following message:
06/02/2005 11:45:48 0 0 SQL1220N The database manager shared memory set cannot be allocated.
SQL1032N No start database manager command was issued. SQLSTATE=57019
DB2 was unable to allocate its shared memory set.
Solution
A quick work-around is to use the executable db2ftok (found in sqllib/bin) to create a new seed file sqllib/.ftok. The .ftok file is generated based on the current time and other information. When starting the instance, DB2 reads the .ftok file and creates a standard interprocess communication key (IPC key) which is later supplied to other subroutines for memory allocation.
After the .ftok file has been created, issue the db2start command again.
Please note that in order to determine the reason why the .ftok file was absent in your particular environment, contact DB2 UDB Support and submit a problem record.
按照其说明,执行db2ftok,再db2start,Ok。
问题回顾:问题解决之后,回过头来分析,可能是/opt空间属性有问题,导致安装过程中不能产生.ftok文件,因为安装完成后,执行 db2start,提示无权执行,后来修改了目录属主为db2inst1就可以执行了,然后就出现了上面的错误。 (作者:dongyufeng)
[http://www.linuxidc.com/Linux/2008-06/13742.htm]