ORACLE11.2.0.4RAC+ASM安装方法(操作系统CENTOS7.6)
前言
创新互联主要业务有网站营销策划、成都网站制作、成都网站建设、微信公众号开发、成都微信小程序、成都h5网站建设、程序开发等业务。一次合作终身朋友,是我们奉行的宗旨;我们不仅仅把客户当客户,还把客户视为我们的合作伙伴,在开展业务的过程中,公司还积累了丰富的行业经验、营销型网站资源和合作伙伴关系资源,并逐渐建立起规范的客户服务和保障体系。
网上的各种文章,尝试过后,发现有很多错漏的地方,还有很多细节没有写,或者是遇到各种报错如何处理,都没写,
这里是我自己整理的安装步骤和解决报错的方法,因为有部分是从自己以前的笔记里截取的截图之类的,所以那些可替换的地方,大家就自己去搞定了哈,实在太萌新的,也没办法了,自己多摸索下,毕竟这个笔记是写给我自己看的,以备以后还会用到,这次因为在新的操作系统环境,踩了N多的坑,花费我大量时间,下次不要再踩了。
我这里的ASM配置是采用的存储裸设备
操作系统CENTOS7.6
数据库ORACLE11.2.0.4
一、ASM磁盘配置
1 、编辑 / etc/scsi_id.config 文件
vi /etc/scsi_id.configo
options=-g
2 、给磁盘分区,并查看磁盘的 uuid (磁盘分区只在一个节点执行即可)
fdisk /dev/sda
n
p
1
默认回车
默认回车
w
fidk /dev/sdb
n
p
1
默认回车
默认回车
w
查看UUID
/usr/lib/udev/scsi_id -g -u -d /dev/sda1
/usr/lib/udev/scsi_id -g -u -d /dev/sdb1
当然磁盘是哪个磁盘,这个要你们自己挂载的时候自己整好,lsblk查看磁盘
忘了在此之前先创建用户及所属组
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper
/usr/sbin/groupadd -g 504 asmadmin
/usr/sbin/groupadd -g 505 asmoper
/usr/sbin/groupadd -g 506 asmdba
/usr/sbin/useradd -g oinstall -G dba,asmdba,oper oracle
/usr/sbin/useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
3 、编辑绑定文件,使用如下规则
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="3628408eff0495d08ef004912d7d6b386", RUN+="/bin/sh -c 'mknod /dev/asmocrdisk b $major $minor; chown grid:asmadmin /dev/asmocrdisk; chmod 0660 /dev/asmocrdisk'"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="361c104516049770bef80026911671d80", RUN+="/bin/sh -c 'mknod /dev/asmdatadisk1 b $major $minor; chown grid:asmadmin /dev/asmdatadisk1; chmod 0660 /dev/asmdatadisk1'"
4 、开始绑定
测试
/sbin/partprobe /dev/sda1
/sbin/udevadm test /block/sda/sda1
/sbin/partprobe /dev/sdb1
/sbin/udevadm test /block/sdb/sdb1
进行绑定命令:
/sbin/udevadm control --reload-rules
5 、绑定完成,可以使用命了 ls -l /dev/asm* 进行查看
lrwxrwxrwx. 1 root root 4 6月 6 16:14 /dev/asm-datadisk1 -> sdb1
lrwxrwxrwx. 1 root root 4 6月 6 16:05 /dev/asm-ocrdisk -> sda1
注意:这个时候可能你会发现ll /dev/asm* 下面啥都木有
这个就要记得,把防火墙关闭了,setenforce 0 iptables -F
然后改那个/etc/selinux/config 永久关闭,vi /dev/udev/rules.d/ 99-oracle-asmdevices.rules 一样的配置
再登陆2节点,lsblk发现为啥没有/dev/sda1 和/dev/sdb1,直接fdisk /dev/sda 和fdisk /dev/sdb然后直接q退出,不用操作
再次lsblk,就发现,ll /dev/asm* 有映射了。
然后回到1节点,ll /dev/asm*发现还是没有映射,那就和2节点一样的操作,fdisk /dev/sda 和fdisk /dev/sdb然后直接q退出,不用操作。再次lsblk,就发现,ll /dev/asm*有映射了。
如果ll /dev/asm* 还是看不到,那就直接reboot重启操作系统应该就能看到了。
二、环境准备
1 、host文件配置
#vi /etc/hosts
192.168.159.6 testdb1
192.168.159.7 testdb2
192.168.159.24 testdb1-vip
192.168.159.25 testdb2-vip
10.1.22.6 testdb1-pri
10.1.22.7 testdb2-pri
192.168.159.26 testdb-scan
( hosts 文件的 IP 对应名称最好只写一个,不要多余的)
以下很重要,不修改会在安装grid的时候会报错
节点1
vi /etc/hostname
testdb1
临时修改hostname
hostname testdb1
节点2
vi /etc/hostname
testdb2
临时修改hostname
hostname testdb2
网卡的配置就不要我说了吧,一个公网网卡,一个私网网卡,配置起来很简单。
2 、安装ORACLE11G所需环境包
yum -y install compat-libstdc++-33 elfutils-libelf-devel gcc gcc-c++ glibc-devel glibc-headers libaio-devel libstdc++-devel sysstat unixODBC unixODBC-devel libcap.so.1
yum -y install binutils compat-db compat-libcap1 compat-libstdc++-33 control-center elfutils-libelf-devel gcc gcc-c++ glibc glibc-common gnome-libs libaio-devel libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio openmotif21 smartmontools
安装yum源的时候,可能会报错?YUM源搞不了?(用本地YUM源的请忽略)
这个时候检查下你的配置文件
vi /etc/resolv.conf
nameserver 114.114.114.114
3 、 参数配置
vi /etc/sysctl.conf
生产库的配置:最后一行添加,重复的去掉
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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 = 1048576
vm.nr_hugepages = 2100
kernel.shmall = 4194304
kernel.shmmax = 17179869183
我这里的物理内存是 16G,SGA是给的4G,所以是以上的参数设置
huge的配置大小
如果你的SGA总量是10G
那么你的hugepage要取一个比 10*1024/2=5120 这个数大的值, 比如5200,我这里是4G所以给的2100
注意,要设置huge,要先看看数据库的内存管理是AMM还是ASMM,如果是AMM就无法使用huge了。
还有内核参数的一些设置,建议值如下:
kernel.shmmax
内存为 12G 时,该值为 12*1024*1024*1024-1 = 12884901887
内存为 16G 时,该值为 16*1024*1024*1024-1 = 17179869183
内存为 32G 时,该值为 32*1024*1024*1024-1 = 34359738367
内存为 64G 时,该值为 64*1024*1024*1024-1 = 68719476735
内存为 128G 时,该值为 128*1024*1024*1024-1 = 137438953471
kernel.shmall
当内存为 12G 时, kernel.shmall = 3145728
当内存为 16G 时, kernel.shmall = 4194304
当内次为 32G 时, kernel.shmall = 8388608
当内存为 64G 时, kernel.shmall = 16777216
当内存为 128G 时, kernel.shmall = 33554432
至于其他的那些参数的设置,网上有很多的建议值还有说明,自己看着来就好了,一般默认值都够用。
(这里注意,生产环境最好都要设置下大页hugepages,不然以后系统运行久了容易遇到内存的一些问题,个人经验)
想查看大页huge
grep Huge /proc/meminfo
使参数立即生效
sysctl -p
vi /etc/security/limits.conf
生产库的配置:最后一行添加,重复的去掉
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 10240
oracle hard nofile 65536
oracle soft stack 10240
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
注意,这里的10240和操作系统连接数有关联哦,ulimit -n可以查看连接数,对应数据库的连接数,自己进行配置哦
vi /etc/pam.d/login
session required pam_limits.so
4 、关闭防火墙
(我这里的环境一般是云端,所以不用考虑防火墙等安全问题,云端上有物理防火墙,N多策略阻挡了)
如果不关闭防火墙,在后面配置集群的时候会遇到麻烦的
service iptables stop
chkconfig iptables off
setenforce 0
getenforce
iptables -F
vi /etc/selinux/config
SELINUX=disabled
SELINUXTYPE=targeted
5 、禁用NTP服务
service ntpd stop
chkconfig ntpd off
mv /etc/ntp.conf /etc/ntp.conf.bak
rm -rf /etc/ntp.conf
6 、用户及用户组,权限目录创建
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper
/usr/sbin/groupadd -g 504 asmadmin
/usr/sbin/groupadd -g 505 asmoper
/usr/sbin/groupadd -g 506 asmdba
/usr/sbin/useradd -g oinstall -G dba,asmdba,oper oracle
/usr/sbin/useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
passwd oracle
passwd grid
mkdir -p /home/u01/app/grid
mkdir -p /home/u01/app/11.2.0/grid
chown -R grid:oinstall /home/u01
mkdir -p /home/u01/app/oracle
chown oracle:oinstall /home/u01/app/oracle
chmod -R 775 /home/u01
7 、oracle及grid环境变量配置
以 oracle 用户登录(两个节点一样)(不要老想着复制粘贴,注意有的路径之间可能会多出空格,这个是博客的BUG,我也不知道为啥会无端端多出空格来,反正经常写博客都遇到自己编辑没空格,别人来复制粘贴就有了。)
节点一
vi .bash_profile
export PATH
umask 022
export ORACLE_BASE=/ home/ u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=testdb1
export LANG=en_US.UTF-8
export NLS_DATE_FORMAT="yyyy-mm-dd hh34: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 ORACLE_PATH=${PATH}:$ORACLE_BASE/common/oracle/sql:.:$ORACLE_HOME/rdbms/admin
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
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 THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
oracle用户,节点二
vi .bash_profile
export PATH
umask 022
export ORACLE_BASE=/ home/ u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=testdb2
export LANG=en_US.UTF-8
export NLS_DATE_FORMAT="yyyy-mm-dd hh34: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 ORACLE_PATH=${PATH}:$ORACLE_BASE/common/oracle/sql:.:$ORACLE_HOME/rdbms/admin
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
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 THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
以 grid 用户登录
节点一:
vi .bash_profile
ORACLE_SID=+ASM1; export ORACLE_SID
JAVA_HOME=/usr/local/java;export JAVA_HOME
ORACLE_BASE=/ home/ u01/app/grid; export ORACLE_BASE
ORACLE_HOME=/ home/ u01/app/11.2.0/grid; export ORACLE_HOME
ORACLE_PATH=/ home/ u01/app/oracle/common/oracle/sql; export ORACLE_PATH
ORACLE_TERM=xterm;export ORACLE_TERM
NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS";export NLS_DATE_FORMAT
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=${PATH}:/ home/ u01/app/common/oracle/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/tmp
export TMPDIR=/tmp
export LANG=en_US.UTF-8
alias sqlplus="rlwrap sqlplus"
umask 022
节点二:
vi .bash_profile
ORACLE_SID=+ASM2; export ORACLE_SID
JAVA_HOME=/usr/local/java;export JAVA_HOME
ORACLE_BASE=/ home/ u01/app/grid; export ORACLE_BASE
ORACLE_HOME=/ home/ u01/app/11.2.0/grid; export ORACLE_HOME
ORACLE_PATH=/ home/ u01/app/oracle/common/oracle/sql; export ORACLE_PATH
ORACLE_TERM=xterm;export ORACLE_TERM
NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS";export NLS_DATE_FORMAT
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=${PATH}:/ home/ u01/app/common/oracle/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/tmp
export TMPDIR=/tmp
export LANG=en_US.UTF-8
alias sqlplus="rlwrap sqlplus"
umask 022
8 、ssh密匙互信配置
设置互信关系,这里记住oracle和grid用户都要设置互信,root也互信,且在测试的时候,2个节点都要进行测试
su - oracle
mkdir ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
以下操作在一个节点上执行即可
cat ~/.ssh/id_rsa.pub>>./.ssh/authorized_keys -公钥存在authorized_keys文件中,写到本机
cat ~/.ssh/id_dsa.pub>>./.ssh/authorized_keys
ssh testdb2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys -第二个节点的公钥写到本机
ssh testdb2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys testdb2:~/.ssh/authorized_keys
两个节点上分别验证
ssh testdb1 date
ssh testdb2 date
ssh testdb1-PRI date
ssh testdb2-PRI date
su - grid
mkdir ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
以下操作在一个节点上执行即可
cat ~/.ssh/id_rsa.pub>>./.ssh/authorized_keys -公钥存在authorized_keys文件中,写到本机
cat ~/.ssh/id_dsa.pub>>./.ssh/authorized_keys
ssh testdb2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys -第二个节点的公钥写到本机
ssh testdb2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys testdb2:~/.ssh/authorized_keys
两个节点上分别验证
ssh testdb1 date
ssh testdb2 date
ssh testdb1-PRI date
ssh testdb2-PRI date
如果要打集群补丁之类的,root用户也来验证一下
三、GRID/ASM安装
1 )使用 oracle 用户解压安装包(其实root解压也一样)
2 )使用 grid 用户登录安装 grid
安装图形化
yum -y groupinstall "X Window System"
yum -y install compat-libstdc++-33 elfutils-libelf-devel gcc gcc-c++ glibc-devel glibc-headers libaio-devel libstdc++-devel sysstat unixODBC unixODBC-devel
yum install -y compat-libcap1-1.10 libcap.so.1 libstdc++-devel-4.4.4 gcc-c++-4.4.4 smartmontools libaio-devel-0.3.107
把你下载的安装包都解压了吧,我一般都把安装包放在/opt/目录(在其中一个节点操作就可以了)
cd /opt/
unzip p13390677_112040_Linux-x86-64_1of7.zip
unzip p13390677_112040_Linux-x86-64_2of7.zip
unzip p13390677_112040_Linux-x86-64_3of7.zip
解压之后会出现2个目录database和grid
rpm -ivh /opt/grid/rpm/cvuqdisk-1.0.9-1.rpm ( 解压 grid 安装包里面可以找到,如果无法安装,请先安装yum install smartmontools这个 )
rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm (这里必须安装这个版本)
注意事项:安装 GRID 时, VIP 设置的时候要全部小写, VIP 的 IP 不允许占用
root用户xhost +回车
su - grid
export DISPLAY=192.168.159.6:0.0
cd /opt/grid/
./runInstaller
(1)步骤一
(2)步骤二
(3)步骤三
(4)步骤四
(5)步骤五
(6)步骤六
遇到报错:
遇到以上报错需将scan name修改为/etc/hosts下的scan存在的名字,比如testdb-scan
192.168.159.6 testdb1
192.168.159.7 testdb2
192.168.159.24 testdb1-vip
192.168.159.25 testdb2-vip
10.1.22.6 testdb1-pri
10.1.22.7 testdb2-pri
192.168.159.26 testdb-scan
步骤7也是一样的问题,相对应的名称要与/etc/hosts设置的一致(注意,如果在安装过程中修改了/etc/hosts,需要重新打开安装程序才可以识别)
(7)步骤七
这里如果遇到报错,检查ifconfig 的IP地址是否被占用,检查grid和oracle互信是否正常
Public hostname 必须填写物理节点的主机名
virtual hostname 可以填写/etc/hosts下的主机名
注意:双节点必须密匙互信,包含主机名,虚拟主机名,互信之后,如果是报错互信,要配置完互信之后,重新启动安装程序才可识别
互信的用户包含 grid,oracle
注意,自己和自己也要互信
如果出现以上报错,应检查VIP是否被使用被占用
Ifconfig
Ping vip地址是否通
如果发现已被占用,只能换一个IP地址
(8)步骤八
(9)步骤九
注意,必须要有双网卡, 一个公网,一个私网
(10)步骤十
(11)步骤十一
注意了,如果出现下图这样的情况,有可能是你的/etc/udev/rules.d/ 99-oracle-asmdevices.rules那个文件配置不正确,这样会导致最后grid安装失败的,必须检查清楚
正确的如下图:
(12)步骤十二
(13)步骤十三(如果设置一个16位大小写字母+数字+特殊字符,这个步骤就不会出现)
(14)步骤十四
(15)步骤十五
(16)步骤十六
(17)步骤十七(注意目录本来是不存在的,点击NEXT后自动在服务器上创建)
(18)步骤十八
(19)步骤十九
如果这里这么多问题,就一个个解决吧,尤其是有个FAILED的。
swap size 查看了自己的swap有8G,要求16G,这个问题不大,可以忽略
OS KERNEL的问题,检查了下/etc/sysctl.conf,发现shmmax没设置,加上去
pdksh的问题,必须得安装pdksh-5.2.14-37.el5_8.1.x86_64.rpm这个版本的
cvuqdisk的问题,必须的安装 /opt/grid/rpm/cvuqdisk-1.0.9-1.rpm (这个是 grid 安装包解压后可以找到)
正常的检测结果如下图:
(20)步骤二十
在新的终端使用root用户执行下面两个脚本:
报错出现了。。。执行到第二个脚本的时候报错,如下:
#/home/u01/app/oraInventory/orainstRoot.sh
Changing permissions of /home/u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /home/u01/app/oraInventory to oinstall.
The execution of the script is complete.
# /home/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= /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: /home/u01/app/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
Installing Trace File Analyzer
Failed to create keys in the OLR, rc = 127, Message:
/home/u01/app/11.2.0/grid/bin/clscfg.bin: error while loading shared libraries: libcap.so.1: cannot open shared object file: No such file or directory
Failed to create keys in the OLR at /home/u01/app/11.2.0/grid/crs/install/crsconfig_lib.pm line 7660.
/home/u01/app/11.2.0/grid/perl/bin/perl -I/home/u01/app/11.2.0/grid/perl/lib -I/home/u01/app/11.2.0/grid/crs/install /home/u01/app/11.2.0/grid/crs/install/rootcrs.pl execution failed
怎么办呢,上网查了下资料,尝试了下
yum install libcap.so.1
安装完了之后,重新执行第二个脚本,没用,还是报错呢,咋办呢,继续查。。。
发现有这样的解决办法:
ls -lt /usr/lib64/libcap.so.2
lrwxrwxrwx. 1 root root 14 5月 9 14:20 /usr/lib64/libcap.so.2 -> libcap.so.2.22
ln -s /usr/lib64/libcap.so.2 /usr/lib64/libcap.so.1
(注意了,如果你的是CENTOS6.5版本操作系统,
就需要安装yum install libcap.so.2,然后
find / -name libcap.so.2
ln -s /lib64/libcap.so.2 /usr/lib64/libcap.so.1
再次执行那个root脚本)
再次重新执行第二个脚本,还是报错,肿么办,继续查资料,
报错如下:
Adding Clusterware entries to inittab
ohasd failed to start
Failed to start the Clusterware. Last 20 lines of the alert log follow:
2015-05-23 23:37:45.460:
[client(13782)]CRS-2101:The OLR was formatted using version 3.
按以下网址的方法解决:
https://blog.csdn.net/u010692693/article/details/48374557
如下:
[root@rac1 ~]# /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@zjdb1 ~]# /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
Installing Trace File Analyzer
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 inittabohasd failed to start
Failed to start the Clusterware. Last 20 lines of the alert log follow:
2015-05-23 23:37:45.460:
[client(13782)]CRS-2101:The OLR was formatted using version 3.
报错原因:
因为RHEL 7使用systemd而不是initd运行进程和重启进程,而root.sh通过传统的initd运行ohasd进程。
在RHEL 7中ohasd需要被设置为一个服务,在运行脚本root.sh之前。
步骤如下:
1. 以root用户创建服务文件
#touch /usr/lib/systemd/system/ohas.service
#chmod 777 /usr/lib/systemd/system/ohas.service
2. 将以下内容添加到新创建的ohas.service文件中
[root@rac1 init.d]# cat /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
3. 以root用户运行下面的命令
systemctl daemon-reload
systemctl enable ohas.service
systemctl start ohas.service
4. 查看运行状态[root@rac1 init.d]# systemctl status ohas.service
ohas.service - Oracle High Availability Services
Loaded: loaded (/usr/lib/systemd/system/ohas.service; enabled)
Active: failed (Result: start-limit) since Fri 2015-09-11 16:07:32 CST; 1s ago
Process: 5734 ExecStart=/etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple (code=exited, status=203/EXEC)
Main PID: 5734 (code=exited, status=203/EXEC)
Sep 11 16:07:32 rac1 systemd[1]: Starting Oracle High Availability Services...
Sep 11 16:07:32 rac1 systemd[1]: Started Oracle High Availability Services.
Sep 11 16:07:32 rac1 systemd[1]: ohas.service: main process exited, code=exited, status=203/EXEC
Sep 11 16:07:32 rac1 systemd[1]: Unit ohas.service entered failed state.
Sep 11 16:07:32 rac1 systemd[1]: ohas.service holdoff time over, scheduling restart.
Sep 11 16:07:32 rac1 systemd[1]: Stopping Oracle High Availability Services...
Sep 11 16:07:32 rac1 systemd[1]: Starting Oracle High Availability Services...
Sep 11 16:07:32 rac1 systemd[1]: ohas.service start request repeated too quickly, refusing to start.
Sep 11 16:07:32 rac1 systemd[1]: Failed to start Oracle High Availability Services.
Sep 11 16:07:32 rac1 systemd[1]: Unit ohas.service entered failed state.
此时状态为失败,原因是现在还没有/etc/init.d/init.ohasd文件。
下面可以运行脚本root.sh 不会再报ohasd failed to start错误了。
failed to start错误,可能是root.sh脚本创建了init.ohasd之后,ohas.service没有马上启动,解决方法参考以下:
当运行root.sh时,一直刷新/etc/init.d ,直到出现 init.ohasd 文件,马上手动启动ohas.service服务 命令:systemctl start ohas.service
[root@rac1 init.d]# systemctl status ohas.service
ohas.service - Oracle High Availability Services
Loaded: loaded (/usr/lib/systemd/system/ohas.service; enabled)
Active: active (running) since Fri 2015-09-11 16:09:05 CST; 3s ago
Main PID: 6000 (init.ohasd)
CGroup: /system.slice/ohas.service
6000 /bin/sh /etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple
6026 /bin/sleep 10
Sep 11 16:09:05 rac1 systemd[1]: Starting Oracle High Availability Services...
Sep 11 16:09:05 rac1 systemd[1]: Started Oracle High Availability Services.
Sep 11 16:09:05 rac1 su[6020]: (to grid) root on none
问题一个接一个,再次执行第二个脚本,又又又又报错了。。。我只是想安静的装个RAC,咋那么多新问题呢。。。
报错如下:
未能创建磁盘组OCR_DATA,返回信息如下:
ORA-15018:diskgroup cannot be created
ORA-15020:discovered duplicate ASM disk "OCR_DATA_0000"
嗯,后来发现,就是/etc/udev/rules.d/下的那个文件出的问题,如果按照上面我更新了的一路做下来,就解决了。
哦,忘记说了,如果第一次操作不是按我记录的总结做的,请dd一下asm盘,重新fdisk一下,重启操作系统,
嗯,反正就是配置ASM的那些操作认真的重搞一下,就OK了,最重要的是 一定要重启操作系统。一定要重启操作系统。
一定要重启操作系统。重要的事情说三遍!!!!
啊啊啊啊啊啊,真的要疯掉了。。。因为又又又又又报错了,,,为啥要说又呢。。。因为这是最后一次报错了,
报错如下:
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: /home/db/u01/app/11.2.0/grid/crs/install/crsconfig_params
User ignored Prerequisites during installation
Installing Trace File Analyzer
Adding Clusterware entries to inittab
ohasd failed to start
Failed to start the Clusterware. Last 20 lines of the alert log follow:
2019-06-13 14:30:25.080:
[client(2314)]CRS-2101:The OLR was formatted using version 3.
2019-06-13 14:41:00.497:
[ohasd(8133)]CRS-0715:Oracle High Availability Service has timed out waiting for init.ohasd to be started.
好吧。。。咋又出现上面解决过的ohasd的报错呢???咋回事啊?老弟?
后来发现,通过这个命令检查状态
systemctl status ohas.service
● ohas.service - Oracle High Availability Services
Loaded: loaded (/usr/lib/systemd/system/ohas.service; enabled; vendor preset: disabled)
Active: active (running) since 四 2019-06-13 11:33:05 CST; 4h 18min ago
Main PID: 4195 (init.ohasd)
CGroup: /system.slice/ohas.service
├─ 4195 /bin/sh /etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple
└─13011 /bin/sleep 10
6月 13 11:33:05 localhost.localdomain systemd[1]: Started Oracle High Availability Services.
我晕哦,怎么变成Localhost了?
检查了下/etc/hosts
嗯嗯嗯,额鹅鹅鹅,原来默认的那个localhost127.0.0.1 的东西没删掉,删除了,把那个错误的local进程kill
然后再检查,新的进程是主机名的 systemd[1]了,这回终于好了, 脚本root.sh终于成功。
好吧,节点1成功后的信息:
CRS-2672: Attempting to start 'ora.mDNSd' on 'testdb1'
CRS-2676: Start of 'ora.mdnsd' on 'testdb1' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'test db1'
CRS-2676: Start of 'ora.gpnpd' on 'testdb1' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'testdb1'
CRS-2672: Attempting to start 'ora.gipcd' on 'testdb1'
CRS-2676: Start of 'ora.cssdmonitor' on 'testdb1' succeeded
CRS-2676: Start of 'ora.gipcd' on 'testdb1' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'testdb1'
CRS-2672: Attempting to start 'ora.diskmon' on 'testdb1'
CRS-2676: Start of 'ora.diskmon' on 'testdb1' succeeded
CRS-2676: Start of 'ora.cssd' on 'testdb1' succeeded
已成功创建并启动 ASM。
已成功创建磁盘组OCR_VOTE。
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 34a2677d79854f78bf3ce189ea1ee690.
Successfully replaced voting disk group with +OCR_VOTE.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 34a2677d79854f78bf3ce189ea1ee690 (/dev/asmocrdisk) [OCR_VOTE]
Located 1 voting disk(s).
CRS-2672: Attempting to start 'ora.asm' on 'testdb1'
CRS-2676: Start of 'ora.asm' on 'testdb1' succeeded
CRS-2672: Attempting to start 'ora.OCR_VOTE.dg' on 'testdb1'
CRS-2676: Start of 'ora.OCR_VOTE.dg' on 'testdb1' succeeded
Configure Oracle Grid Infrastructure for a Cluster ... succeeded
那么问题来了,本满心欣喜的以为节点2也会一样的轻松写意,,,结果可想而知。。。又又又又报错了,为啥又要说又呢。
因为在节点2执行root脚本报错如下:
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: /home/db/u01/app/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
Installing Trace File Analyzer
OLR initialization - successful
Adding Clusterware entries to inittab
CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node testdb1, number 1, and is terminating
An active cluster was found during exclusive startup, restarting to join the cluster
Start of resource "ora.asm" failed
CRS-2800: Cannot start resource 'ora.ctssd' as it is already in the INTERMEDIATE state on server 'testdb2'
CRS-4000: Command Start failed, or completed with errors.
Failed to start Oracle Grid Infrastructure stack
Failed to start ASM at /home/db/u01/app/11.2.0/grid/crs/install/crsconfig_lib.pm line 1339.
/home/db/u01/app/11.2.0/grid/perl/bin/perl -I/home/db/u01/app/11.2.0/grid/perl/lib -I/home/db/u01/app/11.2.0/grid/crs/install /home/db/u01/app/11.2.0/grid/crs/install/rootcrs.pl execution failed
解决方法:
节点1
vi /etc/hostname
testdb1
hostname testdb1
节点2
vi /etc/hostname
testdb2
hostname testdb2
重启操作系统
再次执行root.sh脚本成功安装,当然,如果觉得不够稳得,可以重装
ORACLE_OWNER= grid
ORACLE_HOME= /home/db/u01/app/11.2.0/grid
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.
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: /home/db/u01/app/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
Installing Trace File Analyzer
OLR initialization - successful
Adding Clusterware entries to inittab
CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node yytsdb1, 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
如果安装过程中遇到下图报错:
尝试ping scan ip ,能ping 通,可以忽略报错
安装完成检查集群状态正常
crsctl stat res -t
至此,GRID的安装顺利完成。
四、 配置 ASM 磁盘
使用grid 用户在桌面图形环境中运行asmca
创建数据磁盘组
五 、安装RAC 数据库
(1 )步骤一
安装好xmanager 软件
Xshell
配置好属性SSH— 隧道
重新开启一个xshell 窗口
Xhost +
Su – oracle
Export DISPLAY=xxx.xxx.xxx.xxx:0.0
使用ORACLE 用户登录,./runInstaller
(2 )步骤二
(3 )步骤三
(4 )步骤四
(5 )步骤五
(6 )步骤六
(7 )步骤七
(8 )步骤八
(9 )步骤九
(10 )步骤十
(11 )步骤十一
(12 )步骤十二
(13 )步骤十三
(14 )步骤十四
(15 )步骤十五
注意!!!这里因为是CENTOS7.6的系统,在安装过程中会遇到以下报错:
解决方法:(只需要在1节点改就可以了,2节点会自动同步的)
Error in invoking target 'agent nmhs' of makefile '/u01/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk'
解决方案: 保留安装过程,另外开启一个终端窗口,将ins_emagent.mk文件中的 (MK_EMAGENT_NMECTL)更改为$(MK_EMAGENT_NMECTL) -lnnz11,然后在安装过程中点击Retry即可。
这个添加的-lnnz11 是 减号小写字母l ,两个数字1,你们懂得
(16 )步骤十六
使用root 用户在各节点执行root 脚本
(17 )步骤十七
(16 )步骤十六
使用root 用户在各节点执行root 脚本
(17 )步骤十七
6 、创建ORACLE 实例
(1 )步骤一
使用oracle 用户登录,执行dbca
(2 )步骤二
安装RAC
(3 )步骤三
(4 )步骤四
(5 )步骤五
这里注意,如果遇到以下报错,则按提示完成GRID 的LISTENER 配置
Xhost +
Su – grid
Export DISPLAY=xxx.xxx.xxx.xxx:0.0
Netca
全部选择默认下一步安装即可
如果没遇到问题,直接继续下一步
(6 )步骤六
(7 )步骤七
这里我自己在后续安装过程中,都习惯性设置一个16位的大小写字母+数字+特殊字符的密码了
(8 )步骤八
(9 )步骤九
(10 )步骤十
(11 )步骤十一
这里在生产库中,一般要放在数据盘的ASM DATA目录下,且记得Enable Archiving可以直接在这里设置好,勾选即可默认在DATA目录自动创建archive的日志目录,当然安装完成之后再去设置也可以。
(12 )步骤十二
(13 )步骤十三
(14 )步骤十四
这里在生产环境,一样要和开发,应用 那边沟通好, 使用什么字符集,不然,到时不符合要求又要重装就比较麻烦了。
(15 )步骤十五
(16 )步骤十六
(17 )步骤十七
(18 )步骤十八
开始创建实例
(19 )步骤十九
安装好了
(20 )步骤二十
测试连接一下数据库安装完成
当前名称:ORACLE11.2.0.4RAC+ASM安装方法(操作系统CENTOS7.6)
标题网址:http://hbruida.cn/article/pjgeec.html