正德厚生,臻于至善

Oracle安装linux最佳实践参数说明

参数名建议值说明
kernel.sysrq0Controls the System Request debugging functionality of the kernel
如果该文件指定的值为非0,则激活sysctem request key。
kernel.core_uses_pid1Useful for debugging multi-threaded applications.
kernel.msgmnb65536Controls the default maxmimum size of a mesage queue
kernel.msgmax65536Controls the maximum size of a message, in bytes
kernel.panic_on_oops1当系统发生oops或BUG时,所采取的措施
0:继续运行
1:让klog记录oops的输出,然后panic,若kernel.panic不为0,则等待后重新引导内核
fs.file-max=6815744系统中可以同时打开的文件数目
vm.hugetlb_shm_group设置为oinstall组的组ID拥有该gid的用户可以使用大页创建SysV共享内存段(和hugepage有关)
vm.nr_hugepages按需设置大页的最小数目,计算公式:vm.nr_hugepages = (所有数据库实例使用的 SGA 内存之和(包括ASM 实例分配的内存) / 2M) + 100
nofile65535
vm.min_free_kbytes按需设置计算公式:0.4% *物理内存
= 524288 && <= 1048576
设置不合理有可能导致节点会被驱逐或者重启
Note: 1367153.1 – Top 5 Issues That Cause Node Reboots or Evictions or Unexpected Recycle of CRS
Note: 2397062.1 – OS failure message: No buffer space available” occurs on OPC RAC
Note: 811306.1 – Note:RAC and Oracle Clusterware Best Practices and Starter Kit (Linux)
memlockunlimitedWhat is Memlock and How to Calculate the Values for Memlock? (Doc ID 2511230.1),memlock参数指定用户可以锁定其地址空间的内存量,大页配置后已锁定在物理内存中。For example. Let’s say I want my SGA to be 32GB in size. Then with 2MB for each page, we’re looking at 32768/2 = 16384 pages. I round up a bit because they all don’t fit nicely into those pages. So I’d allocate 16400 huge pages. Then memlock would be 16400*2048 = 33587200.
Temporary location is not configured for auto cleanup/tmp/.oracle和/var/tmp/.oracle目录下的通信套接字文件。
Add these lines to /usr/lib/tmpfiles.d/tmp.conf
/var/tmp/.oracle
/tmp/.oracle
/usr/tmp/.oracle
在Linux OL7 / RHEL7上,如果未进行正确的配置设置,则将删除/tmp/.oracle和/var/tmp/.oracle目录下的通信套接字文件。
Add these lines to /usr/lib/tmpfiles.d/tmp.conf
x /tmp/.oracle*
x /var/tmp/.oracle*
x /usr/tmp/.oracle*
RemoveIPC setting should be configured to “No” in /etc/systemd/logind.confset RemoveIPC=no in /etc/systemd/logind.confClusteware, ASM and database will crash
set RemoveIPC=no in /etc/systemd/logind.conf
设置了RemoveIPC=yes 的RHEL7.2 会crash掉Oracle asm 实例和Oracle database实例,该问题也会在使用Shared Memory Segment (SHM) or Semaphores (SEM)的应用程序中发生。
ALERT: Setting RemoveIPC=yes on Redhat 7.2 Crashes ASM and Database Instances as Well as Any Application That Uses a Shared Memory Segment (SHM) or Semaphores (SEM) (文档 ID 2081410.1)
当最后一个oracle 或者Grid用户退出时,操作系统会remove 掉这个user的shared memory segments and semaphores,
由于Oracle ASM 和database 使用 shared memory segments ,remove shared memory segments将会crash掉Oracle ASM and database instances.
kernel.numa_balancing禁用 kernel.numa_balancing
kernel.numa_balancing = 0
当numa_balancing设置为1时,系统可能会经历非常高的I/O等待,并导致实例驱逐/崩溃,节点重启和性能下降
禁用 kernel.numa_balancing
除非主机明确要开启NUMA,一般建议关闭。
hung_task_panic0该参数在设置为1的时候,khungtaskd thread会监控主机上的进程,如果有D状态超过120秒的(默认),会自动reboot主机
cat /proc/sys/kernel/hung_task_panic
1
cat /proc/sys/kernel/hung_task_timeout_secs
120
Hung_task_panic was enabled which means that khungtaskd thread provides the ability to detect process which are stuck in state D longer than the seconds mentioned in kernel.hung_task_timeout_secs sysctl parameter (120 seconds) and causes the server to reboot
建议检查我们的linux主机,将其设置为0,禁止reboot,并将其加到安装规范中
参考:
Oracle Linux Server Reboots Automatically when “hung_task_panic” is Set to 1 (Doc ID 2214155.1)
net.core.rmem_default262144解决udp Sndbuf太小问题,修改tcp/udp窗口大小参数,TCP动态改变窗口大小以避免网络拥挤。它使用rmem_default和wmem_default的值初始化窗口大小,并且窗口永远不会大于rmem_max和wmem_max。而UDP不会改变它的窗口尺寸,它使用rmem_default和wmem_default作为它的窗口尺寸大小。
net.core.rmem_max4194304
net.core.wmem_default262144
net.core.wmem_max4194304
net.ipv4.ipfrag_high_thresh16777216IPC Receiver dump detected.
RHEL 6.6: IPC Send timeout/node eviction etc with high packet reassembles failure (Doc ID 2008933.1)
12.2: ‘IPC Send timeout’ in RAC Environment Followed by Instance Crash (Doc ID 2429375.1)
net.ipv4.ipfrag_low_thresh15728640net.ipv4.ipfrag_high_thresh = 41943040 #传输数据包分片占用内存的高阈值,默认值4194304 net.ipv4.ipfrag_low_thresh = 40894464 #传输数据包分片占用内存的低阈值,默认值3145728
semmsl250决定了从一个信号集里面能申请多少个信号量。
This is the maximum number of semaphores that can be allocated in a semaphore set. (semget(), EINVAL)
semmns32000一个系统中总共允许的信号量的最大值
This is a system-wide limit on the number of semaphores in all semaphore sets. The number of semaphores on the system is also limited by SEMMNI and SEMMSL; in fact, the default value for SEMMNS is the product of the defaults for these two limits. (semget(),ENOSPC)
semopm100单个 semopm()调用在一个信号量集上可以执行的操作数量
This is the maximum number of operations per semop() call.(semop(), E2BIG)
semmni128一个系统中总共允许的信号量集的最大值
This is a system-wide limit on the number of semaphore identifiers(in other words, semaphore sets) that can be created. (semget(),ENOSPC) semmni=semmns/semmsl
shmmax物理内存的50%,单位为字节Half the size of physical memory in bytes, See My Oracle Support Note 567506.1 for additional information about configuring shmmax
shmallshmall 是全部允许使用的共享内存大小,shmmax 是单个段允许使用的大小。
/ ,linux一般pagesize是4K。比如物理内存为16G,:16 * 1024 * 1024 / 4 = 4194304。
aio-max-nr4194304Note: This value limits concurrent outstanding requests and should be set to avoid I/O subsystem failures.
ip_local_port_range9000 65500用于定义网络连接可用作其源(本地)端口的最小和最大端口的限制,同时适用于TCP和UDP连接。
Minimum: 9000
Maximum: 65500
rp_filter0或者2(私网网卡)Note: rp_filter for multiple private interconnects and Linux Kernel 2.6.32+ (Doc ID 1286796.1)
For Linux Kernels 2.6.31 (including, for example, Oracle Linux and RedHat) and above, a bug has been fixed in the Reverse Path Filtering. As a consequence of this bug fix, interconnect packets may be blocked/discarded on multi-interconnect systems. To avoid this situation, set the rp_filter kernel parameter to a vale of 0 (disable) or 2 (loose) for the private interconnect NICs.
RHEL7缺省使用严格反向路径过滤,这是为了防止DDos攻击的IP欺骗,然而对RAC的心跳使用严格路经过滤可能会导致内部通信问题,对于使用HAIP的RAC心跳网设置为不过滤或者宽松过滤模式。
0 : 不过滤.
1 : 严格过滤.
2 : 宽松过滤.
示例1:
net.ipv4.conf.em3.rp_filter = 2 <<< 私网
net.ipv4.conf.em4.rp_filter = 2 <<< 私网
示例2:
net.ipv4.conf.bond1.rp_filter = 2 <<< 网卡绑定后的NIC
net.ipv4.conf.em3.rp_filter = 2 <<< slave NIC
net.ipv4.conf.em4.rp_filter = 2 <<< slave NIC
vm.swappiness10swappiness的值的大小对如何使用swap分区是有着很大的联系的。先前,人们建议把vm.swapiness设置为0,它意味着“除非发生内存益处,否则不要进行内存交换”。直到Linux内核3.5-rcl版本发布,这个值的意义才发生了变化。这个变化被一直到其他的发行版本上,包括RedHat企业版内核2.6.32-303。在发生变化之后,0意味着“在任何情况下都不要发生交换”。所以现在建议把这个值设置为10。swappiness=100的时候表示积极的使用swap分区,并且把内存上的数据及时的搬运到swap空间里面。这个参数从RHEL 6.4开始与之前的版本的行为有所不同,建议不要设置为0。
vm.dirty_background_ratio3这个参数控制文件系统的后台进程,在何时刷新磁盘。单位是百分比,表示系统内存的百分比,意思是当写缓冲使用到系统内存多少的时候,就会触发pdflush/flush/kdmflush等后台回写进程运行,将一定缓存的脏页异步地刷入外存。增大之会使用更多系统内存用于磁盘写缓冲,也可以极大提高系统的写性能。但是,当你需要持续、恒定的写入场合时,应该降低其数值,一般启动上缺省是 5。这个参数控制文件系统的后台进程,在何时刷新磁盘。单位是百分比,表示系统内存的百分比,意思是当写缓冲使用到系统内存多少的时候,就会触发pdflush/flush/kdmflush等后台回写进程运行,将一定缓存的脏页异步地刷入外存。增大之会使用更多系统内存用于磁盘写缓冲,也可以极大提高系统的写性能。但是,当你需要持续、恒定的写入场合时,应该降低其数值,一般启动上缺省是 5。
vm.dirty_ratio20这个参数控制文件系统的同步写写缓冲区的大小,单位是百分比,表示当写缓冲使用到系统内存多少的时候(即指定了当文件系统缓存脏页数量达到系统内存百分之多少时(如10%),开始向磁盘写出数据,即系统不得不开始处理缓存脏页(因为此时脏页数量已经比较多,为了避免数据丢失需要将一定脏页刷入外存),在此过程中很多应用进程可能会因为系统转而处理文件IO而阻塞。增大之会使用更多系统内存用于磁盘写缓冲,也可以极大提高系统的写性能。但是,当你需要持续、恒定的写入场合时,应该降低其数值,一般启动上缺省是 10。这个参数控制文件系统的同步写写缓冲区的大小,单位是百分比,表示当写缓冲使用到系统内存多少的时候(即指定了当文件系统缓存脏页数量达到系统内存百分之多少时(如10%),开始向磁盘写出数据,即系统不得不开始处理缓存脏页(因为此时脏页数量已经比较多,为了避免数据丢失需要将一定脏页刷入外存),在此过程中很多应用进程可能会因为系统转而处理文件IO而阻塞。增大之会使用更多系统内存用于磁盘写缓冲,也可以极大提高系统的写性能。但是,当你需要持续、恒定的写入场合时,应该降低其数值,一般启动上缺省是 10。
vm.dirty_expire_centisecs500这个参数声明Linux内核写缓冲区里面的数据多“旧”了之后,pdflush进程就开始考虑写到磁盘中去。单位是 1/100秒。
vm.dirty_writeback_centisecs100这个参数控制内核的脏数据刷新进程pdflush的运行间隔。单位是 1/100 秒。

Note: 811306.1 – Note:RAC and Oracle Clusterware Best Practices and Starter Kit (Linux)
Note: 1606759.1 -Oracle Linux – Transparent Huge Pages (THP) and Memory Compaction Causing Processes to Unresponsive on UEK2
Note: 1367153.1 – Top 5 Issues That Cause Node Reboots or Evictions or Unexpected Recycle of CRS
Note: 2397062.1 – OS failure message: No buffer space available” occurs on OPC RAC
Note: 2511230.1 – What is Memlock and How to Calculate the Values for Memlock?
Note: 2081410.1 – ALERT: Setting RemoveIPC=yes on Redhat 7.2 Crashes ASM and Database Instances as Well as Any Application That Uses a Shared Memory Segment (SHM) or Semaphores (SEM)
Note: 2214155.1 – Oracle Linux Server Reboots Automatically when “hung_task_panic” is Set to 1
Note: 2008933.1 – RHEL 6.6: IPC Send timeout/node eviction etc with high packet reassembles failure
Note: 2429375.1 – 12.2: ‘IPC Send timeout’ in RAC Environment Followed by Instance Crash
Note: 1286796.1 – Note: rp_filter for multiple private interconnects and Linux Kernel 2.6.32+

赞(0) 打赏
未经允许不得转载:徐万新之路 » Oracle安装linux最佳实践参数说明

评论 抢沙发

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫

微信扫一扫

登录

找回密码

注册