kernel_config.sh

#!/bin/bash

if [[ ! -f /etc/sysctl.conf.bak ]]; then
  cp /etc/sysctl.conf /etc/sysctl.conf.bak
else
  rm /etc/sysctl.conf
  cp /etc/sysctl.conf.bak /etc/sysctl.conf
fi 

sed -i '/kernel.shmall/s/^/#/' /etc/sysctl.conf
sed -i '/kernel.shmmax/s/^/#/' /etc/sysctl.conf

cat >> /etc/sysctl.conf << "EOF"
##### for Oracle_11gR2 #####

fs.aio-max-nr = 1048576
fs.file-max = 6815744

kernel.shmall=2097152
# shmmax一般设为系统内存的一半,此处设为2GB
kernel.shmmax=2147483648
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 = 1048586
 
EOF
   
/sbin/sysctl -p




你可能感兴趣的:(kernel_config.sh)