Operating System - HP-UX
1824983 Members
3679 Online
109678 Solutions
New Discussion юеВ

Re: Init scripts for Oracle startup/shutdown on reboot

 
SOLVED
Go to solution
pc123_1
Frequent Advisor

Init scripts for Oracle startup/shutdown on reboot

Hi.
I need to configure Oracle for automatic startup/shutdown on reboot (hp-ux 11.0).

The oracle doc gives the following guidelines:

1. In the /etc/init.d directory, create a dbora script similar to the following, if it does not already exist.

-- There isn't init.d directory in /etc

2. Create symbolic links to the dbora script in the appropriate run-level script directories, as follows:

# ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
# ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora

Again, there are no rc0.d and rc3.d directories.

What do I have to do? Create them, or there are other files for hp-ux 11.0. I'm not sysadmin, so questions might seem too simple for most of you.
12 REPLIES 12
U.SivaKumar_2
Honored Contributor

Re: Init scripts for Oracle startup/shutdown on reboot

Hi,
In HP-UX , you have init.d under /sbin/init.d
you need not create symbolic links as rc*.d
directories are under /sbin itself.

There is one more file /etc/oratab which controls the startup of oracle instance at bootup.
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third field indicates
# to the dbstart utility that the database should, "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
example entry:-

D01:/oracle/D01:Y

will allow the oracle instance to be brought up at system bootup.

regards,
U.SivaKumar

Innovations are made when conventions are broken
pc123_1
Frequent Advisor

Re: Init scripts for Oracle startup/shutdown on reboot

Hi,
Thank you for replying.
Is there any meaning in numbers rc3.d? Does 3 mean anything? Are all rcYYY links executing on reboot?
U.SivaKumar_2
Honored Contributor

Re: Init scripts for Oracle startup/shutdown on reboot

Hi,
Yes , there is a meaning for rc2.d , rc0.d etc
rc2.d means the directory which contains scripts which will be executed in run-level 2 and so on.
S99dbora means S-start script 99-unique number
K10dbora means K-kill (stop) script 10-unique number

regards,
U.SivaKumar
Innovations are made when conventions are broken
Ravi_8
Honored Contributor

Re: Init scripts for Oracle startup/shutdown on reboot


Hi,
I hope that you are referring to oracle on solaris. In HP it's like this.

Make sure the entry for your database SID in the /etc/oratab file ends in a capital "Y".

ORCL:/u01/app/oracle/product/8.0.5:Y


The scripts for starting and stopping databases are: $ORACLE_HOME/bin/dbstart and dbshut. Net8 is started with the lsnrctl command. Add the following entries to your /etc/rc2.d/S99dbstart (or equivalent) file:

su - oracle -c "/path to/$ORACLE_HOME/bin/dbstart" # Start DB's
su - oracle -c "/path to/$ORACLE_HOME/bin/lsnrctl start" # Start listener
su - oracle -c "/path to/$ORACLE_HOME/bin/namesctl start" # Start OraNames (optional)

never give up
pc123_1
Frequent Advisor

Re: Init scripts for Oracle startup/shutdown on reboot

Hi.
I've done all the step, however oracle fails to start.

I started it manualy from prompt
$ORACLE_HOME/bin/dbstart
however i get error message

Cannot find init file for database DBNAME.

The pfile is in the correct $ORACLE_BASE/admin/dbname folder.
Ravi_8
Honored Contributor
Solution

Re: Init scripts for Oracle startup/shutdown on reboot

Hi,


login as oracle
$cd $ORACLE_HOME/dbs

If u have created a instance by name 'x' there should be a file by name 'initx.ora'. Since you are getting error as .ora file doesn't exist,
$cp init.ora initx.ora
$vi initx.ora
change the db_name to instance name
(in this case: db_name=x)
save and close the file
$ cd
$ dbstart
Now the instance 'x' must start.



never give up
pc123_1
Frequent Advisor

Re: Init scripts for Oracle startup/shutdown on reboot

Thank you very much!
Now it is starting ok.
Yogeeraj_1
Honored Contributor

Re: Init scripts for Oracle startup/shutdown on reboot

 
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
pc123_1
Frequent Advisor

Re: Init scripts for Oracle startup/shutdown on reboot

Thank you very much for your response.
Is there an example oracle startup script that would solve the above mention issues. The oracle script that comes with docs, as you pointed out in your post, doesn't work, and hangs.
Yogeeraj_1
Honored Contributor

Re: Init scripts for Oracle startup/shutdown on reboot

hello,

this is how i do it!

1. in /sbin/init.d
file oracle
(see attachment)

2. Create links to look as below:
yd: /sbin>ll rc*/*oracle*
lrwxr-xr-x 1 root sys 19 Dec 16 2001 rc1.d/K100oracle -> /sbin/init.d/oracle
lrwxr-xr-x 1 root sys 19 Dec 16 2001 rc2.d/S900oracle -> /sbin/init.d/oracle


3. Config file
yd: /etc/rc.config.d>more oracle
#YD/CMT-16/12/2001
# ORACLE DATABASE configuration
#
# ORACLE_START_STOP : Set to 1 to start ORACLE DATABASE
#
ORACLE_START_STOP=1
yd: /etc/rc.config.d>


Hope this helps!

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

Re: Init scripts for Oracle startup/shutdown on reboot

Thank you!
I will try your script and update you on the results.
Steven E. Protter
Exalted Contributor

Re: Init scripts for Oracle startup/shutdown on reboot

You might find this utility useful as well.

It determines your first /etc/oratab database marked Y(auto start), you need to have /etc/oratab set up with a Y flag or the standard dbstart script won't start anything.

This guy if run . /usr/contrib/bin/oracle.default

It will set an very useful environment variable. Name it what you want by changing the script, but it is very useful so your backup and startup scripts know what the boxes primary database is. If you have a primary databse. Most useful on our prod box, which we switch instances every time we put a new deliverable into production. This methodoloy aids in testing.

code of oracle.default

#!/usr/bin/sh

# oracle.info A script to get oracle instance and other information
# from the first entry on the /etc/oratab file
#
# Created: Shmuel Y. Protter
# 05-29-2002
# Modifications
# FML MM-DD-YYYY Description of the changes ......
#
#
#



# if [ "$LOGNAME" = "oracle" ]
# then
# oktorun="Y"
# echo "User oracle detected"
# fi

# if [ "$LOGNAME" = "oraoper" ]
# then
# oktorun="Y"
# echo "User oraoper detected"
# fi

# if [ "$oktorun" = "Y" ]
# then
# echo "user is authorized...$LOGNAME"
# else
# echo "user must be oracle or oraoper: $LOGNAME"
# exit 1
# fi

SetOptions=$-
set +u

export ORATAB=/etc/oratab; [ -f $ORATAB ] ||
export ORATAB=/var/opt/oracle/oratab


sidfile=/utmp/sids.file

# awk -F: '/^[^#*]+:/ {print $1 " " $3}' $ORATAB > $sidfile
# awk -F: '/^[^#*]+:/ {print $1}' $ORATAB > $sidfile

inum=1

cat $ORATAB | while read LINE
do
case $LINE in
\#*) ;;#comment-line in oratab
*)

if [ "`echo $LINE | awk -F: '/^[^#*]+:/ {print $3}' -`" = "Y" ] ; then
if [ $inum -eq 1 ]
then
ORA_INSTANCE=`echo $LINE | awk -F: '{print $1}' -`
ORA_HOME=`echo $LINE | awk -F: '{print $2}' -`
# echo "checking oracle sid: $ORA_INSTANCE "
# echo "checking oracle hme: $ORA_HOME "
export ORA_INSTANCE
export ORA_HOME
fi
# /usr/contrib/bin/shutsid.sh $ORACLE_SID
((inum = inum + 1 ))
fi


esac

done
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