Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: startup and shutdown oracle in solaris 8
In our last gripping episode Chris Lee <clee_at_innocent.com> wrote:
> Hi,
>
> My company just installed Oracle 8i on a solaris 8 machine. Right now,
> we have to start and shutdown the database manually. We would like to
> change it so that when the system starts, it will start the database
and
> the listener, and when the system shutdowns, it will shutdown the
> database and the listener too. Does anyone knows how I can do it?
>
> Thanks,
>
> -- Chris
>
That can be accomplished with the rc scripts used when the system boots and shuts down. Most UNIX systems have /etc/rc?.d directories along with an /etc/init.d directory. The /etc/init.d directory is used to hold scripts designed to start and stop services; the scripts are named after the service. For your Oracle database and listener you would create a short script to start services or stop them depending upon the parameter sent to the script. An example follows:
#!/bin/sh # # oracle # # Start or stop Oracle services automatically # # Used at system boot or system shutdown #
case $1 in
'start') su - oracle -c "dbstart" su - oracle -c "lsnrctl start";; 'stop') su - oracle -c "lsnrctl stop" su - oracle -c "dbshut";; *) echo "Invalid parameter" echo "USAGE: `basename $0` start|stop";;esac
This script should be named 'oracle' and placed in /etc/init.d. Links to this script should be made in the proper rc?.d directory -- most UNIX systems boot to run level 3, therefore the links to this script should be in /etc/rc3.d. The links should start with S?? (to start the service) or K?? (to kill, or stop, the service). Examples of possible link names are listed below:
S99oracle
K01oracle
Normally one would locate the oracle service as one of the last services to start and one of the first services to stop, hence the S99 (probably the last 'S' entry in the rc3.d directory) and the K01 (one of the first 'K' entries in rc3.d). These links are symbolic links, or symlinks as the terminology goes. If you are not familiar with creating such links the syntax is:
ln -s /etc/init.d/oracle /etc/rc3.d/S99oracle ln -s /etc/init.d/oracle /etc/rc3.d/K01oracle
Presuming the system only uses run level 3 or is shut down these are the only two links you need. Once the system leaves run level 3 (presumably by executing a shutdown) the Oracle services are stopped and no longer available. Once the system enters run level 3 the Oracle services are started (both the database and the listener) and, barring any errors, the database and listener are ready for users.
If you have any trouble getting this set up please feel free to email me at oratune_at_aol.com or davidf_at_bcgsystems.com.
-- David Fitzjarrell Oracle Certified DBA Sent via Deja.com http://www.deja.com/ Before you buy.Received on Thu Nov 30 2000 - 10:34:34 CST
![]() |
![]() |