前言

网上的各种文章,尝试过后,发现有很多错漏的地方,还有很多细节没有写,或者是遇到各种报错如何处理,都没写,

这里是我自己整理的安装步骤和解决报错的方法,因为有部分是从自己以前的笔记里截取的截图之类的,所以那些可替换的地方,大家就自己去搞定了哈,实在太萌新的,也没办法了,自己多摸索下,毕竟这个笔记是写给我自己看的,以备以后还会用到,这次因为在新的操作系统环境,踩了N多的坑,花费我大量时间,下次不要再踩了。

我这里的ASM配置是采用的存储裸设备

操作系统CENTOS7.6

数据库ORACLE11.2.0.4

一、ASM磁盘配置

、编辑 / etc/scsi_id.config 文件

vi   /etc/scsi_id.configo

options=-g

、给磁盘分区,并查看磁盘的 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查看磁盘

、编辑绑定文件,使用如下规则

vi 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′”

、开始绑定

测试

/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

、绑定完成,可以使用命了 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

二、环境准备

、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

、安装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

、 参数配置

vi /etc/sysctl.conf

生产库的配置:最后一行添加,重复的去掉

kernel.shmall = 4294967295

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 = 2048

kernel.shmmax = 4294967295

 (这里注意,生产环境最好都要设置下大页hugepages,不然以后系统运行久了容易遇到内存的一些问题,个人经验)

想查看大页huge

grep Huge /proc/meminfo

使参数立即生效

sysctl -p

vi /etc/security/limits.conf

生产库的配置:最后一行添加,重复的去掉

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

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

vi /etc/pam.d/login

session required pam_limits.so

、关闭防火墙

(我这里的环境一般是云端,所以不用考虑防火墙等安全问题,云端上有物理防火墙,N多策略阻挡了)

如果不关闭防火墙,在后面配置集群的时候会遇到麻烦的

service iptables stop

chkconfig iptables off

setenforce 0

getenforce

iptables -F

vi /etc/selinux/config

SELINUX=disabled

SELINUXTYPE=targeted

、禁用NTP服务

service ntpd stop

chkconfig ntpd off

mv /etc/ntp.conf /etc/ntp.conf.bak

rm -rf /etc/ntp.conf

、用户及用户组,权限目录创建

/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

、oracle及grid环境变量配置

以 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=testdb1

export NLS_LANG=AMERICAN_AMERICA.UTF8

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 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 NLS_LANG=AMERICAN_AMERICA.UTF8

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 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.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.UTF-8

alias sqlplus=”rlwrap sqlplus”

umask 022

、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 用户解压安装包

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 

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

再次重新执行第二个脚本,还是报错,肿么办,继续查资料,

报错如下:

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

 问题一个接一个,再次执行第二个脚本,又又又又报错了。。。我只是想安静的装个RAC,咋那么多新问题呢。。。

报错如下:

嗯,后来发现,就是/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脚本成功安装,当然,如果觉得不够稳得,可以重装Performing root user operation for Oracle 11gThe following environment variables are set as: 
    ORACLE_OWNER= grid 
    ORACLE_HOME=  /home/db/u01/app/11.2.0/gridEnter the full pathname of the local bin directory: [/usr/local/bin]: 
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的系统,在安装过程中会遇到以下报错:

解决方法:

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 )步骤十七

、创建 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 )步骤二十

测试连接一下数据库安装完成

最后,安装完成后,要记得检查防火墙getenforce和iptables,检查监听,scan监听,再自己用工具连接下数据库

到此基本安装完毕,后面的建表空间,建用户啥的,自己看着来整,这里不赘述了。

安装完成后,记得配置ulimit -n的配置

永久生效的(配置完需要重启操作系统)

vi /etc/security/limits.conf

# End of file

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 10240

grid hard nofile 65536 

grid soft stack 10240

*  soft memlock  56623104

*  hard memlock  56623104

Comments are closed.