OEMインストール

https://dekiruengineer.com/engineer/oracle_enterprize_manager_13c_for_linux/
https://oracle-base.com/articles/13c/cloud-control-13cr1-installation-on-oracle-linux-6-and-7
https://docs.oracle.com/en/enterprise-manager/cloud-control/enterprise-manager-cloud-control/13.5/embsc/
https://docs.oracle.com/en/enterprise-manager/cloud-control/enterprise-manager-cloud-control/13.5/emadv/index.html


OS : Oracle Linux 7.9 (64bit)
DBバージョン : 19c
OEMバージョン : 13.5

CPU : 4core
メモリ : 12G
ディスク : 100G


(1) 使用資材の入手

-- 1.1 Oracle Linuxイメージ
https://edelivery.oracle.com/osdc/faces/SoftwareDelivery
V1009690-01.iso

-- 1.2 Oracleインストールファイル
https://www.oracle.com/jp/database/technologies/oracle19c-linux-downloads.html
LINUX.X64_193000_db_home.zip

-- 1.3 DBテンプレートファイル
https://www.oracle.com/enterprise-manager/downloads/db-templates-13c-release5-downloads.html
19_11_0_0_0_Database_Template_for_EM13_5_0_0_0_Linux_x64.zip

-- 1.4 OEMインストールファイル
https://www.oracle.com/enterprise-manager/downloads/linux-x86-64-13c-rel5-downloads.html
em13500_linux64.bin
em13500_linux64-2.zip
em13500_linux64-3.zip
em13500_linux64-4.zip
em13500_linux64-5.zip


(2) OSインストール

ソフトウェアの選択 : GUI
KDUMP : 無効
セキュリティポリシー : OFF
ネットワークとホスト名 : 自動接続、IPv4手動、IPv6無視する
インストール先 : パーティションを自分で構成する

(3) OS設定

-- 3.1 パッケージインストール
yum install oracle-database-preinstall-19c -y
yum update -y

systemctl disable firewalld
sed -i -e "s/^SELINUX=enforcing$/SELINUX=disabled/g" /etc/selinux/config
reboot


-- 3.2 透過的なHugePagesの無効化確認
cat /sys/kernel/mm/transparent_hugepage/enabled

-- 3.3 ユーザ作成
echo oracle | passwd --stdin oracle
usermod -G backupdba,racdba,dgdba,dba,oper,kmdba  oracle

-- 3.4 PAM修正
vim /etc/pam.d/login
session     required      pam_limits.so


-- 3.5 HOSTSファイル設定
vim /etc/hosts
192.168.137.105      mmm105.example.com mmm105


-- 3.6 ディレクトリ作成
mkdir -p /u01/app/oracle
mkdir /u01/app/oraInventory
chown -R oracle:oinstall /u01
chmod -R 775 /u01

-- 3.7 ユーザ環境設定
vim /home/oracle/.bash_profile

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
export ORACLE_SID=emrep
export PATH=$PATH:$ORACLE_HOME/bin
umask 022
export NLS_LANG=American_America.AL32UTF8


(4) Oracle Database 19cインストール

mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
chown oracle:oinstall /u01/app/oracle/product/19.0.0/dbhome_1
cd /u01/app/oracle/product/19.0.0/dbhome_1
unzip /tmp/LINUX.X64_193000_db_home.zip

----------------
vim /home/oracle/db.rsp

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=backupdba
oracle.install.db.OSDGDBA_GROUP=dgdba
oracle.install.db.OSKMDBA_GROUP=kmdba
oracle.install.db.OSRACDBA_GROUP=racdba
oracle.install.db.rootconfig.executeRootScript=true
oracle.install.db.rootconfig.configMethod=ROOT
oracle.install.db.rootconfig.sudoPath=
oracle.install.db.rootconfig.sudoUserName=

----------------


cd /u01/app/oracle/product/19.0.0/dbhome_1
LANG=C ./runInstaller -silent -noconfig -responseFile /home/oracle/db.rsp

 

(5) テンプレートからDB作成

cd /u01/app/oracle/product/19.0.0/dbhome_1/assistants/dbca/templates/
unzip /tmp/19_11_0_0_0_Database_Template_for_EM13_5_0_0_0_Linux_x64.zip


cp $ORACLE_HOME/assistants/dbca/dbca.rsp /home/oracle

----------------
vim /home/oracle/dbca.rsp

responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v19.0.0
gdbName=emrep
sid=emrep
databaseConfigType=SI
templateName=19_11_0_0_0_Database_Template_for_EM13_5_0_0_0_Small_deployment.dbc
sysPassword=xxxxxxxx
systemPassword=xxxxxxxx
storageType=FS
characterSet=AL32UTF8
nationalCharacterSet=AL16UTF16


----------------
LANG=C /u01/app/oracle/product/19.0.0/dbhome_1/bin/dbca -silent -createDatabase -responseFile /home/oracle/dbca.rsp

 

(6) リスナー作成

cp $ORACLE_HOME/assistants/netca/netca.rsp /home/oracle


----------------
vim /home/oracle/netca.rsp

[GENERAL]
RESPONSEFILE_VERSION="19.0"
CREATE_TYPE="CUSTOM"

SHOW_GUI=false

[oracle.net.ca]
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE="typical"

LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START="LISTENER"
NAMING_METHODS={"TNSNAMES"}


----------------

LANG=C /u01/app/oracle/product/19.0.0/dbhome_1/bin/netca -silent -responsefile /home/oracle/netca.rsp

 

(7) OEMインストール

-- 7.1 データベースとリスナーを起動しておく

-- 7.2 hostsファイルの設定 (rootユーザで実行)
-- ローカルホストの設定をマニュアル記載通りに修正する
vim /etc/hosts

127.0.0.1   localhost.localdomain localhost
::1         localhost.localdomain localhost

-- 7.3 カーネルパラメータ修正 (rootユーザで実行)

vim /etc/sysctl.conf
net.ipv4.ip_local_port_range = 11000 65000

sysctl -p


-- 7.4 必要パッケージ追加 (rootユーザで実行)

yum -y install glibc-devel.i686 gcc

 

-- 7.5 環境変数設定
-- 環境変数の設定をマニュアル記載通りに修正する
export -n ORACLE_HOME
export -n ORACLE_SID
export PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
export -n CLASSPATH


-- 7.6 インストーラ起動
cd /tmp
chmod +x em13500_linux64.bin


cd /tmp
LANG=C ./em13500_linux64.bin -getResponseFileTemplates -outputLoc /home/oracle


----------------
vim /home/oracle/new_install.rsp

RESPONSEFILE_VERSION=2.2.1.0.0
UNIX_GROUP_NAME=oinstall
INSTALL_UPDATES_SELECTION=skip
ORACLE_MIDDLEWARE_HOME_LOCATION=/u01/app/oracle/middleware
ORACLE_HOSTNAME=mmm105.example.com
AGENT_BASE_DIR=/u01/app/oracle/agent
WLS_ADMIN_SERVER_USERNAME=weblogic
WLS_ADMIN_SERVER_PASSWORD=xxxxxxxx
WLS_ADMIN_SERVER_CONFIRM_PASSWORD=xxxxxxxx
NODE_MANAGER_PASSWORD=xxxxxxxx
NODE_MANAGER_CONFIRM_PASSWORD=xxxxxxxx
ORACLE_INSTANCE_HOME_LOCATION=/u01/app/oracle/gc_inst
CONFIGURE_ORACLE_SOFTWARE_LIBRARY=true
SOFTWARE_LIBRARY_LOCATION=/u01/app/oracle/swlib
DATABASE_HOSTNAME=mmm105.example.com
LISTENER_PORT=1521
SERVICENAME_OR_SID=emrep
SYS_PASSWORD=xxxxxxxx
SYSMAN_PASSWORD=xxxxxxxx
SYSMAN_CONFIRM_PASSWORD=xxxxxxxx
DEPLOYMENT_SIZE=SMALL
MANAGEMENT_TABLESPACE_LOCATION=/u01/app/oracle/oradata/EMREP/mgmt.dbf
CONFIGURATION_DATA_TABLESPACE_LOCATION=/u01/app/oracle/oradata/EMREP/mgmt_ecm_depot1.dbf
JVM_DIAGNOSTICS_TABLESPACE_LOCATION=/u01/app/oracle/oradata/EMREP/mgmt_deepdive.dbf
EMPREREQ_AUTO_CORRECTION=false
AGENT_REGISTRATION_PASSWORD=xxxxxxxx
AGENT_REGISTRATION_CONFIRM_PASSWORD=xxxxxxxx
b_upgrade=false
EM_INSTALL_TYPE=NOSEED
CONFIGURATION_TYPE=ADVANCED

----------------

cd /tmp
LANG=C ./em13500_linux64.bin -silent -responseFile /home/oracle/new_install.rsp

/u01/app/oracle/middleware/allroot.sh

https://mmm105.example.com:7803/em

sysman/xxxxxxxx


(8) 自動起動設定

-- 8.1 oracleユーザでの作業

vim /etc/oragchomelist
全エントリをコメントアウト

vim /etc/oratab
emrep:/u01/app/oracle/product/19.0.0/dbhome_1:Y

----------------

vim /home/oracle/start_all.sh

#!/bin/bash
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
export OMS_HOME=/u01/app/oracle/middleware
export AGENT_HOME=/u01/app/oracle/agent/agent_inst
 
# Start everything
$ORACLE_HOME/bin/dbstart $ORACLE_HOME
 
$OMS_HOME/bin/emctl start oms
 
$AGENT_HOME/bin/emctl start agent

----------------

vim /home/oracle/stop_all.sh

#!/bin/bash
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
export OMS_HOME=/u01/app/oracle/middleware
export AGENT_HOME=/u01/app/oracle/agent/agent_inst
 
# Stop everything
$OMS_HOME/bin/emctl stop oms -all
 
$AGENT_HOME/bin/emctl stop agent
 
$ORACLE_HOME/bin/dbshut $ORACLE_HOME

----------------


chmod +x /home/oracle/start_all.sh /home/oracle/stop_all.sh

-- 8.2 rootユーザでの作業

----------------
vim /etc/systemd/system/oms.service

[Unit]
Description=oracle db instance and oms
After=network.target

[Service]
Type=forking
ExecStart=/bin/sh -c "/home/oracle/start_all.sh >> /home/oracle/start_stop_all.log 2>&1"
ExecStop=/bin/sh -c "/home/oracle/stop_all.sh >> /home/oracle/start_stop_all.log 2>&1"
User=oracle
Group=oinstall
TimeoutStartSec=600


[Install]
WantedBy=multi-user.target

----------------

systemctl daemon-reload 
systemctl enable oms.service

 

(9) エージェントインストール
-- 9.1 ホストエージェントインストール前の設定

-- エージェント側
visudo
Defaults visiblepwを含める
Defaults requirettyをコメント・アウト
oracle  ALL=(ALL)       ALL

vim /etc/hosts
マネージャのエントリ追加

yum -y install gcc


DBSNMPユーザのアカウントロック解除
select * from dba_users where username='DBSNMP';
ALTER USER DBSNMP ACCOUNT UNLOCK;
ALTER USER DBSNMP IDENTIFIED BY xxxxxxxx;

-- マネージャ側
vim /etc/hosts
エージェントのエントリ追加

-- 9.2 ホストエージェントインストール
ターゲットの手動追加

ホスト・ターゲットの追加

Agent Base directory : /u01/app/oracle/agent
Instance directory : /u01/app/oracle/agent/agent_inst

名前付き資格証明を追加
ユーザ名 : oracle
実行権限 : なし


※ホストエージェントインストール時のホストアドレスはvipを指定する

-- 9.3 ターゲット追加
-- シングルの場合
ターゲットの手動追加

非ホスト・ターゲットの追加 ガイド付きプロセスの使用

Oracleデータベース、リスナーおよび自動ストレージ管理

-- RACの場合
ターゲットの手動追加

非ホスト・ターゲットの追加 ガイド付きプロセスの使用

Oracleクラスタおよび高可用性サービス

Oracleデータベース、リスナーおよび自動ストレージ管理
 
RACのデータベースインスタンス登録時はホスト名ではなくクラスタ名を使用する