QUICKGUARD ホームページ >

CentOS7のサーバでのOracle11gRAC構築時の注意点

2018.10.18

CentOS7のサーバに少し古いOracle11gRACを構築したい。なんて事ありませんか?

まだまだライセンスの関係などもあり、Oracle11gを利用されているお客様もいらっしゃい
ますが、最新OSのCentOS7にインストールする際には、少しテクニックがいるので、その点
について書いてみたいと思います。

Oracle11gRACを構築するには大きく以下の手順が必要になります。
(1)Oracle Grid Infrastruterインストール
(2)rootユーザーでのスクリプト(orainstRoot.sh, root.sh)実行
(3)Oracle Databaseインストール
(4)rootユーザーでのスクリプト(orainstRoot.sh, root.sh)実行
(5)ASMディスクグループ作成(ASM Configration Assistant)
(6)データベース作成(CREATE DATABASE/Database Configration Assistant)

ただ、上記の手順をそのまま実施していくと、(2)のroot.shスクリプト実行でエラーが表示されてしまいます。

CRS-4124: Oracle High Availability Services startup failed.
CRS-4000: Command Start failed, or completed with errors.
ohasd failed to start:
ohasd failed to start at /opt/app/11.2.0/grid/crs/install/rootcrs.pl line 443.

これは、CentOS7からシステムとサービスの管理にSystemdが採用されているのが起因しています。
実行したroot.shスクリプトがSystemdに対応していないため、ohasdサービスの登録・起動に失敗してしまいます。

ohasdサービスは「Oracle高可用性サービス・デーモン」と呼ばれ、Oracle11g RAC構成を実現するOracle Clusterwareを構成するサービスのため、ohasdサービスが起動しなければ、Oracle11gRACは稼働しません

これを回避するには、root.shスクリプトを実行する前にパッチ18370031を適用する必要があります。
root.shスクリプト実行後にパッチを適用しても、ohasdサービスは起動しません

→Patch 18370031: Oracle Database – Enterprise Edition 11.2.0.4.0 for Linux x86-64 – RC SCRIPTS (/ETC/RC.D/RC.* , /ETC/INIT.D/* ) ON OL7 FOR CLUSTERWARE

パッチはOracle Universal Installer(OUI)を使用して適用も可能ですが、ここではOpatchユーティリティを使用してパッチを適用します。

$ ./opatch napply -oh /opt/app/11.2.0/grid -local /tmp/oracle/patch/18370031

Oracle Interim Patch Installerバージョン11.2.0.3.4
Copyright (c) 2012, Oracle Corporation.  All rights reserved。


Oracle Home       : /opt/app/11.2.0/grid
Central Inventory : /opt/app/oraInventory
   from           : /opt/app/11.2.0/grid/oraInst.loc
OPatch version    : 11.2.0.3.4
OUI version       : 11.2.0.4.0
Log file location : /opt/app/11.2.0/grid/cfgtoollogs/opatch/opatch2018-**-**_**-**-**午前_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   18370031

続行しますか。[y|n]
y
User Responded with: Y
All checks passed.

ローカル・システムのこのORACLE_HOME以外で実行しているOracleインスタンスを停止し てください。
(Oracleホーム = '/opt/app/11.2.0/grid')


ローカル・システムにパッチを適用する準備ができましたか。 [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '18370031' to OH '/opt/app/11.2.0/grid'

コンポーネントoracle.crs, 11.2.0.4.0にパッチを適用中...

Verifying the update...
Patch 18370031 successfully applied.
Log file location: /opt/app/11.2.0/grid/cfgtoollogs/opatch/opatch2018-**-**_**-**-**午前_1.log

OPatch succeeded.

パッチを適用後、root.shスクリプトを実行すれば、問題なくohasdサービスが起動してきます。

# /opt/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=  /opt/app/11.2.0/grid

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.


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: /opt/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 oracle-ohasd.service
CRS-2672: Attempting to start 'ora.mdnsd' on 'testdb01'
CRS-2676: Start of 'ora.mdnsd' on 'testdb01' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'testdb01'
CRS-2676: Start of 'ora.gpnpd' on 'testdb01' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'testdb01'
CRS-2672: Attempting to start 'ora.gipcd' on 'testdb01'
CRS-2676: Start of 'ora.cssdmonitor' on 'testdb01' succeeded
CRS-2676: Start of 'ora.gipcd' on 'testdb01' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'testdb01'
CRS-2672: Attempting to start 'ora.diskmon' on 'testdb01'
CRS-2676: Start of 'ora.diskmon' on 'testdb01' succeeded
CRS-2676: Start of 'ora.cssd' on 'testdb01' 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 ********************************.
Successful addition of voting disk ********************************.
Successful addition of voting disk ********************************.
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   ******************************** (/oradata/data/data01) [DATA]
 2. ONLINE   ******************************** (/oradata/data/data02) [DATA]
 3. ONLINE   ******************************** (/oradata/data/data03) [DATA]
Located 3 voting disk(s).
CRS-2672: Attempting to start 'ora.asm' on 'testdb01'
CRS-2676: Start of 'ora.asm' on 'testdb01' succeeded
CRS-2672: Attempting to start 'ora.DATA.dg' on 'testdb01'
CRS-2676: Start of 'ora.DATA.dg' on 'testdb01' succeeded
Configure Oracle Grid Infrastructure for a Cluster ... succeeded

あとは(3)~(6)を手順どおりに実施すれば、Oracle11gRACは構築されます。

パッチ適用する前にroot.shスクリプトを実行してしまうと、再構築する必要が出てきてしまうので、注意が必要ですね。