Skip to content
Home » Oracle » How Oracle Auto Start Database in Solaris

How Oracle Auto Start Database in Solaris

For Linux Os, you should check this post: How to Auto Start Oracle Database on Linux.

Assuming that you already have some knowledge about how to start Oracle database manually and Oracle provided shell script dbstart, then we can keep going to design and deploy our automatic startup scripts.

By default, Oracle software installation does not deploy startup and shutdown init scripts on the platform, you have to create them by yourself. Here I introduce my scripts for you to use or modify with.

Turn on Startup Option in oratab

Please turn on the startup option by changing "N" to "Y" at the last character of the line.

oracle@solaris11vm:~$ vi /var/opt/oracle/oratab

As for the format of oratab, allow me to interpret this line as followings:

"Hello, my name is ORCL ($ORACLE_SID). I live at /u01/app/oracle/product/11.2.0/dbhome_1 ($ORACLE_HOME). You can find my SPFILE or PFILE in the default location. My answer is Y if you were asking me whether startup is required."

Same format of this file for Linux, but this configuration file will be at /etc/oratab. That's the difference.

Create an init script for Oracle service

Don't forget to switch user to root before doing this.

root@solaris11vm:~# cd /etc/init.d/
root@solaris11vm:/etc/init.d# vi dbora

case "$1" in
'start') # Start the Oracle databases and listeners
'stop') # Stop the Oracle databases and listeners

Also, the listener will be started or shutdown automatically at their running levels respectively.

Adding this init script to rc0 and rc3

We use two soft links to add them into different running levels and prioritize the execution orders by naming the file.

root@solaris11vm:/etc/init.d# chgrp dba dbora
root@solaris11vm:/etc/init.d# chmod 750 dbora
root@solaris11vm:/etc/init.d# ln -s /etc/init.d/dbora /etc/rc0.d/K01dbora
root@solaris11vm:/etc/init.d# ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora

Shutdown and Boot Solaris

Restart the whole server

root@solaris11vm:~# init 6

Then check the instance status

oracle@solaris11vm:~$ sqlplus / as sysdba

SQL*Plus: Release Production on Tue Mar 27 23:31:31 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select name, open_mode from v$database;

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


Check the listener status

oracle@solaris11vm:~$ lsnrctl status

LSNRCTL for Solaris: Version - Production on 27-MAR-2018 23:32:01

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=solaris11vm)(PORT=1521)))
Alias                     LISTENER
Version                   TNSLSNR for Solaris: Version - Production
Start Date                27-MAR-2018 23:30:09
Uptime                    0 days 0 hr. 1 min. 12 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/solaris11vm/listener/alert/log.xml
Listening Endpoints Summary...
Services Summary...
Service "ORCL" has 1 instance(s).
 Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "ORCLXDB" has 1 instance(s).
 Instance "ORCL", status READY, has 1 handler(s) for this service...
The command completed successfully

Now the shell script will auto start Oracle database when the server boots.

For RAC databases, we can also set automatically startup for RAC cluster databases on system boot.

2 thoughts on “How Oracle Auto Start Database in Solaris”

Leave a Reply

Your email address will not be published. Required fields are marked *