ORA-27102: out of memory故障
最近的UAT
數據庫遷移,由于是多個(gè)DB需要遷移到同一臺機器,一部分完成后,啟動(dòng)后續數據庫碰到了ORA-27102錯誤,提示內存超出,查看系統可用內存,遠大于需要啟動(dòng)數據庫的sga和pga,究竟是怎么一回事呢?如果你也碰到類(lèi)似錯誤,不妨往下看。
1、故障現象
oracle@v2013db02u:~> cat /etc/issue
Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) - Kernel \r (\l).
oracle@v2013db02u:~> sqlplus / as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on Sat Mar 30 09:46:57 2013
Copyright (c) 1982, 2006,
Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup pfile=/u02/database/MHUAT02/initMHUAT02.ora
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device
SQL> ho oerr ora 27102
27102, 00000, "out of memory"
// *Cause: Out of memory
// *Action: Consult the trace file for details
2、分析與解決
--系統實(shí)際可用內存還剩50多個(gè)GB呢
SQL> exit
Disconnected
oracle@v2013db02u:/u02/database> free -m
total used free shared buffers cached
Mem: 64435 5968 58467 0 3 4045
-/+ buffers/cache: 1919 62516
Swap: 32773 1232 31540
--MetaLink上給出了關(guān)于這個(gè)問(wèn)題的描述 [ID 301830.1]
--是由于kernel.shmall值設置太小引起的
kernel.shmall
該參數用于配置系統一次能夠使用的最大的共享頁(yè)面數,該參數的值總是ceil(shmmax/PAGE_SIZE)
Oracle 9i,10g的x86以及x86-64平臺推薦以及缺省的大小通常為2097152
在大多數情況下,該參數是夠用的。按照上述計算方式頁(yè)面內存總大小可以達到8GB(2097152*4096 bytes (shmall*PAGE_SIZE))
通常情況下,PAGE_SIZE 的大小為4096byte,除非使用了Big Pages 或 Huge Pages
對于超出8GB系統內存,如共享內存段(shmmax)的最大大小是16G,則所需要共享內存頁(yè)數(shmall)為16GB/4KB=16777216KB/4KB=4194304(頁(yè))
32GB,64GB可以依上述方式類(lèi)推。
--下面查看本機的設置
v2013db02u:~ # getconf PAGE_SIZE
4096
v2013db02u:~ # /sbin/sysctl -a | grep shm
vm.hugetlb_shm_group = 0
kernel.shmmni = 4096 --定義共享內存段的最大數量,也就是可以開(kāi)辟多少個(gè)共享內存段,一般夠用
kernel.shmall = 2097152 --由于當前server有多個(gè)db運行,應該是總頁(yè)數超出所致
kernel.shmmax = 4294967296 --定義單個(gè)共享內存段的最大值,由于當前server沒(méi)有sga大于4gb的,可以保留原值
--前面我們在使用free時(shí),系統使用內存已經(jīng)超出了4gb,也表明shmall的超出了最大的共享頁(yè)面數
v2013db02u:~ # vi /etc/sysctl.conf --修改kernel.shmall的值,將其改為16gb能容納的頁(yè)面數,使用root身份
v2013db02u:~ # sysctl -p --使修改立即生效,無(wú)需重啟server
v2013db02u:~ # /sbin/sysctl -a | grep shm
vm.hugetlb_shm_group = 0
kernel.shmmni = 4096
kernel.shmall = 4194304
kernel.shmmax = 4294967296
--再次啟動(dòng)db正常
oracle@v2013db02u:~> export ORACLE_SID=MHUAT02
oracle@v2013db02u:~> sqlplus / as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on Sat Mar 30 10:29:18 2013
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup pfile=/u02/database/MHUAT02/initMHUAT02.ora
ORACLE instance started.
Total System Global Area 599785472 bytes
Fixed Size 2074568 bytes
Variable Size 167774264 bytes
Database Buffers 423624704 bytes
Redo Buffers 6311936 bytes
Database mounted.
Database opened.
3、[ID 301830.1]
Upon startup of
Linux database get ORA-27102: out of memory Linux-X86_64 Error: 28: No space left on device [ID 301830.1] To Bottom
--------------------------------------------------------------------------------
Modified:Oct 4, 2012Type:PROBLEMStatus:PUBLISHEDPriority:3 Comments (0)
In this Document
Symptoms
Ask Questions, Get Help, And Share Your Experiences With This Article
Changes
Cause
Solution
References
--------------------------------------------------------------------------------
Applies to:
Oracle Server - Standard Edition - Version 9.2.0.1 and later
Oracle Server - Enterprise Edition - Version 9.2.0.1 and later
Linux x86-64
Symptoms
When trying to increase the SGA to approach half available RAM with an Oracle 64-bit version on a Linux 64-bit operating system, even though shmmax is set to match half the amount of RAM, you get the following error when trying to start the instance:
SQL> startup nomount
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device
Ask Questions, Get Help, And Share Your Experiences With This Article
Would you like to explore this topic further with other Oracle Customers, Oracle Employees, and Industry Experts?
Click here to join the discussion where you can ask questions, get help from others, and share your experiences with this specific article.
Discover discussions about other articles and helpful subjects by clicking here to access the main My Oracle Support Community page for Database Install/Upgrade.
Changes
shmall is too small, most likely is set to the default setting of 2097152
$ cat /proc/sys/kernel/shmall
2097152
Cause
shmall is the total amount of shared memory, in pages, that the system can use at one time.
Solution
Set shmall equal to the sum of all the SGAs on the system, divided by the page size.
The page size can be determined using the following command:
$ getconf PAGE_SIZE
4096
For example, if the sum of all the SGAs on the system is 16Gb and the result of '$ getconf PAGE_SIZE' is 4096 (4Kb) then set shmall to 4194304 pages
As the root user set the shmall to 4194304 in the /etc/sysctl.conf file:
kernel.shmall = 4194304
then run the following command:
$ sysctl -p
$ cat /proc/sys/kernel/shmall
4194304
NOTE:
The above command loads the new value and a reboot is not necessary.
Switch back to being the oracle user and retry the startup command.
Modifying /etc/sysctl.conf is a permanent workaround (applies at boot time). If for some reason you DO NOT want to change the system wide configuration, you can do it on the fly by directly changing the kernel pseudo FS AKA procfs.
e.g. echo "4194304" > /proc/sys/kernel/shmall
Using HUGEPAGES does not alter the calculation for configuring shmall.