Operating System - HP-UX
1752793 Members
6134 Online
108789 Solutions
New Discussion юеВ

script start-up for Oracle in the boot

 
SOLVED
Go to solution
Alejandro_30
Frequent Advisor

script start-up for Oracle in the boot

I have oracle 9.2.0.1.0,HPUX 11.11 ,OVO 8.1 and Service Desk 4.5

I need a script for start instance-database (oracle) for Service desk.

How can do that ??
4 REPLIES 4
Steven E. Protter
Exalted Contributor

Re: script start-up for Oracle in the boot

cd /sbin/init.d

cp template oracle

Edit the oracle script to do su - oracle -c "command to start up oracle"

make sure /sbin/init.d oracle script can be executed by root.

cd /sbin/rc3.d
ln -s /sbin/init.d/oracle S900oracle
cd /sbin/rc2.d
ln -s /sbin/init.d/oracle K100oracle

You will need a valid /etc/oratab file. This file should be read to see what instances should be started.

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
Alejandro_30
Frequent Advisor

Re: script start-up for Oracle in the boot

Edit the oracle script to do su - oracle -c "command to start up oracle"

I need put "su - oracle -c command to start up oracle" in the file oracle.

Where part the file oracle I need put
su - oracle -c command to start up oracle


cd /sbin/rc3.d
ln -s /sbin/init.d/oracle S900oracle
cd /sbin/rc2.d
ln -s /sbin/init.d/oracle K100oracle

and

How can do that for shutdown?

Steven E. Protter
Exalted Contributor
Solution

Re: script start-up for Oracle in the boot

If you look at the template script you will see a start section and a stop section.

The softlink starting with a K will execute the shutdown.

I had a lot of problems with the stock oracle shutdown script hanging on shutdown, causing long, sometimes interminable shutdowns of my oracle servers.

So I re-wrote the process.

In the /sbin/init.d/oracle script stop section.

/usr/bin/su - oracle -c "/usr/contrib/bin/shut.oracle"


The core of shut.oracle

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

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


esac

done


Sorry for what the forums do to my nicely indented code.

#!/sbin/sh

ORACLE_SID=$1
. /usr/contrib/bin/setOraProfile


sqlplus internal << EOFTOP1
select * from v\$database;
shutdown immediate;
exit;
EOFTOP1


exit;



SetOraProfile gets replaced with whatever script or source set you use to set proper oracle environment variables.

SEP
http://www.isnamerica.com/contactsep.shtml
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
Sandman!
Honored Contributor

Re: script start-up for Oracle in the boot

Alejandro,

If you'ave a valid oratab file in the /var/opt/oracle directory and the ORACLE_HOME variable is defined and exported, use the attached script and follow the steps below:

1. Install the script in the /sbin/init.d directory, name it oracle.

2. make symbolic links to the 2 and 3 run-levels for stopping and starting oracle respectively like...

ln -s /sbin/init.d/oracle /sbin/rc3.d/S900oracle
ln -s /sbin/init.d/oracle /sbin/rc2.d/K100oracle