日期:2014-05-16 浏览次数:20738 次
安装postgresDB时,出现如下错误:
[postgres@localhost ~]$ /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
FATAL: could not create shared memory segment: 无效的参数
DETAIL: Failed system call was shmget(key=5432001, size=38076416, 03600).
HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 38076416
bytes), reduce PostgreSQL's shared_buffers parameter (currently 4096) and/or its max_connections parameter (currently 100).
If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for.
The PostgreSQL documentation contains more information about shared memory configuration.
解决方法:
我们可以修改shmmax内核参数,使SGA存在于一个共享内存段中。
通过修改/proc/sys/kernel/shmmax参数可以达到此目的。
[root@neirongroot]# echo 1073741824 > /proc/sys/kernel/shmmax
[root@neirongroot]# more /proc/sys/kernel/shmmax
1073741824这里设为1G。
对于shmmax文件的修改,系统重新启动后会复位。可以通过修改/etc/sysctl.conf使更改永久化。
在该文件内添加以下一行 kernel.shmmax = 1073741824 这个更改在系统重新启动后生效.
1、设置 SHMMAX
SHMMAX
参数定义共享内存段的最大尺寸(以字节为单位)。在设置 SHMMAX时,切记 SGA的大小应该适合于一个共享内存段。 SHMMAX设置不足可能会导致以下问题:
ORA-27123:unableto attach to shared memory segment
您可以通过执行以下命令来确定 SHMMAX的值:
# cat/proc/sys/kernel/shmmax
33554432