设置linux内核参数

linux的内核参数文件中的这些值都是什么含义呢?
[root@rac1 ~]# cat /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

(1)shmmax:该参数定义了共享内存段的最大尺寸(以字节为单位)。缺省为32M,对于oracle来说,该缺省值太低了,通常将其设置为2G。
在安装11g oracle时候,这个值通常需要先判断操作系统位数:
[root@rac1 ~]# uname -a
Linux rac1 3.8.13-98.7.1.el7uek.x86_64 #2 SMP Wed Nov 25 13:51:41 PST 2015 x86_64 x86_64 x86_64 GNU/Linux

如果是32位的话,该值应低于4G,可以设置为官方给出的4294967295(3.9999G)。

如果是64位,该值应为物理内存的二分之一(可以比二分之一大,但一定要小于物理内存)
grep MemTotal /proc/meminfo(查看系统物理内存)


(2)shmmni:这个内核参数用于设置系统范围内共享内存段的最大数量。该参数的默认值是 4096 。通常不需要更改。

(3)shmall:该参数表示系统一次可以使用的共享内存总量(以页为单位)。缺省值就是2097152,通常不需要修改。
在安装11g oracle时候,shmall等于物理内存(单位B)/page_size ,而page_size大小是运行getconf PAGE_SIZE 命令获得的,一般是4096B See Note 301830.1 for more information.

(4)sem:该参数表示设置的信号量。

(5)file-max:该参数表示文件句柄的最大数量。文件句柄设置表示在linux系统中可以打开的文件数量。

修改好内核以后,执行下面的命令使新的配置生效。
 sysctl -p
[root @linux1 /root]# /sbin/sysctl -p


Maximum SHMMAX values for Linux x86 and x86-64 (文档 ID 567506.1)

QUESTION 1
===========
What is the maximum value of SHMMAX for a 32-bit (x86) Linux system?




QUESTION 2
===========
What is the maximum value of SHMMAX for a 64-bit (x86-64) Linux system?


SOLUTION


ANSWER 1 
============ 
Oracle Global Customer Support officially recommends a " maximum" for SHMMAX of just less than 4Gb, or 4294967295. 


The maximum size of a shared memory segment is limited by the size of the available user address space. On 32-bit systems, this is a theoretical 4GB. The maximum possible value for SHMMAX is just less than 4Gb, or 4294967295. Setting SHMMAX to 4GB exactly will give you 0 bytes as max, as this value is interpreted【解释,解读】 as a 32-bit number and it wraps around. 
解答1
============
Oracle全球客户支持官方建议SHMMAX的“最大值”小于4Gb,或4294967295。


共享内存段的最大大小受可用用户地址空间大小的限制。 在32位系统上,这是一个理论上的4GB。 SHMMAX的最大可能值只是小于4Gb或4294967295.将SHMMAX设置为4GB将精确地给出0个字节作为max,因为该值被解释为32位数,并且它包装。


ANSWER 2 
=========== 
Oracle Global Customer Support officially recommends a " maximum" for SHMMAX of "1/2 of physical RAM". 


The maximum size of a shared memory segment is limited by the size of the available user address space. On 64-bit systems, this is a theoretical 2^64bytes. So the "theoretical limit" for SHMMAX is the amount of physical RAM that you have.  However, to actually attempt to use such a value could potentially lead to a situation where no system memory is available for anything else.  Therefore a more realistic "physical limit" for SHMMAX would probably be "physical RAM - 2Gb". 


In an Oracle RDBMS application, this "physical limit" still leaves inadequate system memory for other necessary functions. Therefore, the common "Oracle maximum" for SHMMAX that you will often see is "1/2 of physical RAM". Many Oracle customers chose a higher fraction, at their discretion. 


Occasionally, Customers may erroneously think that that setting the SHMMAX as recommended in this NOTE limits the total SGA.   That is not true.  Setting the SHMMAX as recommended only causes a few more "shared memory segments" to be used for whatever total SGA that you subsequently configure in Oracle. For additional detail, please see Document 15566.1, "SGA, SHMMAX, Semaphores and Shared Memory Explained"


Also to be taken into consideration for memory configuration is the kernel parameter for kernel.shmall which is the total amount of shared memory, in pages, that the system can use at one time.  Review:


Document 301830.1 Upon startup of Linux database get ORA-27102: out of memory Linux-X86_64 Error: 28: No space left on device


 


Note: It is observed lower value of SHMMAX might lead to ORA-600  [SKGMINVALID]

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值