环境:oracle linux7.7,安装系统时需双网卡,接心跳线。
节点一(rac1):
网卡一:10.121.116.91
网卡二:192.168.1.101
节点二(rac2):
网卡一:10.121.116.92
网卡二:192.168.1.103
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
1.挂载镜像,配置本地yum(两个节点都要操作):
mkdir /mnt/cdrom
mount /dev/sr0 /mnt/cdrom/
mv /etc/yum.repos.d /etc/yum.repos.d.bak
mkdir /etc/yum.repos.d
vi /etc/yum.repos.d/public-yum-ol7.repo
[CDROM]
name=isofile
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
gpgkey=file:///mnt/RPM-GPG-KEY-oracle
yum clean all
yum makecache
2.修改主机名:(11.2.0.4要求主机名小写)
vim /etc/hostname rac1
3.修改hosts文件
vim /etc/hosts 127.0.0.1 localhostlocalhost.localdomain localhost4 localhost4.localdomain4 ::1localhostlocalhost.localdomain localhost6 localhost6.localdomain6 #rac1 10.121.116.91 rac1 10.121.116.93 rac1-vip 192.168.1.101 rac1-priv #rac2 10.121.116.92 rac2 10.121.116.94 rac2-vip 192.168.1.103 rac2-priv #scan-cluster 10.121.116.95 scan-cluster
4.配置内核参数
vim /etc/sysctl.conf
fs.aio-max-nr = 1048576 fs.file-max = 6815744
kernel.shmall = 16777216 kernel.shmmax = 68719476735 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
sysctl -p
5.修改limits
grid soft nproc 2047 grid hard nproc 16384 grid soft nofile 1024 grid hard nofile 65536 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536
6.修改/etc/pam.d/login文件
vim /etc/pam.d/login 加入如下内容: session required pam_limits.so
7.修改/etc/profile
vim /etc/profile
加入如下内容: if [ $USER = "oracle" ] || [ $USER = "grid" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else
ulimit -u 16384 -n 65536 fi umask 022 fi
8.禁用selinux
vim /etc/selinux/config 把SELINUX=enforcing改为SELINUX=disabled
9.添加组和用户
groupadd -g 501 oinstall groupadd -g 502 dba groupadd -g 503 oper groupadd -g 504 asmadmin groupadd -g 505 asmoper groupadd -g 506 asmdba useradd -g oinstall -G dba,asmdba,oper oracle useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
passwd oracle passwd grid
10.创建目录
mkdir -p /u01/app/oracle mkdir -p /u01/app/grid mkdir -p /u01/app/11.2.0/grid chown -R grid:oinstall /u01/app/grid chown -R grid:oinstall /u01/app/11.2.0 chown -R oracle:oinstall /u01/app/oracle chmod -R 775 /u01 mkdir -p /u01/app/oraInventory chown -R grid:oinstall /u01/app/oraInventory chmod -R 775 /u01/app/oraInventory
11.配置 grid 和 oracle 用户的环境变量
vim /home/oracle/.bash_profile
export ORACLE_SID=rac1 export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 export LD_LIBRARY_PATH=$ORACLE_HOME/lib export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS" export TMP=/tmp export TMPDIR=$TMP export PATH=$PATH:$ORACLE_HOME/bin
source /home/oracle/.bash_profile
vim /home/grid/.bash_profile export ORACLE_SID=+ASM1 export ORACLE_BASE=/u01/app/grid export ORACLE_HOME=/u01/app/11.2.0/grid export LD_LIBRARY_PATH=$ORACLE_HOME/lib export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS" export PATH=$ORACLE_HOME/bin:$PATH source /home/grid/.bash_profile
rac2上重复此操作。注意:另外一台数据库实例名须做相应修改:(rac2/+ASM2)
12.安装依赖:
yum install gcc gcc-c++ glibc* glibc-devel* libgcc* libstdc++* libstdc++-devel* make sysstat -y yum install -y compat-libstdc* yum install -y unixODBC* yum install -y compat-libcap* yum install -y libcap* yum install libaio-devel yum install xdpyinfo yum install perl-Env yum install -y smartmontools yum install elfutils-libelf-devel yum install unzip
13.配置互相信任,grid/oracle用户都需要
切换到oracle用户: rac1: ssh-keygen -t rsa [这里一路回车就可以了] cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys[输入yes] ssh-copy-id oracle@rac2[将本地公钥追加到authorized_keys上] ssh rac2 date 只要不再提示输入密码就成功了。 rac2: ssh-keygen -t rsa [这里一路回车就可以了] cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys ssh rac1 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys[输入yes] ssh-copy-id oracle@rac1 [将本地公钥追加到authorized_keys上] ssh rac1 date 只要不再提示输入密码就成功了。 grid用户重复此步骤,把oracle改为grid即可。
14.配置共享存储,这里用的是3par8400,已在3par管理软件中划好磁盘并映射到主机,只需格式化即可
fdisk -l fdisk /dev/sdc fdisk /dev/sdd fdisk /dev/sde fdisk /dev/sdf fdisk /dev/sdg fdisk /dev/sdh fdisk /dev/sdi fdisk /dev/sdj fdisk /dev/sdk fdisk /dev/sdl fdisk /dev/sdc表示要对/dev/sdc磁盘进行格式化,其中,输入的命令分别表示: n表示新建1个分区; p表示分区类型选择为primary partition 主分区; 1表示分区编号从1开始; 起始、终止柱面选择默认值,即1和500; w表示将新建的分区信息写入硬盘分区表。
15.配置ASM磁盘(需要上传并安装如下三个依赖包):
rpm -ivh pdksh-5.2.14-37.el5.x86_64.rpm rpm -ivh oracleasm-support-2.1.8-1.el6.x86_64.rpm rpm -ivh oracleasmlib-2.0.4-1.el6.x86_64.rpm
执行如下命令
oracleasm configure -i命令进行配置时,用户配置为grid,组为asmadmin,启动ASM library driver驱动服务,并且将其配置为随着操作系统的启动而自动启动。 oracleasm configure -i Configuring the Oracle ASM library driver. This will configure the on-boot properties of the Oracle ASM library driver. The following questions will determine whether the driver is loaded on boot and what permissions it will have. The current values will be shown in brackets ('[]'). Hitting <ENTER> without typing an answer will keep that current value. Ctrl-C will abort. Default user to own the driver interface []: grid Default group to own the driver interface []: asmadmin Start Oracle ASM library driver on boot (y/n) [n]: y Scan for Oracle ASM disks on boot (y/n) [y]: y Writing Oracle ASM library driver configuration: done 配置完成后,记得执行 oracleasm init命令来加载oracleasm内核模块。
oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm Loading module "oracleasm": oracleasm Configuring "oracleasm" to use device physical block size Mounting ASMlib driver filesystem: /dev/oracleasm
在rac1创建共享盘:
oracleasm createdisk OCR1 /dev/sdc1 oracleasm createdisk OCR2 /dev/sdd1 oracleasm createdisk OCR3 /dev/sde1 oracleasm createdisk FRA /dev/sdf1 oracleasm createdisk DATA1 /dev/sdg1 oracleasm createdisk DATA2 /dev/sdh1 oracleasm createdisk DATA3 /dev/sdi1 oracleasm createdisk DATA4 /dev/sdj1 oracleasm createdisk DATA5 /dev/sdk1 oracleasm createdisk DATA6 /dev/sdl1
在rac2扫描磁盘:
oracleasm scandisks Reloading disk partitions: done Cleaning any stale ASM disks... Scanning system for ASM disks... Instantiating disk "OCR1" Instantiating disk "OCR2" Instantiating disk "OCR3" Instantiating disk "FRA" Instantiating disk "DATA1" Instantiating disk "DATA2" Instantiating disk "DATA3" Instantiating disk "DATA4" Instantiating disk "DATA5" Instantiating disk "DATA6"
16.安装grid
上传并解压安装包
unzip p13390677_112040_Linux-x86-64_1of7.zip unzip p13390677_112040_Linux-x86-64_2of7.zip unzip p13390677_112040_Linux-x86-64_3of7.zip chown -R grid:oinstall /u01/app/grid/ chown -R oracle:oinstall /u01/app/database/
使用grid用户进入到解压目录
cd /u01/app/grid/ 验证: ./runcluvfy.sh stage -pre crsinst -n rac1,rac2 -fixup -verbose
安装Grid Infrastructure
1.安装流程
只需要在一个节点上安装即可,会自动复制到其他节点中,这里在rac1中安装。
进入图形化接口,在grid用户下进行安装
安装之前进入grid下rpm目录安装一个包(需在root用户下):
cd /u01/app/grid/rpm/ rpm -ivh cvuqdisk-1.0.9-1.rpm
再到grid用户/u01/app/grid/下执行./runInstaller
cd /u01/app/grid/ export DISPLAY=IP:0.0 ./runInstaller
跳过更新
选择安装集群
选择自定义安装
选择语言为English
定义集群名字,SCAN Name 为hosts中定义的scan-cluster,取消GNS
界面只有第一个节点rac1,点击“Add”把第二个节点rac2加上
选择网卡
配置ASM实例需要为具有sysasm权限的sys用户,具有sysdba权限的asmsnmp用户设置密码,这里设置统一密码。
yes即可
不选择智能管理。
检查ASM实例权限分组情况,默認既可。
选择grid软件安装路径和base目录,默認既可。
选择grid安装清单目录,默認既可。
环境检测出现dervice checks for asm警告,我並不是通過udev配置asm,可忽略。resolv.conf错误,是因为没有配置DNS,可以忽略。
安装grid概要
提示需要root用户依次执行脚本orainstRoot.sh ,root.sh (一定要先在rac1执行完脚本后,才能在其他节点执行)。
注意:RHEL 7 安装oracle rac 11.2.0.4执行root.sh会报错ohasd failed to start 报错原因:因为RHEL 7使用systemd而不是initd运行进程和重启进程,而root.sh通过传统的initd运行ohasd进程。
解决方法:
在RHEL 7中ohasd需要被设置为一个服务,在运行脚本root.sh之前。
以root用户创建服务文件
touch /usr/lib/systemd/system/ohas.service chmod 777 /usr/lib/systemd/system/ohas.service
将以下内容添加到新创建的ohas.service文件中
vim /usr/lib/systemd/system/ohas.service [Unit] Description=Oracle High Availability Services After=syslog.target [Service] ExecStart=/etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple Restart=always [Install] WantedBy=multi-user.target
以root用户运行下面的命令
systemctl daemon-reload systemctl enable ohas.service systemctl start ohas.service systemctl status ohas.service
ohas.service正常运行即可依次执行脚本orainstRoot.sh ,root.sh
[root@rac1 rules.d]# /u01/app/oraInventory/orainstRoot.sh Changing permissions of /u01/app/oraInventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. Changing groupname of /u01/app/oraInventory to oinstall. The execution of the script is complete. [root@rac1 rules.d]# /u01/app/11.2.0/grid/root.sh Performing root user operation for Oracle 11g The following environment variables are set as: ORACLE_OWNER= grid ORACLE_HOME= /u01/app/11.2.0/grid Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params Creating trace directory User ignored Prerequisites during installation OLR initialization - successful root wallet root wallet cert root cert export peer wallet profile reader wallet pa wallet peer wallet keys pa wallet keys peer cert request pa cert request peer cert pa cert peer root cert TP profile reader root cert TP pa root cert TP peer pa cert TP pa peer cert TP profile reader pa cert TP profile reader peer cert TP peer user cert pa user cert Adding Clusterware entries to upstart CRS-2672: Attempting to start 'ora.mdnsd' on 'rac1' CRS-2676: Start of 'ora.mdnsd' on 'rac1' succeeded CRS-2672: Attempting to start 'ora.gpnpd' on 'rac1' CRS-2676: Start of 'ora.gpnpd' on 'rac1' succeeded CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac1' CRS-2672: Attempting to start 'ora.gipcd' on 'rac1' CRS-2676: Start of 'ora.gipcd' on 'rac1' succeeded CRS-2676: Start of 'ora.cssdmonitor' on 'rac1' succeeded CRS-2672: Attempting to start 'ora.cssd' on 'rac1' CRS-2672: Attempting to start 'ora.diskmon' on 'rac1' CRS-2676: Start of 'ora.diskmon' on 'rac1' succeeded CRS-2676: Start of 'ora.cssd' on 'rac1' succeeded ASM created and started successfully. Disk Group DATA created successfully. clscfg: -install mode specified Successfully accumulated necessary OCR keys. Creating OCR keys for user 'root', privgrp 'root'.. Operation successful. CRS-4256: Updating the profile Successful addition of voting disk 75df39da21084f84bf866b66b29c3ce3. Successfully replaced voting disk group with +DATA. CRS-4256: Updating the profile CRS-4266: Voting file(s) successfully replaced ## STATE File Universal Id File Name Disk group -- ----- ----------------- --------- --------- 1. ONLINE 75df39da21084f84bf866b66b29c3ce3 (ORCL:VOL1) [DATA] Located 1 voting disk(s). CRS-2672: Attempting to start 'ora.asm' on 'rac1' CRS-2676: Start of 'ora.asm' on 'rac1' succeeded CRS-2672: Attempting to start 'ora.DATA.dg' on 'rac1' CRS-2676: Start of 'ora.DATA.dg' on 'rac1' succeeded Configure Oracle Grid Infrastructure for a Cluster ... succeeded 在rac2上執行: [root@rac2 rpm]# /u01/app/oraInventory/orainstRoot.sh Changing permissions of /u01/app/oraInventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. Changing groupname of /u01/app/oraInventory to oinstall. The execution of the script is complete. [root@rac2 rpm]# /u01/app/11.2.0/grid/root.sh Performing root user operation for Oracle 11g The following environment variables are set as: ORACLE_OWNER= grid ORACLE_HOME= /u01/app/11.2.0/grid Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params Creating trace directory User ignored Prerequisites during installation OLR initialization - successful Adding Clusterware entries to upstart CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node rac1, number 1, and is terminating An active cluster was found during exclusive startup, restarting to join the cluster Configure Oracle Grid Infrastructure for a Cluster ... succeeded
完成脚本后,点击OK,进行下一步。
TRANSLATE with x English TRANSLATE with COPY THE URL BELOW Back EMBED THE SNIPPET BELOW IN YOUR SITE Enable collaborative features and customize widget: Bing Webmaster Portal Back 标签:RAC,rac1,app,0.4,11.2,grid,dev,root,u01 From: https://www.cnblogs.com/gaoyuechen/p/18242024