Using Webmin to Start Oracle Automatically on Solaris Boot

I tried a few different techniques to get my Oracle startup script to run at boot on Solaris. I couldn’t get it to work using the old style “init.d” and “rc_3.d” directory methods, which have now been depreciated in Solaris 10 and replaced with the “Service Management Facility (SMF)”. You can still use the old legacy methods but I just could not get them to work. I started to read up on the SMF and other methods for controlling bootup and found this page on informIT which is a chapter from a Solaris exam prep book. This chapter goes into a lot of detail and includes info on using the SMF as well as info on legacy service starting methods.

I was about halfway through this when it was suggested I use Webmin for Solaris to manage startup services etc. I hadn’t used webmin properly before but I was pretty amazed at how easy it makes quite a lot of system management.

My database startup script had to be started as the correct user (oracle) which I think was throwing off my previous attempts at starting the script as a service. I am positive there is a better way of running the script than using “su – oracle -c” then the command but I couldn’t find how else to make sure it was running as the right user..

Solution: Use Webmin to make a bootup action and let it take care of where the script is started from. I should really dig around and see exactly what it has changed but for the time being this will do fine.

  1. Install the Webmin package using the instructions on their site.
  2. Go to the Webmin page at “http://yoursite:10000″.
  3. Click “System” then “Bootup and Shutdown” then on the page that opens click “Create a new bootup and shutdown action”.
  4. Put in a name (has to be standard name, no spaces) and description of your script.
  5. Now put in the actual script in the “bootup commands” box. For me this was “su – oracle -c /export/home/app/oracle/oracle/product/10.2.0/db_1/startupdb”.
  6. Make sure it is set to start at boot time and click “Create”.

.

Now your script will start as a service at boot time. For me it made the boot a little longer than usual but it’s a price I’m willing to pay to not have to log in and start Oracle manually!

For reference my “startupdb” script is the following (which also includes environment variables I thought I might need):

#!/bin/sh

ORACLE_HOSTNAME=myhostname;
ORACLE_SID=orcl;
ORACLE_BASE=/export/home/app/oracle;
ORACLE_HOME=/export/home/app/oracle/oracle/product/10.2.0/db_1;
PATH=/usr/sbin:/usr/bin:/usr/openwin/bin:/usr/ucb/:/export/home/app/oracle/oracle/product/10.2.0/db_1/bin;

export ORACLE_HOSTNAME ORACLE_SID ORACLE_BASE ORACLE_HOME PATH;

sqlplus sys/password as sysdba <<ENDOFSQL
startup;
exit;
ENDOFSQL
emctl stop dbconsole; emctl start dbconsole; lsnrctl start;

2 thoughts on “Using Webmin to Start Oracle Automatically on Solaris Boot

  1. Pingback: SQLPlus, SQL, Starting & Controlling Oracle Using Shell Scripts « James Rossiter

  2. Pingback: SQLPlus, SQL, Starting & Controlling Oracle Using Shell Scripts | James Rossiter

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>