适用于Oracle安装的Linux内核参数

时间:2020-03-05 15:28:21  来源:igfitidea点击:

在Linux盒中安装Oracle需要对内核的几个要求和修改。
将介绍在CentOS 6.2上安装Oracle 11g的要求。

要完成,我也会表现出其他要求。

硬件要求

根据Oracle,Linux盒子应至少具有1GB的内存,以及交换分区大小的两倍。
我们还应该拥有/TMP大小超过400MB。

[root@livecd Desktop]# grep MemTotal /proc/meminfo
MemTotal: 723740 kB
[root@livecd Desktop]# grep SwapTotal /proc/meminfo
SwapTotal: 1500000 kB

修改内核参数

要检查和更改内核参数,可以使用VI或者任何其他编辑器打开Sysctl.conf。

[root@livecd Desktop]#vi /etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verificationnet.ipv4.conf.default.rp_filter = 1
# Do not accept source routingnet.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernelkernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename# Useful for debugging multi-threaded applicationskernel.core_uses_pid = 1
# Controls the use of TCP syncookiesnet.ipv4.tcp_syncookies = 1
# Controls whether core dumps will append the PID to the core filename# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the use of TCP syncookiesnet.ipv4.tcp_syncookies = 1
# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536
# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 4294967295
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 268435456

我们可以看到上面的内核条目。
根据Oracle要求,上述条目应大于或者等于以下值。

Parameter Value
semmsl - 250
semmns - 32000
semopm - 100
semmni - 128
shmall - 2097152
shmmax - Half the size of physical memory (in bytes)
shmmni - 4096
file-max - 65536
ip_local_port_range - Minimum:1024
Maximum - 65000
rmem_default - 1048576
rmem_max - 1048576
wmem_default - 262144
wmem_max - 262144
[root@livecd Desktop]# sysctl -a |grep kernel.sem
kernel.sem = 250 32000 32 128
[root@livecd Desktop]# sysctl -a |grep kernel.shm
kernel.shmmax = 4294967295
kernel.shmall = 268435456
kernel.shmmni = 4096
[root@livecd Desktop]# sysctl -a |grep file-max
fs.file-max = 70692
[root@livecd Desktop]# sysctl -a |grep ip_local_port_range
net.ipv4.ip_local_port_range = 32768 61000
[root@livecd Desktop]# sysctl -a |grep rmem_default
net.core.rmem_default = 112640
[root@livecd Desktop]# sysctl -a |grep rmem_max
net.core.rmem_max = 131071
[root@livecd Desktop]# sysctl -a |grep wmem_default
net.core.wmem_default = 112640
[root@livecd Desktop]# sysctl -a |grep wmem_max
net.core.wmem_max = 131071
[root@livecd Desktop]# sysctl -a |grep aio-max-nr
fs.aio-max-nr = 65536

对参数进行了上述更改。
如果我们知道如何在VI编辑器周围工作,那就没有。
更改值后,我们应该使用以下命令提交:

[root@livecd Desktop]# 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
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
[root@livecd Desktop]#

所有这些参数是关于什么的?

共享内存

Oracle在UNIX中使用共享内存来访问不同的数据结构。

SHMMAX - maximum shared memory and should be large enough.
SHMMNI - minimum required memory and default set to 4096.
SHMALL - total shared memory in pages and default set to 2097152.

信号量

这些是用于访问共享资源的计数器。
这是用于共享资源的完整性。

SEMMSL - Used to control the maximum number of semaphores per set.
SEMMNI - Used to control the maximum number of semaphore sets in full Unix system.
SEMMNS - Used to control the maximum number of semaphores in full Unix system.
SEMOPM - Used to control the number of semaphore operations per semop system call.