.core.wmem_default = 262144
net.core.wmem_max = 262144
sysctl -p 生效配置后,此时尝试启动数据库,结果很不幸,依旧报错ORA-27102。
3.定位解决问题
Google了一下,发现还有可能是kernel.shmall这个参数导致的。
查看当前的shmmax和shmall配置
[root@JYDB1 ~]# cat /proc/sys/kernel/shmmax
25769803776
[root@JYDB1 ~]# cat /proc/sys/kernel/shmall
2097152
注释掉新增的kernel.shmall参数的配置(原/etc/sysctl.conf中有kernel.shmall的配置值为4294967296)
#kernel.shmall = 2097152
kernel.shmmax = 25769803776
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
再次查看当前的shmmax和shmall配置
[root@JYDB1 ~]# cat /proc/sys/kernel/shmmax
25769803776
[root@JYDB1 ~]# cat /proc/sys/kernel/shmall
4294967296
此时重启数据库就可以sga=12G,pga=1.5G正常启动,那么之前的报错就是因为kernel.shmall参数的配置项过小导致了。
4.延伸总结
Oracle官档中,无论是10g还是11g,kernel.shmall参数的配置建议就是kernel.shmall = 2097152,那么在这里的环境有什么问题呢?
在RedHat 5的文档中,关于kernel.shmall这个参数有这样一段描述:
7.3. Setting SHMALL Parameter
This parameter sets the total amount of shared memory pages that can be used system wide. Hence, SHMALL should always be at least ceil(shmmax/PAGE_SIZE).
The default size for SHMALL in Red Hat Enterprise Linux 2.1, 3, 4 and 5 is 2097152 which is also Oracle's recommended minimum setting for 9i and 10g on x86 and x86-64 platforms. In most cases this setting should be sufficient since it means that the total amount of shared memory available on the system is 2097152*4096 bytes (shmall*PAGE_SIZE) which is 8 GB. PAGE_SIZE is usually 4096 bytes unless you use Chapter 14, Large Memory Optimization, Big Pages, and Huge Pages which supports the configuration of larger memory pages.
查看系统默认的PAGE_SIZE值:
[root@JYDB1 ~]# getconf PAGESIZE
4096
计算shmmax/PAGE_SIZE的值shmmax/PAGE_SIZE=25769803776/4096=6291456,
这样问题根本原因找到了,在当前环境,kernel.shmall的值至少应该被设置为6291456。
总结:Oracle部署过程中,还要对建议的系统参数值有一些深入的了解。有些官档建议的参数可能不符合实际情况,这时候可以结合系统主机的文档来综合定位问题。