CentOS7.5でOracle12c(12.2.0)を自動起動するメモ

2018年9月19日

メモ下記

1.oratabの設定
# vim /etc/oratab
USERDB1:/opt/oracle/product/12.2.0/db_1:Y

2.環境変数の設定
# vim /etc/sysconfig/env.oracledb
ORACLE_BASE=/opt/oracle
ORACLE_HOME=/opt/oracle/product/12.2.0/db_1
ORACLE_SID=USERDB1

3.Listener起動サービスファイルの設定
# vim /etc/systemd/system/oraclelsnr.service
[Unit]
Description = Oracle Listener
After=network.target
[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/env.oracledb
ExecStart=/opt/oracle/product/12.2.0/db_1/bin/lsnrctl start
ExecStop=/opt/oracle/product/12.2.0/db_1/bin/lsnrctl stop
Restart=always
User=oracle
Group=oinstall
[Install]
WantedBy=multi-user.target

4.DB起動サービスファイルの設定
# vim /etc/systemd/system/oracledb.service
[Unit]
Description=Oracle databaes service
After=network.target oraclelsnr.service
[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/env.oracledb
ExecStart=/opt/oracle/product/12.2.0/db_1/bin/dbstart /opt/oracle/product/12.2.0/db_1
ExecStop=/opt/oracle/product/12.2.0/db_1/bin/dbshut /opt/oracle/product/12.2.0/db_1
Restart=always
User=oracle
Group=oinstall
[Install]
WantedBy=multi-user.target

5.設定内容を反映
# systemctl daemon-reload
# systemctl enable oraclelsnr
# systemctl enable oracledb

Oracle

Posted by arkgame