Oracle Grid Infrastructure for a Standalone Server

目的:

测试Oracle Grid Infrastructure for a Standalone Server中ASM安装在NFS。

环境:

OS:redhat 7.9

GRID:11204

操作:

NFS服务端:       192.168.100.200

NFS客户端+Oracle:192.168.100.58

服务端

vi  /etc/exports

/oracle_nfs *(rw,no_root_squash,no_all_squash,sync)

配置生效

exportfs -r

重启NFS服务即可

service rpcbind restart ;service nfs restart

查看 RPC 服务的注册状况

rpcinfo -p localhost

客户端

查看服务器抛出的共享目录信息

[root@mysql02 ~]# showmount -e 192.168.31.200

Export list for 192.168.31.200:

/oracle_nfs *

挂载

[root@mysql02 soft]# mount -t nfs -o rw,bg,hard,nointr,tcp,nfsvers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 192.168.31.200:/oracle_nfs /oradata

[root@mysql02 soft]# df -h
Filesystem                  Size  Used Avail Use% Mounted on
devtmpfs                    471M     0  471M   0% /dev
tmpfs                       496M     0  496M   0% /dev/shm
tmpfs                       496M  7.5M  488M   2% /run
tmpfs                       496M     0  496M   0% /sys/fs/cgroup
/dev/mapper/cjc-root         47G   18G   30G  39% /
/dev/sda1                  1014M  204M  811M  21% /boot
tmpfs                       100M   12K  100M   1% /run/user/42
tmpfs                       100M     0  100M   0% /run/user/0
/dev/loop0                  4.2G  4.2G     0 100% /mnt
192.168.31.200:/oracle_nfs   47G   21G   27G  45% /oradata

创建磁盘

# dd if=/dev/zero of=/oradata/disk1 bs=1M count=200 oflag=direct

配置安装grid环境

......

启动安装

可以正常识别到磁盘

执行root.sh会报错,可以打补丁,或者按如下方式处理:

执行卸载操作报错:

[root@mysql02 grid]# /oracle/crs/crs/install/roothas.pl -deconfig -force -verbose 
Can't locate Env.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /oracle/crs/crs/install) at /oracle/crs/crs/install/crsconfig_lib.pm line 703.
BEGIN failed--compilation aborted at /oracle/crs/crs/install/crsconfig_lib.pm line 703.
Compilation failed in require at /oracle/crs/crs/install/roothas.pl line 166.
BEGIN failed--compilation aborted at /oracle/crs/crs/install/roothas.pl line 166.
[root@mysql02 grid]#

拷贝文件

[root@mysql02 grid]# cp /oracle/crs/perl/lib/5.10.0/Env.pm /usr/lib64/perl5/vendor_perl/

再次执行 

[root@mysql02 grid]# /oracle/crs/crs/install/roothas.pl -deconfig -force -verbose 
Using configuration parameter file: /oracle/crs/crs/install/crsconfig_params
CRS-2613: Could not find resource 'ora.cssd'.
CRS-4000: Command Stop failed, or completed with errors.
CRS-2613: Could not find resource 'ora.cssd'.
CRS-4000: Command Delete failed, or completed with errors.
CRS-4133: Oracle High Availability Services has been stopped.
Successfully deconfigured Oracle Restart stack

因为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文件中

vi /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
[root@mysql02 ~]# systemctl start ohas.service
[root@mysql02 ~]# 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 Sun 2022-01-02 11:41:07 CST; 3s ago
 Main PID: 11950 (init.ohasd)
   CGroup: /system.slice/ohas.service
           └─11950 /bin/sh /etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple
Jan 02 11:41:07 mysql02 systemd[1]: Started Oracle High Availability Services.
Jan 02 11:41:07 mysql02 systemd[1]: Starting Oracle High Availability Services...
Jan 02 11:41:07 mysql02 su[11973]: (to grid) root on none

再次运行root.sh。

[root@mysql02 rpm]# /oracle/crs/root.sh 
Performing root user operation for Oracle 11g 
The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /oracle/crs
Enter 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.
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: /oracle/crs/crs/install/crsconfig_params
LOCAL ADD MODE 
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE 
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node mysql02 successfully pinned.
Adding Clusterware entries to inittab
mysql02     2022/01/02 12:02:39     /oracle/crs/cdata/mysql02/backup_20220102_120239.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server


#####chenjuchao 20220102 15:20#####

请使用浏览器的分享功能分享到微信等