Oracle Database boot from the start

If the server is powered off or restarted within the restart plan, after the operating system to start the server, you need to manually start the database instance and listeners, this article describes how to start and shut down the Oracle database system configured to service, when the operating system startup / shutdown, automatic Enable / disable Oracle instances and listeners.

Suppose ORACLE_HOME environment variable value / oracle / home.

1, start the database instance shell script

Script starts the Oracle database is / oracle / home / bin / dbstart, reads as follows:

sqlplus / as sysdba <<EOF
startup;
EOF

2, restart the database instance shell script

Script starts the Oracle database is / oracle / home / bin / dbrestart, reads as follows:

sqlplus / as sysdba <<EOF
shutdown immediate;
startup;
EOF

3, close the database instance shell script

Script starts the Oracle database is / oracle / home / bin / dbshut, reads as follows:

sqlplus / as sysdba <<EOF
shutdown immediate;
EOF

4, system service profile script oracle instance

If the system service named oracle, you create a service profile /usr/lib/systemd/system/oracle.service, reads as follows:

[Unit]
Description=Oracle RDBMS
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/su - oracle -c "/oracle/home/bin/dbstart >> /tmp/oracle.log"
ExecReload=/usr/bin/su - oracle -c "/oracle/home/bin/dbrestart >> /tmp/oracle.log"
ExecStop=/usr/bin/su - oracle -c "/oracle/home/bin/dbshut \>\> /tmp/oracle.log"
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

5, lsnrctl listening system service profile script

If the system service named lsnrctl, then create a service profile /usr/lib/systemd/system/lsnrctl.service, reads as follows:

[Unit]
Description=Oracle lsnrctl
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/su - oracle -c "/oracle/home/bin/lsnrctl start >> /tmp/lsnrctl.log"
ExecReload=/usr/bin/su - oracle -c "/oracle/home/bin/lsnrctl reload >> /tmp/lsnrctl.log"
ExecStop=/usr/bin/su - oracle -c "/oracle/home/bin/lsnrctl stop >> /tmp/lsnrctl.log"
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

6, reload service profile

systemctl daemon-reload

7, start / stop / start and heavy oracle lsnrctl services

systemctl start oracle # 启动oracle服务。
systemctl restart oracle # 重启oracle服务。
systemctl stop oracle # 关闭oracle服务。
systemctl start lsnrctl # 启动lsnrctl服务。
systemctl restart lsnrctl # 重启lsnrctl服务。。
systemctl stop lsnrctl # 关闭lsnrctl服务。

8, and the oracle lsnrctl service is set to power on / off from the start / stop

systemctl enable oracle # 把Oracle实例服务设置为开机自启动。
systemctl enable lsnrctl # 把Oracle监听服务设置为开机自启动。

9, see the Oracle instances and listeners start / stop logs.

Oracle instance starts in /tmp/oracle.log log file.

The day started listening to the /tmp/lsnrctl.log file.

Note that only by systemctl enable / disable Oracle instances and listeners will write the log, manually execute the script does not write the log.

10, Copyright

C Language Technology Network original article, reproduced please indicate the source link to the article, the author and original.

Source: C Language Technology Network (www.freecplus.net)

Author: Ethics Code farming

Published an original article · won praise 2 · Views 6721

Guess you like

Origin blog.csdn.net/u010806950/article/details/105058567