IP规划
安装环境配置 IP 配置(私有网络无需配置dns和网关) vim /etc/hosts #Public 10.224.0.27 rac1 10.224.0.28 rac2 #Virtual 10.224.0.222 rac1-vip 10.224.0.223 rac2-vip #Private 10.10.10.27 rac1-pri 10.10.10.28 rac2-pri #Scanip 10.224.0.224 scan-ip 删除GUI Server创建的虚拟网卡 ifconfig virbr0 down brctl delbr virbr0 systemctl stop libvirtd systemctl disable libvirtd 关闭SELINUX,防火墙 vi /etc/selinux/config SELINUX=disabled setenforce 0 getenforce systemctl stop firewalld systemctl disable firewalld 停止avahi-daemon服务 systemctl stop avahi-daemon.socket systemctl stop avahi-daemon.service systemctl disable avahi-daemon.socket systemctl disable avahi-daemon.service 停止时间同步服务 rm -rf /var/run/chronyd.pid rm -rf /etc/chrony.conf rm -rf /etc/ntp.conf systemctl stop ntpd.service systemctl disable ntpd systemctl stop chronyd.service systemctl disable chronyd.service 新增登录要求 vi /etc/pam.d/login session required pam_limits.so 安装Oracle依赖包 yum -y install bc gcc gcc-c++ binutils make gdb cmake glibc ksh elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc-devel libaio libaio-devel libXrender libXrender-devel libX11 libXau sysstat libXi libXtst libgcc librdmacm-devel libstdc++ libstdc++-devel libxcb net-tools nfs-utils compat-libcap1 compat-libstdc++ smartmontools targetcli python python-configshell python-rtslib python-six unixODBC unixODBC-devel iscsi-initiator-utils device-mapper device-mapper-multipath unbound bind-utils compat-libstdc++这个包需要单独下载 wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/matthewdva:/build:/RedHat:/RHEL-7/complete/x86_64/compat-libstdc++-33-3.2.3-71.el7.x86_64.rpm yum localinstall compat-libstdc++-33-3.2.3-71.el7.x86_64.rpm 创建用户组和oracle、grid用户 //用户组和用户的编号可以自定义,确保全流程配置一致即可,用户名为Oracle默认用户,建议不要改 groupadd -g 11001 oinstall groupadd -g 11002 dba groupadd -g 11003 oper groupadd -g 11004 backupdba groupadd -g 11005 dgdba groupadd -g 11006 kmdba groupadd -g 11007 asmdba groupadd -g 11008 asmoper groupadd -g 11009 asmadmin groupadd -g 11010 racdba useradd -u 11011 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle useradd -u 11012 -g oinstall -G asmadmin,asmdba,asmoper,dba grid //创建完成后,修改grid和oracle用户密码 passwd grid passwd oracle 创建目录 mkdir -p /u01/app/19.0.0/grid mkdir -p /u01/app/grid mkdir -p /u01/app/oracle mkdir -p /u01/app/oracle/product/19.0.0/db_1 mkdir -p /u01/app/oraInventory 上传Oracel grid和db包(1个节点就行) //上传并解压grid安装包解压到/u01/app/19.0.0/grid目录 unzip LINUX.X64_193000_grid_home.zip -d /u01/app/19.0.0/grid //上传并解压db安装包解压到/u01/app/oracle/product/19.0.0/db_1 unzip LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.0.0/db_1 修改目录所属用户和权限 chown -R grid:oinstall /u01/app/grid chown -R grid:oinstall /u01/app/19.0.0/grid chown -R oracle:oinstall /u01/app/oracle chown -R grid:oinstall /u01/app/oraInventory chmod -R 775 /u01/ 安装依赖包 //rac1节点安装依赖包 cd /u01/app/19.0.0/grid/cv/rpm rpm -ivh cvuqdisk-1.0.10-1.rpm //拷贝安装包到rac2节点,然后安装 scp cvuqdisk-1.0.10-1.rpm rac2:~/ rpm -ivh cvuqdisk-1.0.10-1.rpm 修改系统限制 vi /etc/security/limits.d/20-nproc.conf #* soft nproc 4096 * - nproc 16384 系统用户限制,在最后新增 vi /etc/security/limits.conf grid soft nproc 16384 grid hard nproc 16384 grid soft nofile 1024 grid hard nofile 65536 grid soft stack 10240 grid hard stack 32768 oracle soft nproc 16384 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 32768 oracle hard memlock 4194304 oracle soft memlock 4194304 设置os内核参数 vi /etc/sysctl.conf fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel.shmmni = 4096 kernel.shmall = 2251799813685247 kernel.shmmax = 456340275200#内存80%-90% kernel.panic_on_oops = 1 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500 net.ipv4.tcp_wmem = 4096 16384 4194304 使配置生效 /sbin/sysctl -p 修改shm参数并重新挂载 //修改shm挂载 内存80-90% cat>>/etc/fstab<<EOF tmpfs /dev/shm tmpfs defaults,size=430G 0 0 EOF //重新挂载 mount -o remount /dev/shm 新增网络参数 cat >>/etc/sysconfig/network<<EOF NOZEROCONF=yes EOF 配置环境变量 配置rac1节点grid和oracle用户的环境变量 //使用root用户添加grid用户的环境变量 cat>>/home/grid/.bash_profile<<EOF export ORACLE_SID=+ASM1; export ORACLE_BASE=/u01/app/grid; export ORACLE_HOME=/u01/app/19.0.0/grid; export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export PATH=.:\$PATH:\$HOME/bin:\$ORACLE_HOME/bin export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib EOF //使用root用户添加oracel用户的环境变量 cat>>/home/oracle/.bash_profile<<EOF export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=\$ORACLE_BASE/product/19.0.0/db_1 export ORACLE_SID=orcl1 export PATH=\$ORACLE_HOME/bin:\$PATH export LD_LIBRARY_PATH=\$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib EOF 配置rac2节点grid和oracle用户的环境变量 //使用root用户添加grid用户的环境变量 cat>>/home/grid/.bash_profile<<EOF export ORACLE_SID=+ASM2; export ORACLE_BASE=/u01/app/grid; export ORACLE_HOME=/u01/app/19.0.0/grid; export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export PATH=.:\$PATH:\$HOME/bin:\$ORACLE_HOME/bin export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib EOF //使用root用户添加oracel用户的环境变量 cat>>/home/oracle/.bash_profile<<EOF export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=\$ORACLE_BASE/product/19.0.0/db_1 export ORACLE_SID=orcl2 export PATH=\$ORACLE_HOME/bin:\$PATH export LD_LIBRARY_PATH=\$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib EOF 查看交换分区大小 确定要添加的交换分区大小(内存小于16G,交换分区等于内存大小,内存大于16G,交换分区等于16G) free -m 添加交换文件 dd if=/dev/zero of=/root/swap bs=1024 count=1024000 ---这里 bs=是bytes, count是 blocks 个块,这里的就是 1024bytes=1K,1024000K=1000M 格式化为交换文件系统 mkswap /root/swap 启用交换文件 swapon /root/swap 使交换分区在引导时启用 vi /etc/fstab /dec/hdb5 swap swap defaults 0 0 /root/swap swap swap defaults 0 0 挂载生效 mount -a 配置ASM共享磁盘 多路径配置共享磁盘 获取UUID /usr/lib/udev/scsi_id -g -u -d /dev/mapper/mpatha (其他磁盘类似) 配置/etc/multipath.conf blacklist { devnode "^sda" } defaults { user_friendly_names yes path_grouping_policy multibus failback immediate no_path_retry fail } multipaths { multipath { wwid 36e483261006449fa4ab494e60000000a alias asm_data } multipath { wwid 36e483261006449fa4ab4c1240000000b alias asm_fra0 } multipath { wwid 36e483261006449fa4e6b46120000000c alias asm_crs1 } multipath { wwid 36e483261006449fa4e6b46420000000d alias asm_crs2 } multipath { wwid 36e483261006449fa4e6b466d0000000e alias asm_crs3 } } 生成rules文件 vim /etc/udev/rules.d/99-oracle-asmdevices.rules KERNEL=="dm-*",ENV{DM_UUID}=="mpath-36e483261006449fa4ab494e60000000a",SYMLINK+="asm_data",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="dm-*",ENV{DM_UUID}=="mpath-36e483261006449fa4ab4c1240000000b",SYMLINK+="asm_fra0",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="dm-*",ENV{DM_UUID}=="mpath-36e483261006449fa4e6b46420000000d",SYMLINK+="asm_crs1",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="dm-*",ENV{DM_UUID}=="mpath-36e483261006449fa4e6b46120000000c",SYMLINK+="asm_crs2",OWNER="grid",GROUP="asmadmin",MODE="0660" KERNEL=="dm-*",ENV{DM_UUID}=="mpath-36e483261006449fa4e6b466d0000000e",SYMLINK+="asm_crs3",OWNER="grid",GROUP="asmadmin",MODE="0660" 重新加载udev udevadm control --reload-rules udevadm trigger 查看磁盘 ll /dev/mapper/asm* 将rules文件复制到另外一节点,重新加载udev生效 配置用户互信(oracle和grid) 在节点rac1和rac2节点分别执行 ssh-keygen -t rsa 然后一路回车 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 在节点rac1 上执行 ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 在节点rac2上执行 ssh rac1 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 连接测试(初次要输入密码。后续都不用就ok) 在rac1节点输入 ssh rac2 date 在rac2节点输入 ssh rac1 date