General
cancel
Showing results for 
Search instead for 
Did you mean: 

Oracle 10g automated startup/shutdown HP-UX 11.23

 
Miguel Silva Rentes
Regular Advisor

Oracle 10g automated startup/shutdown HP-UX 11.23

Hi everyone!

I'm trying to make an automated procedure to startup/shutdown oracle at reboot time in a HP-UX 11.23 server. I've followed the steps explained in Oracle's Metalink "How to Start Database And Listener at System Reboot on Unix Systems" but its written for Oracle 9i server. And I have Oracle 10g. :p . I've done all the steps described there but as I hoped, it doesn't work.

Does anybody have a script to make this work?

10 Points will be given for the correct scripts =)

Thanks in advance,

Miguel Rentes
18 REPLIES 18
Tim Nelson
Honored Contributor

Re: Oracle 10g automated startup/shutdown HP-UX 11.23

dbstart and dbshut should be included in the bin directory of oracle home.

put them in your startup template file.

1)cp /sbin/init.d/template /sbin/init.d/oracle
2) edit /sbin/init.d/oracle startup and shutdown sections with su - oracle -c "$ORACLE_HOME/bin/dbstart or dbshut.
3) modify CONTROL_VARIABLE to ORACLE.
4)create /etc/rc.config.d/oracle and edit ORACLE=1
5) in /sbin/rc3.d. ln -s /sbin/init.d/oracle S900oracle
6) in /sbin/rc2.d. ln -s /sbin/init.d/oracle K900oracle

Test it out.

Yogeeraj_1
Honored Contributor

Re: Oracle 10g automated startup/shutdown HP-UX 11.23

hi Miguel,

You can also follow the instructions in the document found in the URL below:

http://docs.hp.com/en/934/startup.pdf

though generic, you can configure your oracle database to start using the same principles.

if you need any further assistance, please let us know.

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
patrik rybar_1
Frequent Advisor

Re: Oracle 10g automated startup/shutdown HP-UX 11.23

here is my which i'm using long time

(just uncomment and set your lines in the dbstart for listener starting and stopping)

#!/bin/sh
PATH=/usr/sbin:/usr/bin:/sbin
export PATH
export oraowner=YOUR_ORA_OWNER
export ORACLE_HOME=YOUR_ORACLE_HOME
#
set -x
rval=0
case "$1" in
'start_msg')
echo "Starting Oracle Databases"
;;
'stop_msg')
echo "Stopping Oracle Databases"
;;
'start')
su - $oraowner -c "$ORACLE_HOME/bin/dbstart"
rval=0
;;
'stop')
su - $oraowner -c "$ORACLE_HOME/bin/dbshut"
rval=0
;;
*)
echo "Usage \: dbora \"
rval=1
;;
esac;
exit $rval
Aashique
Honored Contributor

Re: Oracle 10g automated startup/shutdown HP-UX 11.23

Hi Silva,
Please check the attached script. Its working on 10g.



Thanks & Regards

Aashique
grahamswilson
Trusted Contributor

Re: Oracle 10g automated startup/shutdown HP-UX 11.23

Hi,

I just went through this problem and here is what I ended up with (attached). It works very well and avoids the "issues" when trying to use "su" to the oracle account...

The only pre-requisite for this version of the script is that root must be able to "ssh" to the oracle account without a password. I'm not sure if you know how to generate the keys to achieve this - if not, let me know. (The original script from Oracle used "remsh" instead of "ssh".)

Hope it helps - I went through a lot to get this working, but it was worth it!
RadeS
Occasional Visitor

Re: Oracle 10g automated startup/shutdown HP-UX 11.23

Hi,

@Graham

"The only pre-requisite for this version of the script is that root must be able to "ssh" to the oracle account without a password. I'm not sure if you know how to generate the keys to achieve this - if not, let me know. (The original script from Oracle used "remsh" instead of "ssh".)"

Can you please provide the steps how to create these keys?

Thanks,

Rade
Miguel Silva Rentes
Regular Advisor

Re: Oracle 10g automated startup/shutdown HP-UX 11.23

Hi Rustam,

Here's what I did to make this work.

1) Log onto the system as root. Edit the file /etc/oratab. Add a line for any Oracle SID you want to start after a system reboot:

:/oracle/oraHome1:Y

2) Create a script named oracle under /sbin/init.d and add the following contents:

#!/bin/sh

#installation
ORACLE_HOME=/oracle/oraHome1
PATH=${PATH}:$ORACLE_HOME/bin:/usr/bin
HOST=`hostname`

#change the value of ORACLE to the login name of the oracle owner
ORACLE=oracle

export ORACLE_HOME PATH

LOG=$ORACLE_HOME/startup.log
rm -f $LOG
touch $LOG
chmod 666 $LOG
chown oracle:users $LOG

# When HP-UX starts/stops
case $1 in
'start')
echo "$0: starting up" >> $LOG
date >> $LOG
# Start Oracle Net
echo "starting Oracle Net listener" >> $LOG
echo "starting Oracle databases" >> $LOG
su - oracle -c â $ORACLE_HOME/bin/dbstart >> $LOGâ
su - oracle -c "$ORACLE_HOME/bin/lsnrctl start >> $LOG"
;;
'stop')
echo "$0: shutting down" >> $LOG
date >> $LOG
# Stop Oracle Net
echo "stopping Oracle Net listener" >> $LOG
echo â stopping Oracle databasesâ >> $LOG
su â oracle â c â $ORACLE_HOME/bin/dbshut >> $LOGâ
su - oracle -c â $ORACLE_HOME/bin/lsnrctl stop >> $LOGâ

;;
*)
echo " Starting Automated Oracle startup"
exit
;;
esac
#
exit

3) Change this script's permissions and owner:

chmod 750 /sbin/init.d/oracle
chown bin:bin /sbin/init.d/oracle

4) Create the following links:

ln -s /sbin/init.d/oracle /sbin/rc3.d/S99oracle
ln -s /sbin/init.d/oracle /sbin/rc0.d/K01oracle

5) Logout as root. At the next system reboot you will have the instance specified above automatically started.

Hope this procedure helps =)

Best regards,

Miguel Rentes
rariasn
Honored Contributor

Re: Oracle 10g automated startup/shutdown HP-UX 11.23

rustam_2
Super Advisor

Re: Oracle 10g automated startup/shutdown HP-UX 11.23

Thanks a lot, Miguel Rentes that explained me every steps by detail. I just need to test them.
Listen, if you noticed script which you type has some strange symbols, i mean i dont know which letters are there. Would you attach script in text file?

Best regards,
rustam

P.S. I'm gonna do it tomorrow morning when i will be at work.