版权声明:本文为博主原创文章,转载请标明出处。 https://blog.csdn.net/ctypyb2002/article/details/86592019
修改网卡
# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=6f5fccd7-ded5-4a09-b1bd-634274c27ebc
DEVICE=enp0s3
ONBOOT=yes
IPADDR=192.168.56.201
GATEWAY=192.168.56.1
NETMASK=255.255.255.0
重启网络
# systemctl status netowrk;
systemctl restart netowrk;
修改主机名
# vi /etc/hostname
oradb
# vi /etc/hosts
192.168.56.201 oradb
设置 shm 和 swap
oracle 的内存管理方式为 amm 和 asmm
amm 方式需要使用 /dev/shm,和 linux 的 hugepage 不兼容.
asmm 方式在大内存情况下必须使用 huage,否则 pagetable 过大会导致系统hang.
请参考 <<linux tmpfs /dev/shm 简述>> <<linux hugepage + oracle 11.2.0.4>>
# df -h /dev/shm
# vi /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=1.5g 0 0
# mount -o remount /dev/shm
# free -m
1 GB~2 GB:内存的1.5倍
2 GB~16 GB:与内存相同
超过16 GB:16 GB
注意:如果为Linux服务器启用HugePages,则应在计算交换空间之前从可用内存中扣除分配给HugePages的内存。
关闭selinux
# vi /etc/selinux/config
SELINUX=DISABLED
或者
# vi /etc/sysconfig/selinux
SELINUX=DISABLED
可以看出两个文件是ln -s 的关系:
# ls -l /etc/sysconfig/selinux
/etc/sysconfig/selinux -> ../selinux/config
修改内核参数
# vi /etc/sysctl.conf
#ORACLE SETTING
#kernel.shmall = 18446744073692774399
#kernel.shmmax = 18446744073692774399
kernel.shmmni = 4096
fs.aio-max-nr = 1048576
fs.file-max = 68116544
kernel.sem = 250 32000 100 128
kernel.panic_on_oops = 1
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
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
#大页设置,大内存时必须使用
#vm.nr_hugepages = xxxx
立即生效
sysctl -p
修改 pam
# vi /etc/pam.d/login
#ORACLE SETTING
session required /lib64/security/pam_limits.so
禁用ipv6,numa,thp,io scheduler
# vi /etc/default/grub
ipv6.disable=1 numa=off transparent_hugepage=never elevator=deadline
执行下面命令,生成新的grub
# grub2-mkconfig -o /boot/grub2/grub.cfg
# lsmod | grep ipv6
下面是另外一种方法禁用 linux 的透明大页
#vi /etc/rc.local
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo "never" > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo "never" > /sys/kernel/mm/transparent_hugepage/defrag
fi
下面可以针对某个硬盘具体设置 io Scheduler
查看
# cat /sys/block/${ASM_DISK}/queue/scheduler
修改udev 配置文件
# vi /etc/udev/rules.d/60-oracle-schedulers.rules
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"
加载udev 配置文件
扫描二维码关注公众号,回复:
5124816 查看本文章
![](/qrcode.jpg)
# udevadm control --reload-rules
# systemctl status systemd-udevd.service
# systemctl enable systemd-udevd.service
# /usr/sbin/partprobe /dev/sdb
# udevadm test /sys/block/sda
# udevadm info --query=all --path=/sys/block/sda
# udevadm info --query=all --name=sda
partprobe:
将磁盘分区表变化信息通知内核,请求操作系统重新加载分区表。
-d 不更新内核
-s 显示磁盘分区汇总信息
-h 显示帮助信息
-v 显示版本信息
禁用zeroconf
# vi /etc/sysconfig/network
NOZEROCONF=yes
创建用户组
dbf 方式,依旧要创建全需要的group
# groupadd -g 10000 oinstall;
groupadd -g 10001 dba;
groupadd -g 10002 oper;
# groupadd -g 10003 asmadmin;
groupadd -g 10004 asmdba;
groupadd -g 10005 asmoper;
# groupadd -g 10006 backupdba;
groupadd -g 10007 dgdba;
groupadd -g 10008 kmdba;
groupadd -g 10009 racdba;
创建用户
dbf 方式,不需要创建 grid用户
# useradd -u 10000 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,asmdba,racdba oracle
查看用户
# id oracle
uid=10000(oracle)
gid=10000(oinstall)
groups=10000(oinstall),
10001(dba),
10002(oper),
10004(asmdba),
10006(backupdba),
10007(dgdba),
10008(kmdba),
10009(racdba)
修改密码
# passwd oracle
创建目录
# mkdir -p /u01/app/oracle/product/12.2.0/db_1;
# chown -R oracle:oinstall /u01;
chmod -R 775 /u01;
修改资源限制
# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 65536
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack unlimited
oracle hard stack unlimited
oracle soft core unlimited
oracle hard core unlimited
#at least 90 percent of the current RAM when HugePages memory is enabled and
#at least 3145728 KB (3 GB) when HugePages memory is disabled
oracle soft memlock unlimited
oracle hard memlock unlimited
oracle 用户环境变量
# vi /home/oracle/.bash_profile
PS1="[`whoami`@`hostname`:"'$PWD]$'
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1
export ORACLE_SID=orcl
#export ORA_NLS10=$ORACLE_HOME/nls/data
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export TEMP=/tmp
export TMP=/tmp
export TMPDIR=/tmp
配置 epel 源
# wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo
# yum clean all
# yum makecache
安装依赖包
# yum install nscd xclock nmon lrzsz zip unzip \
dos2unix pigz iputils iftop git tree sysstat make dstat wget bzip2 iputils \
binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33.i686 elfutils-libelf-devel \
gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libgcc libgcc*.i686 \
libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686 libaio libaio*.i686 libaio-devel libaio-devel*.i686 \
libXext libXext.i686 libXtst libXtst.i686 libX11 libX11.i686 libXau libXau.i686 libxcb libxcb.i686 \
libXi libXi.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686 \
readline libtermcap-devel pdksh net-tools nfs-utils smartmontools libXp
禁用一些服务
# systemctl disable iptables.service;
systemctl disable firewalld.service;
systemctl disable cups.service;
#systemctl disable ip6tables.service;
systemctl disable firstboot-graphical.service;
systemctl disable postfix.service;
systemctl disable NetworkManager.service;
systemctl disable avahi-daemon.service;
确保以下服务正常
# systemctl enable crond.service;
systemctl enable sshd.service;
systemctl enable sysstat.service;
systemctl enable network.service;
最后一步,重启os
# reboot