Operating System - HP-UX
1748142 Members
3748 Online
108758 Solutions
New Discussion юеВ

Needs scripts to start oracle 9i

 
SOLVED
Go to solution
Deanna Tran
Frequent Advisor

Needs scripts to start oracle 9i

I have successfully install oracle 9i database
on HP 11i. Currently, i do not have any script to test this database. If it is possible would you show me some sample of them?...
8 REPLIES 8
Michael Tully
Honored Contributor
Solution

Re: Needs scripts to start oracle 9i

Hi,

Try this one:

#!/sbin/sh
#
# Args:
# start : start Oracle
# stop : stop Oracle
#
# Return Values:
# 0 : successfull completion of task
# 1 : failure to complete task

# NOTE: If your script executes in run state 0 or state 1, then /usr might
# not be available. Do not attempt to access commands or files in
# /usr unless your script executes in run state 2 or greater. Other
# file systems typically not mounted until run state 2 include /var
# and /opt.

rval=0

# Check the exit value of a command run by this script. If non-zero, the
# exit code is echoed to the log file and the return value of this script
# is set to indicate failure.

set_return() {
x=$?
if [ $x -ne 0 ]; then
echo "EXIT CODE: $x"
rval=1 # script FAILed
fi
}

case "$1" in
'start_msg')
# Emit a _short_ message relating to running this script with
# the "start" argument; this message appears as part of the checklist.
echo "Starting Oracle"
;;
'stop_msg')
# Emit a _short_ message relating to running this script with
# the "stop" argument; this message appears as part of the checklist.
echo "Stopping Oracle"
;;
'start')
echo "Start Oracle"
/usr/bin/su - oracle -c "dbstart"
/usr/bin/su - oracle -c "lsnrctl start LISTENER"
set_return
;;
'stop')
echo "Stop Oracle"
/usr/bin/su - oracle -c "lsnrctl stop LISTENER"
/usr/bin/su - oracle -c "dbshut"
set_return
;;
*)
echo "usage: $0 {start|stop}"
rval=1
;;
esac

exit $rval

If you wish to have it enabled for automatic startup of the system you can use the above script in /sbin/init.d/oracle and then create symbolic links like below:

Start:
ln -s /sbin/init.d/oracle /sbin/rc3.d/S900oracle

Stop:
ln -s /sbin/init.d/oracle /sbin/rc2.d/K900oracle

HTH
-Michael
Anyone for a Mutiny ?
Ravi_8
Honored Contributor

Re: Needs scripts to start oracle 9i

hi,

Oracle does NOT create a boot-time auto-start script. edit /etc/oratab and change 'N' to 'Y' for the database you want to autostart. Then create the following file as /sbin/init.d/oracle

#!/sbin/sh
#Match ORACLE_HOME with whatever is in oracle/.profile

case $1 in
start)
su - oracle -c $ORACLE_HOME/bin/dbstart

su - oracle -c "$ORACLE_HOME/bin/lsnrctl start"

exit 0
;;

stop)
su - oracle -c "$ORACLE_HOME/bin/lsnrctl stop"
su - oracle -c $ORACLE_HOME/bin/dbshut
;;
esac


#cd /sbin/init.d
ln -s ../init.d/oracle /etc/rc2.d/S95oracle
ln -s ../init.d/oracle /etc/rc2.d/K15oracle
chmod 0755 /etc/init.d/oracle


never give up
Andreas D. Skjervold
Honored Contributor

Re: Needs scripts to start oracle 9i

Hi

Your quiestion is not quite clear. If you have installed the ORacle9i Software and want to CREATE a database, you'll have to issue the create database statements ++++

Have attached a script that creates directories for datafiles etc and creates a database and runs necessary scripts.

Andreas
Only by ignoring what everyone think is important, can you be aware of what everyone ignores!
Deanna Tran
Frequent Advisor

Re: Needs scripts to start oracle 9i

Hi Andreas,

Thank you for the scripts. I haven't start to use it yet but I do have several questions in reagards to it?
1. What steps prior to it do I need to know?
create vg? logical volumes?
2. This script will be executed from which user? root or oracle?
3. Do I need to edit any file before issued this script to run?

Database is not my expertise, and please be patient with me. Thank you very much for your time.
Deanna Tran
Frequent Advisor

Re: Needs scripts to start oracle 9i

I can't seemt to create the file that you have suggested...
i cd to /etc
and try to find init.d : i could't find it
so i did vi /etc/init.d/oracle
at the end....
error message : can't find the file when i try to do wq!
can you help me???

ps....i can't seem to located /etc/init.d directory in root??
Deanna Tran
Frequent Advisor

Re: Needs scripts to start oracle 9i

Hi ravi,

This command does not seem to work
#cd /sbin/init.d
ln -s ../init.d/oracle /etc/rc2.d/S95oracle
ln -s ../init.d/oracle /etc/rc2.d/K15oracle
chmod 0755 /etc/init.d/oracle

here is the error message
ls -s ../init.d/oracle /etc/rc2.d/S99oracle
/etc/rc2.d/S99oracle not found
2 ../init.d/oracle
Deanna Tran
Frequent Advisor

Re: Needs scripts to start oracle 9i

Please ignore the message inregards to the
create symbolic link...
I did not give the rite path of symbolic link...silly me...
thank you
Deanna Tran
Frequent Advisor

Re: Needs scripts to start oracle 9i

Hi ,
Here is what i have done so far :
1. installation of HP - oracle 9i
2. create /sbin/init.d/oracle and symbolic to start up the database...

AT this point, I am lost of what should I do next? the documentation that I got just confuse me very much? Can some1 help me on the next step? so i can get the database running and run some simple I/O to those mount points?
I 'm greatly appreciate all of your help...

Deanna