当前位置:Gxlcms > mysql > ORA-27125:unabletocreatesharedmemorysegment

ORA-27125:unabletocreatesharedmemorysegment

时间:2021-07-01 10:21:17 帮助过:10人阅读

文章介绍一篇关于在linux中的oracle数据库出现ORA-27125: unable to create shared memory segment解决办法。

文章介绍一篇关于在linux中的oracle数据库出现ORA-27125: unable to create shared memory segment解决办法。

平台环境:Linux Red Hat Enterprise Linux Server release 6.0 (Santiago)

版本:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi


安装好ORALCE数据库后,启动数据库就会报如下错误

当启动数据库或者创建数据库时都可能出现ORA-27125错误,我在Oracle Linux 6上安装Oracle 10.2.0.1,创建数据库时就遇到了这个错误。

这个错误的解决就是修改 /proc/sys/vm/hugetlb_shm_group 文件。
以下是老杨提到过的一个问题,解决方法相同:

帮客户解决一个Linux上数据库无法启动的问题。
客户的Linux 5.6 x86-64环境,安装数据库后,启动数据库报错:ORA-27125。
Oracle文档上关于ORA-27125错误的描述为:

ORA-27125: unable to create shared memory segment
Cause: shmget() call failed
Action: contact Oracle support

查询了一下,发现问题和linux上的hugetbl有关。
解决方法也很简单,首先检查oracle用户的组信息:

[oracle@yans1 ~]$ id oracle
uid=500(oracle) gid=502(oinstall) grou=502(oinstall),501(dba)
[oracle@yans1 ~]$ more /proc/sys/vm/hugetlb_shm_group
0


下面用root执行下面的命令,将dba组添加到系统内核中:


# echo 501 > /proc/sys/vm/hugetlb_shm_group

然后启动数据库,问题消失。
那么hugetlb_shm_group组是什么呢?以下是解释:
hugetlb_shm_group contains group id that is allowed to create SysV shared memory segment using hugetlb page


另在安装过程中遇到的操作系统验证错误,可以通过如下方式解决:
在Linux系统中安装oralce的过程中,如果Linux发行版本不是oracle的推荐版本,可能会报如下错误,导致runInstaller无法完成:
Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
Failed <<<<

遇到这个问题,可以通过如下三种方式解决

1、修改Linux的发行标记

如在redhat-5上安装oracle的时候,需要将文件 '/etc/redhat-release'的内容由
Red Hat Enterprise Linux Server release 5 (Tikanga)

修改为Oracle支持的版本
Red Hat Enterprise Linux Server release 4 (Tikanga)

2、runInstaller的时候加上-ignoreSysPreReqs参数,如:
./runInstaller -ignoreSysPreReqs

3.修改oraparam.ini的参数
增加你的系统版本号

4.设置数据库

[root@DB-Server ~]#id oracle
uid=501(oracle) gid=502(oinstall) groups=502(oinstall),501(dba)

[root@DB-Server ~]#echo 501 > /proc/sys/vm/hugetlb_shm_group


然后重启数据库,问题解决,但是我发现数据库服务器重启后,这个问题又会重现,又必须处理上述命令,才能成功启动数据库。治标不治本

参考http://wiki.debian.org/Hugepages后,其实只须在/etc/sysctl.conf下设置一下 hugetlb_shm_group即可一劳永逸的解决这个问题:

Create a group for users of hugepages, and retrieve it's GID (is this example, 2021) then add yourself to the group.
Note: this should not be needed for libvirt (see /etc/libvirt/qemu.conf)

% groupadd my-hugetlbfs

% getent group my-hugetlbfs
my-hugetlbfs:x:2021:

% adduser franklin my-hugetlbfs
Adding user `franklin' to group `my-hugetlbfs' ...
Adding user franklin to group my-hugetlbfs
Done.Edit /etc/sysctl.conf and add this text to specify the number of pages you want to reserve (see pages-size)

# Allocate 256*2MiB for HugePageTables (YMMV)
vm.nr_hugepages = 256

# Members of group my-hugetlbfs(2021) can allocate "huge" Shared memory segment
vm.hugetlb_shm_group = 2021Create a mount point for the file system

% mkdir /hugepagesAdd this line in /etc/fstab (The mode of 1770 allows anyone in the group to create files but not unlink or rename each other's files.1)

hugetlbfs /hugepages hugetlbfs mode=1770,gid=2021 0 0Reboot (This is the most reliable method of allocating huge pages before the memory gets fragmented. You don't necessarily have to reboot. You can try to run systclt -p to apply the changes. if grep "Huge" /proc/meminfo don't show all the pages, you can try to free the cache with sync ; echo 3 > /proc/sys/vm/drop_caches (where "3" stands for "purge pagecache, dentries and inodes") then try sysctl -p again. 2)


limits.conf
You should configure the amount of memory a user can lock, so an application can't crash your operating system by locking all the memory. Note that any page can be locked in RAM, not just huge pages. You should allow the process to lock a little bit more memory that just the the space for hugepages.


## Get huge-page size:
% grep "Hugepagesize:" /proc/meminfo
Hugepagesize: 4096 kB

## What's the current limit
% ulimit -H -l
64

## Just add them up... (how many pages do you want to allocate?)See Limits (ulimit -l and memlock in /etc/security/limits.conf).

人气教程排行