8 replies
by cpfeiffe
You first must put the script in /etc/init.d. You could call it oracle. Then you need to create links (ln -s) from /etc/rc2.d or /etc/rc3.d to call it. 2 is multiuser mode, non-sharing and 3 is multiuser mode with sharing. The usual recommendation is 3, but people put it in both. You can call it S##oracle. The S scripts in each run level (2 or 3) will start in numerical order. If you include it in rc2.d you must use a number of at least 72 after the S so all of your network services are started first. If you are running Oracle on a cache file system you must give it at least a 94 if you put it in rc2.d Whatever you number the script, subtract the number from 100 and use that number to creata a K##oracle link in both the directory you put the S script and one numberical level below it (if you put the S script in rc2 you need the K script in rc2 and rc1). You should also put the K link in /etc/rcS.d Assuming oracle is the user account for the owner of the database, here is a simple script structure
case "$1" in
'start')
su - oracle -c dbstart
;;
'stop')
su - oracle -c dbshut
;;
*)
echo usage "oracle {start|stop}"
;;
esac
exit 0
You can add to this if you'd like to trap certain errors and set paths, but this should be enough to get you started.
by cpfeiffe
I made a couple of mistakes an referred to S##oracle and K##oracle as scripts in a few places. They should always be links back to /etc/init.d/oracle. You would only edit /etc/init.d/oracle. Also, I should have told you to start the script with the line
#!/sbin/sh
so you are always certain it runs in bourne shell.
I hope this helped. Good luck.
by rishikumar73
The previous answer is correct but you may get into difficulties as the listener doesn't start. Your applications cannot connect to the DB without the listener.
The following is the script I use
#!/bin/sh
ORACLE_HOME=/opt/oracle/product/8.1.6ORA_OWNER=oracle
if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
su - $ORA_OWNER -c $ORACLE_HOME/bin/dbstart & # start databases
su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start" # start listener
su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl dbsnmp_start" # start intelligent agent
;;
'stop')
su - $ORA_OWNER -c $ORACLE_HOME/bin/dbshut # shutdown database
su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl dbsnmp_stop" # stop intelligent agent
su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop" # stop listener
;;
esac
Cheers
Peter
by rishikumar73
by bgjkl
The answers I have seen will work, however they are more complex than you need.
1) Edit the /etc/oratab file....add the name of the database and a Y for yes to start at boot, or an N not to (you may have more than 1 database, and not want one tostart at boot)
ORA1:Y will set database ORA1 to start with the dbstart script.
2) Edit /etc/init.conf, /etc/inittab (depending on UNIX flavor) and add
3:wait:LISTEN /oracle/SID/bin/lsnrctl start
3:wait:ORACLE /oracle/SID/bin/dbstart
(please note that the syntax of the init file are different with different flavors of UNIX.....use what is in yours as a guide for exact syntax)
This will start the listener first, than any databases that are marked Y in the /etc/oratab file.
by rishikumar73
by rishikumar73
This discussion is closed to new replies.
Trending Linux posts
Sort by Trending