Operating System - HP-UX
1748213 Members
3066 Online
108759 Solutions
New Discussion юеВ

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

 
Miguel Silva Rentes
Regular Advisor

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

Hi Rustam,

Here's the script without those ugly characters (I did a copy-paste from a Word document and that's why it got like that... sorry!):

#!/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
Steven E. Protter
Exalted Contributor

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

Shalom,

There are a hundred different ways to get this done.

#!/sbin/sh
# Description: Start-up script for Oracle DB's and Apps
# Format: oracle start_msg | stop_msg | start | stop
# Exit values: 0 = success; causes "OK" to show up in checklist.
# 1 = failure; causes "FAIL" to show up in checklist.
# 2 = skip; causes "N/A" to show up in checklist.
# Input and output:
# stdin is redirected from /dev/null
# stdout and stderr are redirected to the /etc/rc.log file
# during checklist mode, or to the console in raw mode.

# -------------------------------------------------------------
# Initialize
# -------------------------------------------------------------
Arg=$1
Desc='Oracle Database and Apps '
PATH=/sbin:/usr/sbin:/usr/bin

# -------------------------------------------------------------
# Process argument
# -------------------------------------------------------------
case $Arg in
'start_msg')
echo "Starting the $Desc";;
'stop_msg')
echo "Stopping the $Desc";;
'start')
if [ -f /etc/rc.config.d/oracle ]
then
. /etc/rc.config.d/oracle
else
echo "ERROR: /etc/rc.config.d/oracle file MISSING"
fi

if [ "$ORA_START" -eq 1 ]
then
/u01/app/oracle/local/scripts/start_ora_dana ALL
else
exit 2
fi # end if ORA_START=0 in /etc/rc.config.d/oracle
;;
'stop')
if [ -f /etc/rc.config.d/oracle ]
then
. /etc/rc.config.d/oracle
else
echo "ERROR: /etc/rc.config.d/oracle file MISSING"
fi

if [ "$ORA_STOP" -eq 1 ]
then
# /u01/app/oracle/local/scripts/stop_ora_dana ALL
#
/u01/app/oracle/local/scripts/stop_ora_all.sh
else
exit 2
fi # end if ORA_STOP=0 in /etc/rc.config.d/oracle
;;
*)
echo "usage: $0 {start|stop|start_msg|stop_msg|signal}" 1>&2
exit 1
;;
esac

exit 0



# This is classic HP-UX, using control files in /etc/rc.config.d

It works on all supported versions of Oracle Database server and apparently (I did not write this) Oracle apps.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
rustam_2
Super Advisor

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

Once again - THANKS, Miguel Rentes.

SEP, thanks.

>>># This is classic HP-UX, using control files in /etc/rc.config.d

It works on all supported versions of Oracle Database server and apparently (I did not write this) Oracle apps.

You suggest another script moreover to put this one in other catalog /etc/rc.config.d. Could\would you explain me different between action? Now i'm thinking which action to do.

Regards,
Rustam
rustam_2
Super Advisor

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

Hi Miguel,
I did all steps but it doesnt work. Oracles doesnt start.
I want to manually run the link S900oracle but get error:
$ ./S990oracle start
-bash: ./S990oracle: Permission denied

though link permission has execute option
$ ls -al S990oracle
lrwxr-xr-x 1 root sys 19 May 28 12:18 S990oracle -> /sbin/init.d/oracle

what do you think but i did wrong?

Regards,
Rustam
rustam_2
Super Advisor

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

Sorry, i found my mistake.
I had to run from root not from my oratst. Moreover i forget to change user oracle to my user oratst. Now database startup and shutdown but listener cant start and stop. I can connect to DB local but not remotely :(.

I checked log file and found this:
/sbin/rc3.d/S990oracle: starting up
Fri May 28 14:33:41 WSTDST 2010
starting Oracle Net listener
starting Oracle databases
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /u01/app/oracle/product/10.2.0/db_1/bin/dbstart ORACLE_HOME
Processing Database instance "prod": log file /u01/app/oracle/product/10.2.0/db_1/startup.log

# su - oratst -c 'export'
doesnt show ORACLE_HOME environment. Should i add something in my script to set ORACLE_HOME for listener?



Miguel Silva Rentes
Regular Advisor

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

Hi Rustam,

I believe you user oratst should have environment variables ORACLE_HOME, ORACLE_BASE and ORACLE_SID set.

Set these variables on user oratst's environment (through .login or .cshrc, see your environment please) and try again.

Tell me if that worked.

Regards,

Miguel Rentes
rustam_2
Super Advisor

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

Hi Miguel Rentes,
definitly oratest has these environments, i checked again with $ evn and $export both showed list of environments where were these environments.
But when i type from root user:
# su - oratst -c 'export'
i didnt see ORACLE_HOME environments.

Then i did like this:
# vi reboot_lsn
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export PATH=${PATH}:${ORACLE_HOME}/bin
$ORACLE_HOME/bin/lsnrctl start >> LOG

and saved this file in oratst's home
then run
#su - oratst ./reboot_lsn
it started my LISTENER after that i changed 3 values in this script to
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export PATH=${PATH}:${ORACLE_HOME}/bin
$ORACLE_HOME/bin/lsnrctl start PROD>> LOG

run once again and my listener PROD started.

Now i'm thinking how to change your script. Your didnt statr even default LISTENER.

Regards,
Rustam
rustam_2
Super Advisor

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

I guess, the problem is to starting listener and not in the script's structure.
How can i start any software or service(in my situation lsnrctl) by root during starting up OS except this command:?

su - oracle -c "/u01/app/oracle/product/10.2.0/db_1/bin/lsnrctl start PROD >> LOG"

or

su - oracle -c "$ORACLE_HOME/bin/lsnrctl start PROD >> LOG"

First i want to get this tip through the CLI if will be ok then will put in the script.

Regards,
Rustam
rustam_2
Super Advisor

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

I found, i run this command
su - oracle -c "$ORACLE_HOME/bin/lsnrctl start PROD >> LOG"
withou '-' before user_name, like this

su oracle -c "$ORACLE_HOME/bin/lsnrctl start PROD >> LOG"

and listner PROD is started.

But this script doest work on another server, on my standby server. OS, and softwares are the same. I checked environments in both servers. And determined that shell is different. Could it be thge reason? Where this script runs\works shell is bash (SHELL=/usr/local/bin/bash) and where doesnt work shell is bash also (SHELL=/bin/bash) but runs from other directory. Or cant be the reason of the problem?

Regards,
Rustam
)