溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

【ERROR】ORA-27102: out of memory 解決方法

發(fā)布時間:2020-08-10 10:54:12 來源:ITPUB博客 閱讀:207 作者:yhdmy 欄目:關(guān)系型數(shù)據(jù)庫
一、問題描述
        oracle數(shù)據(jù)庫在修改SGA后,啟動時報錯ORA-27102: out of memory,這很顯然表示超出了內(nèi)存范圍,但是機器內(nèi)存是夠的,這是why? 通過一系統(tǒng)search,最終發(fā)現(xiàn)是操作系統(tǒng)參數(shù)shmall設(shè)置過小影響了,shmall 參數(shù)是全部允許使用的共享內(nèi)存大小。下面實驗一下,看看小小參數(shù)的魅力。

二、實驗

1.檢查環(huán)境
[root@sam ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          1993       1590        403          0         47        752
-/+ buffers/cache:        790       1203
Swap:         4095          0       4095
[root@sam ~]# uname -a
Linux sam 2.6.39-400.17.1.el6uek.x86_64 #1 SMP Fri Feb 22 18:16:18 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
[oracle@sam ~]$ cat /etc/sysctl.conf |grep shmall
# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmall is 1073741824 on x86_64
# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmall is 2097152 on i386
kernel.shmall = 1073741824

2.將該值調(diào)小至107374

[root@sam ~]# sed -i 's/kernel.shmall = 1073741824/kernel.shmall = 107374/g' /etc/sysctl.conf
[root@sam ~]# cat /etc/sysctl.conf |grep shmall
# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmall is 1073741824 on x86_64
# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmall is 2097152 on i386
kernel.shmall = 107374

3.檢查SGA參數(shù)后,重新啟動數(shù)據(jù)庫

SYS@orcl >show parameter sga
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 800M
sga_target                           big integer 0
SYS@orcl >shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

4.使修改后的參數(shù)生效

[root@sam ~]# 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
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
kernel.msgmnb = 65536
kernel.msgmax = 65536
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 107374
kernel.shmmax = 2147483648
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500

5.修改SGA參數(shù)為1G后啟動數(shù)據(jù)

SYS@orcl >startup
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device
Additional information: 1061158912
Additional information: 1

6.將系統(tǒng)參數(shù)shmall修改回源值并生效

[root@sam ~]# sed -i 's/kernel.shmall = 107374/kernel.shmall = 1073741824/g' /etc/sysctl.conf
[root@sam ~]# cat /etc/sysctl.conf |grep shmall
# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmall is 1073741824 on x86_64
# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmall is 2097152 on i386
kernel.shmall = 1073741824
[root@sam ~]# 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
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
kernel.msgmnb = 65536
kernel.msgmax = 65536
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 2147483648
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500

7.啟動數(shù)據(jù)

SYS@orcl >startup
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size                  2260088 bytes
Variable Size            1010828168 bytes
Database Buffers           50331648 bytes
Redo Buffers                5517312 bytes
Database mounted.
Database opened.

8.檢查SGA參數(shù)

SYS@orcl >show parameter sga
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 1G
sga_target                           big integer 0

三、總結(jié)

        此次報錯原因主要是對操作系統(tǒng)參數(shù)不了解導(dǎo)致,作為一名DBA人員,時時刻刻都與操作緊密結(jié)合,有很多優(yōu)化方案,最終也都與操作系統(tǒng)參數(shù)有關(guān),總的來說就是未來操作系統(tǒng)學(xué)習(xí)也是有必要的。下面就再補充學(xué)習(xí)一下該參數(shù)。

四、補充shmmax,shmmni,shmall參數(shù)學(xué)習(xí)


shmmax 該參數(shù)定義了共享內(nèi)存段的最大尺寸,這里要注意的是參數(shù)值的單位是(bytes),所以需要大家算好再填寫。該參數(shù)不小于物理內(nèi)存的一半,可能設(shè)置為內(nèi)存的90%-100%,例如16G 內(nèi)存,16*1024*1024*1024*90% = 15461882265,16*1024*1024*1024*100%=17179869184

shmmni 這個內(nèi)核參數(shù)用于設(shè)置系統(tǒng)范圍內(nèi)共享內(nèi)存段的最大數(shù)量。該參數(shù)的默認值是 4096,此值也是在系統(tǒng)中可以啟動的Oracle實例的最大數(shù)量,通常不需要更改,因為顯然在生產(chǎn)環(huán)境下,一個服務(wù)器上同時啟動的實例個數(shù)達不到這個數(shù)量。

shmall 該參數(shù)表示系統(tǒng)任意時刻可以分配的所有共享內(nèi)存段的總和的最大值(以頁為單位),其值應(yīng)不小于shmmax/page_size。例如上面的16G,可以為15461882265/4096 (getconf PAGESIZE可得到頁大小) = 3774873,或17179869184/4096=4194304,根據(jù)內(nèi)存100%來推算內(nèi)存8G為 2097152, 內(nèi)存16G為4194304, 內(nèi)存32G為8388608,內(nèi)存64G為16777216。

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI