今天在做RAC集群环境,安装grid软件执行/u01/app/11.2.0.1/grid/root.sh脚本时出现如下错误提示
Running Oracle 11g root.sh script... The following environment variables are set as: ORACLE_OWNER= grid ORACLE_HOME= /u01/app/11.2.0.1/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.sh script. Now product-specific root actions will be performed. 2021-03-01 10:46:10: Parsing the host name 2021-03-01 10:46:10: Checking for super user privileges 2021-03-01 10:46:10: User has super user privileges Using configuration parameter file: /u01/app/11.2.0.1/grid/crs/install/crsconfig_params Creating trace directory LOCAL ADD MODE Creating OCR keys for user 'root', privgrp 'root'.. Operation 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 daemon to inittab CRS-4124: Oracle High Availability Services startup failed. CRS-4000: Command Start failed, or completed with errors. ohasd failed to start: Inappropriate ioctl for device ohasd failed to start at /u01/app/11.2.0.1/grid/crs/install/rootcrs.pl line 443.
于是就上网查询资料,才发现这是11.2.0.1 RAC环境的经典bug。解决方法也很简单,也就是在执行脚本时出现了 Adding daemon to inittab,然后另开一个窗口执行。
/bin/dd if=/var/tmp/.oracle/npohasd of=/dev/null bs=1024 count=1
当然,窗口可以提前开好,当运行脚本出现 Adding daemon to inittab 立马切换窗口去执行dd那条命令。
注意:重新执行脚本需要删除之前的配置,命令如下。
/u01/app/11.2.0.1/grid/crs/install/roothas.pl -deconfig -force -verbose
在这里,我个人建议还是一切重头开始,因为删除了之前配置。装好了环境后面也遇到了各种问题。还不如一开始就避免这个问题。
另外,装好了RAC环境后。如若你需要重新启动RAC环境,那么你也需要另外开一个窗口来执行这条命令,最好是在执行crsctl start crs 之前执行dd 命令。
/bin/dd if=/var/tmp/.oracle/npohasd of=/dev/null bs=1024 count=1
资料中提到还有另外的解决办法,就是更改/var/tmp/.oracle/npohasd文件的权限,我是两个都做了。影响是没有,反正环境目前是可以正常启停
chown root:oinstall /var/tmp/.oracle/npohasd