LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-18-2003, 03:41 PM   #1
GAVollink
Member
 
Registered: Apr 2002
Location: Bronx, NY
Distribution: Ubuntu
Posts: 371

Rep: Reputation: 34
init to Start Oracle


Hi,

I couldn't find this anywhere, so I figured I would share (it took me a while to get this right)...

This should work on most RedHat systems, but you WILL need to set ORACLE_SID to an SID that's valid at your location.

I have RedHat Linux 7.3 and Oracle 9i Release 2 (running as the user, "oracle"). Here is the "/etc/rc.d/init.d/oracle" file:

+++++++++++++++++++++++++++++++++++++++++++++++++
#!/bin/sh
##############################################################################
# /etc/rc.d/init.d/oracle
##############################################################################
# chkconfig: - 90 10
# description: Oracle Database, Listener, and isqlplus (Apache)
##############################################################################
LOG=/var/log/oracle

if [ -x /etc/rc.d/init.d/functions ]
then
source /etc/rc.d/init.d/functions
elif [ -x /etc/init.d/functions ]
then
source /etc/init.d/functions
else
exit 1
fi

ORAENV_ASK=NO; export ORAENV_ASK
ORACLE_SID=ORCL; export ORACLE_SID
source oraenv

start() {
date +"*************** INIT ORACLE: %T %a %D" >> $LOG
echo -n "Starting Oracle Databases "
su oracle -c "$ORACLE_HOME/bin/dbstart" >> $LOG 2>/dev/null
ps -ef | grep oracle | grep ora_dbw0 > /dev/null
if [ 0 == $? ]
then
echo_success
else
echo_failure
fi
echo ""
touch /var/lock/subsys/oracle

echo -n "Starting Oracle TNS Listener"
su oracle -c "$ORACLE_HOME/bin/lsnrctl start" >> $LOG 2>/dev/null
if [ 0 == $? ]
then
echo_success
else
echo_failure
fi
echo ""

echo -n "Starting Oracle Apache/isqlplus "
su oracle -c "$ORACLE_HOME/Apache/Apache/bin/apachectl start" >> $LOG 2>/dev/null
if [ 0 == $? ]
then
echo_success
else
echo_failure
fi
echo ""
}

stop() {
date +"*************** STOP ORACLE: %T %a %D" >> $LOG 2>/dev/null
echo -n "Stopping Oracle Apache/isqlplus "
su oracle -c "$ORACLE_HOME/Apache/Apache/bin/apachectl stop" >> $LOG 2>/dev/null
if [ 0 == $? ]
then
echo_success
else
echo_failure
fi
echo ""

echo -n "Stopping Oracle TNS Listener "
su oracle -c "$ORACLE_HOME/bin/lsnrctl stop" >> $LOG 2>/dev/null
if [ 0 == $? ]
then
echo_success
else
echo_failure
fi
echo ""

echo -n "Stopping Oracle Databases "
su oracle -c "$ORACLE_HOME/bin/dbshut" >> $LOG 2>/dev/null
if [ 0 == $? ]
then
echo_success
else
echo_failure
fi
echo ""
rm /var/lock/subsys/oracle
}

case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac

# vim: ts=4 sw=4
# EOF /etc/rc.d/init.d/oracle
+++++++++++++++++++++++++++++++++++++++++++++++++
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Oracle doesn't start. Problem with .profile aronnok Linux - Software 2 01-05-2006 12:27 PM
How to start oracle 10g jakkals Linux - Software 6 07-24-2005 09:28 AM
Oracle 9i Start/Stop scripts vous Linux - Software 0 01-16-2004 01:59 AM
Oracle 9i DVD start problem ravykanth Red Hat 12 11-13-2003 11:26 AM
Oracle Start Up Script linux_pioneer Linux - Software 1 09-16-2003 05:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration