ORA-27125问题解决
问题环境:
在centos6上搭建单机Oracle10G,搭建完成关机后启动报错,报错信息如下:
[root@centos6 ~]# su - oracle
[oracle@centos6 ~]$ sqlplus / as sysdba
SQL> startup;
ORA-27125: unable to create shared memory segment
Linux-x86_64 Error: 1: Operation not permitted
SQL> Disconnected
ORA-27125: unable to create shared memory segment
Linux-x86_64 Error: 1: Operation not permitted
系统版本:centos6.8
数据库版本: Release 10.2.0.1.0
分析:
根源在于Linux的错误,系统因权限等问题不被允许,所以数据库无法创建共享内存段。在创建共享内存段的时候需要使用到hugepage,系统会进行权限限制。
解决方法:
临时方案:查询dba组的组ID,加入到系统内核中,如下:
[oracle@centos6 ~]$ id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)
# 切换为root用户进行添加
[root@centos6 ~]# echo 501 > /proc/sys/vm/hugetlb_shm_group
重新启动数据库
[root@centos6 ~]# su - oracle
[oracle@centos6 ~]$ sqlplus / as sysdba
SQL> startup;
ORACLE instance started.
Total System Global Area 595591168 bytes
Fixed Size 2022568 bytes
Variable Size 180355928 bytes
Database Buffers 406847488 bytes
Redo Buffers 6365184 bytes
Database mounted.
Database opened.
临时方案,在系统重启后会失效,永久更改的方法如下
永久方案:修改内核参数文件
[root@centos6 ~]# echo "vm.hugetlb_shm_group = 501" >> /etc/sysctl.conf
[root@centos6 ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
vm.hugetlb_shm_group = 501