赞
踩
分享一次很久以前的Oracle rac项目实施。
1、拓扑结构
基础环境是2台H3C的服务器+2台3PAR的双活存储,操作系统centos7.2。借用下别人家的拓扑先(这是一套典型的RAC架构)。
以eno51和en052组成Team1组为示例:
-
- nmcli con add type team con-nameteam1 ifname team1 config '{"runner": {"name":"activebackup"}}'
- nmcli con mod team1 ipv4.addresses'192.168.1.1/24'
- nmcli con mod team1 ipv4.methodmanual
- nmcli con add type team-slavecon-name team1-port1 ifname eno51 master team1
- nmcli con add type team-slavecon-name team1-port2 ifname eno52 master team1
- teamdctl team1 state(查看状态)
配置完成后,修改其它网卡的启动模式从原来的dhcp改为none
- hostnamectl set-hostname <主机名>
- hostnamectl status进行查看
使用本地源有两个方法
(1)挂载光驱
mount /dev/cdrom /mnt
(2)如果没有光驱则用以下方法,挂载系统安装盘的ISO文件
需要先把安装ISO文件rhel-server-7.2-x86_64-dvd.iso上传到指定目录,并在目录下执行
mount -o loop rhel-server-7.2-x86_64-dvd.iso /mnt
创建配置文件cat /etc/yum.repos.d/local.repo
- [rhel]
- name=rhel
- gpgcheck=0
- enable=1
- baseurl=file:///mnt
- yum install -yelfutils-libelf-devel.x86_64
- yum install -ycompat-libstdc++-33.x86_64
- yum install -y compat-libcap1.x86_64
- yum install -y gcc.x86_64
- yum install -y gcc-c++.x86_64
- yum install -y glibc.i686
- yum install -y glibc-devel.i686
- yum install -y glibc-devel.x86_64
- yum install -y ksh-*.x86_64
- yum install -y libaio.i686
- yum install -y libaio-devel.i686
- yum install -y libaio-devel.x86_64
- yum install -y smartmontools
- yum install -y libgcc.i686
- yum install -y libstdc++.i686
- yum install -y libstdc++-devel.i686
- yum install -y libstdc++-devel.x86_64
- yum install -y libXi.i686
- yum install -y libXi.x86_64
- yum install -y libXtst.i686
- yum install -y libXtst.x86_64
- yum install -y sysstat.x86_64
- yum install xorg-x11-xauth
- yum install -y xterm
- yum install -y ntpdate
- yum install -y device-mapper-multipath
以下安装包需要手动安
- rpm -ivhcompat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
- rpm -e ksh-20120801-22.el7_1.2.x86_64
- rpm -ivhpdksh-5.2.14-37.el5_8.1.x86_64.rpm
- 10.10.17.1 dyckrac1
- 10.10.17.2 dyckrac2
- 10.10.17.3 dyckrac1-vip
- 10.10.17.4 dyckrac2-vip
- 10.10.17.5 dyck-scan
- 192.168.1.1 dyckrac1-priv
- 192.168.1.2 dyckrac2-priv
- /usr/sbin/groupadd -g 501 oinstall
- /usr/sbin/groupadd -g 502 dba
- /usr/sbin/groupadd -g 504 asmadmin
- /usr/sbin/groupadd -g 506 asmdba
- /usr/sbin/groupadd -g 507 asmoper
- /usr/sbin/useradd -u 501 -g oinstall-G asmadmin,asmdba,asmoper -d /home/grid -m grid
- /usr/sbin/useradd -u 502 -g oinstall-G dba,asmdba -d /home/oracle -m oracle
- echo oracle|passwd--stdin oracle
- echo grid|passwd --stdin grid
使用su - oracle命令切换到ORACLE用户下
编辑文件 ~/.bash_profile 增加如下内容(实例名按实际填写,分别修改两个节点
- export ORACLE_SID=orcl1
- export ORACLE_BASE=/u01/app/oracle
- exportORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
- exportPATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
使用su - grid命令切换到ORACLE用户下
编辑文件 ~/.bash_profile 增加如下内容(实例名按实际填写,分别修改两个节点)
- export ORACLE_SID=+ASM1
- export ORACLE_BASE=/g01/app/grid
- exportORACLE_HOME=/g01/app/11.2.0/grid
- exportPATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
以GRID用户为例,
./sshUserSetup.sh -user grid -hosts "dyckrac1 dyckrac2" -advanced -noPromptPassphrase
systemctl stop firewalld.service&& sudo systemctl disable firewalld.service
sed -i -e "s/SELINUX=enforcing/SELINUX=disabled/g"/etc/selinux/config
修改配置文件cat /etc/security/limits.conf
- grid soft nproc 16384
- grid hard nproc 16384
- grid soft nofile 65536
- grid hard nofile 65536
- oracle soft nproc 16384
- oracle hard nproc 16384
- oracle soft nofile 65536
- oracle hard nofile 65536
修改文件/etc/sysctl.conf,增加如下内容:
共享内存段按自己的实际内存修改,我这里分享个脚本来自动计算
- cp /etc/sysctl.conf /etc/sysctl.conf.bak
- echo "#oracle" >> /etc/sysctl.conf
- echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
- echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf
- echo "fs.file-max = 6815744" >> /etc/sysctl.conf
- echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
- echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
- echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf
- echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf
- echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
- echo "net.core.wmem_max = 1048586" >> /etc/sysctl.conf
- echo "vm.swappiness = 10" >> /etc/sysctl.conf
- echo "kernel.shmmax= $(free|grep Mem |awk '{print int($2*1024*0.85)}')" >> /etc/sysctl.conf
- echo "kernel.shmall = $(free|grep Mem |awk '{print int(($2*1024*0.85)/4096)}')" >> /etc/sysctl.conf
- echo "vm.nr_hugepages = $(free -m|grep Mem |awk '{print int(($2*0.8*0.8)/2)}')" >> /etc/sysctl.conf
- free -m
- sysctl -p
-
- [root@rac1 ~]# cat/sys/kernel/mm/transparent_hugepage/enabled
- [always] madvise never //现在为启用
- [root@rac1 ~]# cd /etc/default/
- [root@rac1 default]#cp grub grub.bak
- [root@rac1 ~]# cat /etc/default/grub
- GRUB_TIMEOUT=5
- GRUB_DISTRIBUTOR="$(sed 's,release .*$,,g' /etc/system-release)"
- GRUB_DEFAULT=saved
- GRUB_DISABLE_SUBMENU=true
- GRUB_TERMINAL_OUTPUT="console"
- GRUB_CMDLINE_LINUX="crashkernel=autord.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet transparent_hugepage=never"
- GRUB_DISABLE_RECOVERY="true"
此处有差异
On BIOS-based machines(安装系统时使用传统 BIOS的改法):
grub2-mkconfig -o /boot/grub2/grub.cfg
On UEFI-based machines(安装系统时使用UEFI-BIOS时的改法):
grub2-mkconfig -o/boot/efi/EFI/redhat/grub.cfg
执行输入如下,执行完毕后重启
- configuration file ...
- Found linux image:/boot/vmlinuz-3.10.0-327.el7.x86_64
- Found initrd image:/boot/initramfs-3.10.0-327.el7.x86_64.img
- Found linux image:/boot/vmlinuz-0-rescue-a6225ccf9497470bb6051d6392773fc9
- Found initrd image:/boot/initramfs-0-rescue-a6225ccf9497470bb6051d6392773fc9.img
- done
- [root@rac1 default]# reboot
重启后 再查看
- [root@rac1 ~]# cat/sys/kernel/mm/transparent_hugepage/enabled
- always madvise [never] //现在为关闭
- systemctl stopavahi-daemon
- systemctldisable avahi-daemon
- systemctlstatus avahi-daemon
- # vi /etc/systemd/logind.conf
- RemoveIPC=no
重启systemd-logind服务或重启主机
- systemctl daemon-reload
- systemctl restart systemd-logind
设置原因请参考官方:ALERT: Setting RemoveIPC=yes on Redhat 7.2 Crashes ASM and DatabaseInstances as Well as Any Application That Uses a Shared Memory Segment (SHM) orSemaphores (SEM) (文档 ID 2081410.1)
使用/usr/lib/udev/scsi_id -g -u -d /dev/sda查出系统盘的WWID,关在MULTIAPTHD配置里把此ID列到屏蔽列表中
在两个节点启用multipathd并设置开机启动
- systemctl enable multipathd
- mpathconf --enable
然后修改配置文件如下(此配置文件适合3PAR存储使用multipath的环境)
LINUX自带的multipath配置文件在/etc/multipath.conf
- defaults {
- polling_interval 10
- user_friendly_names no
- find_multipaths yes
- path_checker tur
- }
- blacklist {
- wwid 3600508b1001c5b05f73bd869031e78f5
- devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
- devnode "^hd[a-z]"
- }
- multipaths {
- multipath {
- wwid360002ac000000000000000030001f3c6
- aliasocrvote2
- }
- multipath {
- wwid 360002ac000000000000000020001f3c6
- aliasocrvote1
- }
- multipath {
- wwid 360002ac000000000000000040001f3c6
- aliasocrvote3
- }
- multipath {
- wwid360002ac000000000000000050001f3c6
- aliasasmdata01
- }
- multipath {
- wwid 360002ac000000000000000060001f3c6
- alias asmdata02
- }
- multipath {
- wwid 360002ac000000000000000070001f3c6
- alias asmdata03
- }
- multipath {
- wwid 360002ac000000000000000080001f3c6
- alias asmdata04
- }
- multipath {
- wwid 360002ac000000000000000090001f3c6
- alias asmdata05
- }
- multipath {
- wwid 360002ac0000000000000000a0001f3c6
- alias asmdata06
- }
- multipath {
- wwid 360002ac0000000000000000b0001f3c6
- alias asmdata07
- }
- multipath {
- wwid 360002ac0000000000000000c0001f3c6
- alias asmdata08
- }
- multipath {
- wwid 360002ac0000000000000000d0001f3c6
- alias asmdata09
- }
- multipath {
- wwid 360002ac0000000000000000e0001f3c6
- alias asmdata10
- }
- multipath {
- wwid 360002ac0000000000000000f0001f3c6
- alias asmdata11
- }
- multipath {
- wwid 360002ac000000000000000100001f3c6
- alias asmdata12
- }
- }
- devices {
- device {
- vendor "3PARdata"
- product "VV"
- path_grouping_policy group_by_prio
- path_selector "round-robin 0"
- path_checker tur
- features "0"
- hardware_handler "1 alua"
- prio alua
- failback immediate
- rr_weight uniform
- no_path_retry 18
- rr_min_io_rq 1
- detect_prio yes
- # fast_io_fail_tmo 10
- # dev_loss_tmo 14
- }
- }
修改完成后执行service multipathd reload
创建文件/etc/udev/rules.d/12-mulitpath-privs.rules,内容如下
- ENV{DM_NAME}=="ocrvote*",OWNER:="grid", GROUP:="asmadmin", MODE:="660"
- ENV{DM_NAME}=="asmdata*",OWNER:="grid", GROUP:="asmadmin", MODE:="660"
- chown -R oracle:oinstall /u01
- chown -R grid:oinstall /g01
20、安装GI软件
1、解压grid软件
unzip -qp13390677_112040_Linux-x86-64_3of7.zip
2、对grid软件打补丁19404309
- unzip -q p19404309_112040_Linux-x86-64.zip
- cd b19404309
- export ORA_SHIPS=/tmp/soft
- cp grid/cvu_prereq.xml$ORA_SHIPS/grid/stage/cvu
安装单节点。安装完成后按要求以root用户执行root.sh
然后升级OPatch。用最新OPatch替换$ORACLE_HOME目录下OPatch目录即可。
安装补丁18370031
解压补丁
使用GRID用户执行$ORACLE_HOME/OPatch/ocm/bin/emocmrsp生成ocm.rsp文件
使用grid用户进入到补丁包目录
cd /tmp/soft/18370031
然后执行以下命令升级
opatch apply -oh $ORACLE_HOME -ocmrf $ORACLE_HOME/OPatch/ocm/bin/ocm.rsp
在1节点,以GRID用户身份执行
- cd /g01
- scp -r app grid@dyckrac2:/g01
拷贝完成后,以root用户执行以下脚本
- /g01/app/oraInventory/orainstRoot.sh
- /g01/app/11.2.0/grid/root.sh
在1节点执行
- cd/g01/app/oraInventory
- rm-rf *
- su-grid
- cd$ORACLE_HOME/clone/bin
#下面的是一条命令
perlclone.pl -silent -debug ORACLE_BASE=/g01/app/gridORACLE_HOME=/g01/app/11.2.0/grid ORACLE_HOME_NAME=Ora11g_gridinfrahome1 INVENTORY_LOCATION=/g01/app/oraInventoryOSDBA_GROUP=oinstall OSOPER_GROUP=dba -O'"CLUSTER_NODES={dyckrac1,dyckrac2}"' -O'"LOCAL_NODE=dyckrac1"' CRS=TRUE -ignoreSysPrereqs
等待执行成功,去2节点执行
在2节点执行
- cd/g01/app/oraInventory
- rm-rf *
- su-grid
- cd$ORACLE_HOME/clone/bin
#下面的是一条命令
perlclone.pl -silent -debug ORACLE_BASE=/g01/app/gridORACLE_HOME=/g01/app/11.2.0/grid ORACLE_HOME_NAME=Ora11g_gridinfrahome1 INVENTORY_LOCATION=/g01/app/oraInventoryOSDBA_GROUP=oinstall OSOPER_GROUP=dba-O'"CLUSTER_NODES={dyckrac1,dyckrac2}"' -O'"LOCAL_NODE=dyckrac2"' CRS=TRUE-ignoreSysPrereqs
以grid用户使用xstart登录到1节点执行
$ORACLE_HOME/crs/config/config.sh进行配置集群。
然后在1节点执行root.sh
成功后去2节点执行root.sh
最后的INS-20802报错忽略
查看集群状态正常则进行DB安装
- unzip -qp13390677_112040_Linux-x86-64_1of7.zip
- unzip -qp13390677_112040_Linux-x86-64_2of7.zip
对db软件打补丁19404309
- unzip -q p19404309_112040_Linux-x86-64.zip
- cd /tmp/soft/b19404309
- export ORA_SHIPS=/tmp/soft
- cp database/cvu_prereq.xml$ORA_SHIPS/database/stage/cvu
然后以ORACLE用户登录XSTART执行DB集群安装
安装中途会报错
另开一个窗口,直接修改ins_emagent.mk文件
- $ vi $ORACLE_HOME/sysman/lib/ins_emagent.mk
- #===========================
- # emdctl
- #===========================
- $(SYSMANBIN)emdctl:
- $(MK_EMAGENT_NMECTL)
- 修改为:
- #===========================
- # emdctl
- #===========================
- $(SYSMANBIN)emdctl:
- $(MK_EMAGENT_NMECTL)-lnnz11
然后点击Retry继续安装
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。