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

Auto startup\shutdown oracle instance

SOLVED
Go to solution
rustam_2
Super Advisor

Auto startup\shutdown oracle instance

Hi all,
i want to configure automated startup\shutdown instance of DB Oracle.

I read several articles but still i'm in doubts and dont know what to do exactly.
In this thread http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1213678 few scripts which one is ok? I found another one(attached). Part of article which i read:

-------
HP-UX Version 10.x:
Relevant Files
/sbin/init.d/oracle
-- contains the main script for doing db startup and shutdown owned by root

/etc/rc.config.d/oracle
-- this file enables/disables automatic startup and shutdown of the databases owned by root

/sbin/rc1.d/K100oracle ->/sbin/init.d/oracle
-- this link tells the system when to execute the Oracle script with the 'stop' command in single user mode during system shutdown

/sbin/rc2.d/S990oracle ->/sbin/init.d/oracle
-- this link tells the system when to execute the Oracle script with the 'start' command in multi-user mode during system startup

All references to in this section should be replaced by the
userid of the Oracle installation owner, and all references to <$ORACLE_HOME> should be replaced by the path to which $ORACLE_HOME points.

o Create an executable script /sbin/init.d/oracle for the startup and shutdown of Oracle

Your script should attempt to start the database with the following
command:

su - -c <$ORACLE_HOME>/bin/dbstart

Your script should attempt to shut the database with the following
command:

su - -c <$ORACLE_HOME>/bin/dbshut

Make sure that the script is owned and executable only by the super user.

For an example of the complete script, refer to page 6-12 of the 7.2.2 Installation and Configuration Guide for HP 9000 series.

o Create the file /etc/rc.config.d/oracle

This file should contain:

ORACLE_START=1
export ORACLE_START

o Edit /etc/oratab

ORACLE_SID:ORACLE_HOME:Y|N
where Y or N indicates whether you want the dbstart and dbshut scripts to be run

o Make /sbin/rc1.d/K100oracle a symbolic link to /sbin/init.d/oracle

o Make /sbin/rc2.d/S990oracle a symbolic link to /sbin/init.d/oracle


So, my HP-UX is 11iv3 and i think steps which i have to do on my OS 11iv3 a lil bit different then steps on OS 10.x . Also i found here specific topic for myself http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1213678

Tim wrote there:
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

Look,
1. It's ok, i dont have /sbin/init.d/oracle but i have /sbin/init.d/template. I should copy and rename to oracle.
2. Should i add just 2 strings?:
su - -c <$ORACLE_HOME>/bin/dbstart
su - -c <$ORACLE_HOME>/bin/dbshut

and nothing much? How about script which i've attached and or you suggest below?
3. what is control variables? are they - ORACLE_HOME and ORACLE_SID in env?
4. Ok, i will create
etc/rc.config.d/oracle
ORACLE_START=1
export ORACLE_START
5-6. I dont have /sbin/init.d/oracle S900oracle and K100oracle. Should i create S900oracle and K100oracle or...?

All advices and suggestion will be appreciate.

Regards,
rustam
3 REPLIES
R.O.
Esteemed Contributor
Solution

Re: Auto startup\shutdown oracle instance

Hi,

You should copy the template file to "/sbin/init.d/oracle" and add your start/stop messages and your start/stop commands here: (modify "$CONTROL_VARIABLE" = ORACLE_START)

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 the subsystem"
;;

'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 the subsystem"
;;

'start')

# source the system configuration variables
if [ -f /etc/rc.config ] ; then
. /etc/rc.config
else
echo "ERROR: /etc/rc.config defaults file MISSING"
fi

# Check to see if this script is allowed to run...
if [ "$CONTROL_VARIABLE" != 1 ]; then
rval=2
else

# Execute the commands to start your subsystem
:
fi
;;

'stop')
# source the system configuration variables
if [ -f /etc/rc.config ] ; then
. /etc/rc.config
else
echo "ERROR: /etc/rc.config defaults file MISSING"
fi

# Check to see if this script is allowed to run...
if [ "$CONTROL_VARIABLE" != 1 ]; then
rval=2
else
:
# Execute the commands to stop your subsystem

fi
;;


Then, create the config file in "/etc/rc.config.d/oracle" and put "ORACLE_START=1". Lastly, create the start link under "/sbin/rc3.d" and the stop link under "/sbin/rc2.d", both of them pointing to "/sbin/init.d/oracle".

Look for other startup files in your system to compare.

Regards,
"When you look into an abyss, the abyss also looks into you"
rustam_2
Super Advisor

Re: Auto startup\shutdown oracle instance

Hi R.O.,
I copied /sbin/init.d/template as /sbin/init.d/oracle. Checked this file and there a lot template strings. Should I change value of those strings? Should I replace with script which attached?

what do you mean below?
>>>> your start/stop commands here: (modify "$CONTROL_VARIABLE" = ORACLE_START)


I listed your script. For what should I use this one? Here is no words about ORACLE_SID or listener.

I think to create config file with ORACLE_START value will not be big problem, anywhere thanks that you mentioned it.
I have never create links, could you give me example?

>>>>Look for other startup files in your system to compare.
I looked several files in /sbin/init.d and /sbin/init.d/rcN.d and found out that /sbin/init.d/oracle, /sbin/rc3.d/S900oracle, /sbin/rc2.d/K100oracle must have the same script, right?


Regards,
rustam
R.O.
Esteemed Contributor

Re: Auto startup\shutdown oracle instance

Hi,

The "$CONTROL_VARIABLE" is checked in /etc/rc.config.d/oracle" file. If you put there as "ORACLE_START=1" oracle will be started at boot time. You also have to replace "$CONTROL_VARIABLE" by "ORACLE_START" in "/sbin/init.d/oracle".

"I listed your script. For what should I use this one? Here is no words about ORACLE_SID or listener."

This is a template file and must be copied and customized to be used. You can use it or use another one, it is just a template to save time, but as said, you have to put your variables there.


"I have never create links, could you give me example?"

ln -s i.e. ln -s /etc/rc.config.d/oracle /sbin/rc3.d/S900oracle


"I looked several files in /sbin/init.d and /sbin/init.d/rcN.d and found out that /sbin/init.d/oracle, /sbin/rc3.d/S900oracle, /sbin/rc2.d/K100oracle must have the same script, right?"

/sbin/rc3.d/S900oracle and /sbin/rc2.d/K100oracle must point to /sbin/init.d/oracle

ln -s /etc/rc.config.d/oracle /sbin/rc3.d/S900oracle
ln -s /etc/rc.config.d/oracle /sbin/rc2.d/K100oracle

Regards,
"When you look into an abyss, the abyss also looks into you"