DEV Community

sasakihir
sasakihir

Posted on

[19c Multitenant] Automatically launch an instance

Seems to be the first article about Oracle on dv.io
Enable autostart with oratab

# vi /etc/oratab
orclcdb:/opt/oracle/product/19c/dbhome_1:Y
Enter fullscreen mode Exit fullscreen mode

Create a unit definition file

# cd /etc/systemd/system
# vi dbora.service
[Unit]
Description=Oracle Database Service
After=network.target

[Service]
Type=forking
User=oracle
Group=dba
ExecStart=/opt/oracle/product/19c/dbhome_1/bin/dbstart /opt/oracle/product/19c/dbhome_1
ExecStop=/opt/oracle/product/19c/dbhome_1/bin/dbstart /opt/oracle/product/19c/dbhome_1

[Install]
WantedBy=multi-user.target
Enter fullscreen mode Exit fullscreen mode

Reload the daemon and start the service

 systemctl daemon-reload
# systemctl enable dbora
Created symlink from /etc/systemd/system/multi-user.target.wants/dbora.service to /etc/systemd/system/dbora.service.
# systemctl start dbora
#
Enter fullscreen mode Exit fullscreen mode

Oracle has started properly

# su - oracle
#
# sqlplus / as sysdba
SQL> select instance_name, status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
orclcdb          OPEN
Enter fullscreen mode Exit fullscreen mode

Top comments (0)