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) groups=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).

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章