cancel
Showing results for 
Search instead for 
Did you mean: 

startup script

sh5490
Frequent Advisor

startup script

hi
we re using dbora script for starting,stoping
listners and dtbse.
While running under root user it work fine

we want execute this script on server startup
for this we have created soft link under
/sbin/rc1.d & rc2.d like

bash-3.2# pwd

/sbin/rc2.d
bash-3.2# ls -l S99dbora
lrwxr-xr-x 1 root sys 18 Apr 25 23:05 S99dbora -> /sbin/init.d/dbora

bash-3.2# pwd
/sbin/rc1.d
bash-3.2# ls -l K100dbora
lrwxr-xr-x 1 root sys 18 Apr 25 23:04 K100dbora -> /sbin/init.d/dbora

this didn't work?

pls provide some input to resolve the issue

thanks
shabir

66 REPLIES
Ivan Krastev
Honored Contributor

Re: startup script

Common issue for this is missing PATH to the commands.
If you execute the scrips as any user you have a path to used in script binaries.

Use full patch in script - like /usr/bin/ping

or set PATH with appropriate values.


regards,
ivan
MarkSyder
Honored Contributor

Re: startup script

Please provide the output of:

ls -l /sbin/init.d/dbora

You should note that scripts have to be shut down in the reverse order to that in which they are started. To achieve this, you should make sure your K and S numbers add up to 1000.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Patrick Wallek
Honored Contributor

Re: startup script

>>this didn't work?

Well, that's not real helpful. What didn't work? Did you get any error messages? Was anything displayed on the console during the reboot? Did you check the /etc/rc.log file to see if there were any messages there?

Jeeshan
Honored Contributor

Re: startup script

Hi Shabir

Try to put it in rc3.d directory. and restart the server.
a warrior never quits
Yogeeraj_1
Honored Contributor

Re: startup script

hi Shabir,

this seems to be a known issue. Try above run-level 2.

hope this helps!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: startup script

hi again,


please refer to metalink note: 1074016.6 - 'dbora' does not work on Redhat linux.

Solution:
You will need to change the link to run level 3.

From:
ln -s /sbin/init.d/dbora /sbin/rc2.d/S99dbora

To:
ln -s /sbin/init.d/dbora /sbin/rc3.d/S99dbora


Explanation:
Linux uses run level 3 instead of run 2 by default for multi-user access.



hope this helps!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
sh5490
Frequent Advisor

Re: startup script

hi all/yoograj,

We have executed it on rc3.d run level
but it didn't work.

also we are using hp ux 11.23 version

thanks

shabir
Yogeeraj_1
Honored Contributor

Re: startup script

hi Shabir,

Any error messages in the rc.log?

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

Re: startup script

hi yooograj,

there seems no message related dbora stratup

thanks

shabir
Yogeeraj_1
Honored Contributor

Re: startup script

hi,

can you post the rc.log for further verifications?

and also

cd /sbin
ll */*dbora*


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

Re: startup script

hi yograj,
pls find the required info.

we are using soft link for dbora3 script
# pwd
/sbin
# ll */*dbora*
-rwxr-x--- 1 root dba 0 May 8 19:20 init.d/dbora
-rwxrwxrwx 1 root dba 1888 Apr 25 14:09 init.d/dbora1
-rwxrwxrwx 1 root dba 988 Apr 10 17:09 init.d/dbora2
-rwxr-x--- 1 root dba 1041 Apr 25 14:08 init.d/dbora3
-rw-r--r-- 1 root sys 902 Apr 25 14:05 init.d/dborahange
lrwxr-xr-x 1 root sys 18 Apr 25 23:04 rc1.d/K100dbora -> /sbin/init.d/dbora
lrwxrwxr-x 1 root sys 18 May 13 10:35 rc2.d/K100dbora3 -> /sbin/init.d/dbora
-rwxr-x--- 1 bin bin 939 Apr 28 15:07 rc2.d/S99dbora.org
lrwxr-xr-x 1 root sys 18 Apr 25 23:03 rc3.d/K10dbora -> /sbin/init.d/dbora
lrwxrwxr-x 1 root sys 18 May 13 10:35 rc3.d/S99dbora3 -> /sbin/init.d/dbora
lrwxrwxr-x 1 root sys 18 May 13 10:34 r -> /sbin/init.d/dbora

thanks

shabir
Yogeeraj_1
Honored Contributor

Re: startup script

hi Shabir,

> -rwxr-x--- 1 root dba 0 May 8 19:20 init.d/dbora


can you change the permission and ownership as follows:
chown bin:bin /sbin/init.d/oradb
chmod 755 /sbin/init.d/oradb


also post the output of:
cat /etc/rc.config.d/dbora

this should show something like:

SRV2:sbin/init.d>cat /etc/rc.config.d/dbora
# ORACLE DATABASE configuration
#
# ORACLE_START_STOP : Set to 1 to start ORACLE DATABASE
#
ORACLE_START_STOP=1

SRV2:sbin/init.d>


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

Re: startup script

the answers is in your rc.log file

/sbin/rc2.d/S99dbora.org[7]: hostname: not found.
/sbin/rc2.d/S99dbora.org[12]: touch: not found.
starting Oracle Net Listener
/sbin/rc2.d/S99dbora.org[23]: su: not found.
Starting Oracle databases
/sbin/rc2.d/S99dbora.org[26]: su: not found.

PATH ie absolute PATH for those command are not defined in the script so just correct it and it ll works fine
Yogeeraj_1
Honored Contributor

Re: startup script

Fabien GUTIERREZ:
> the answers is in your rc.log file
No really.
If you look at the "ll */*dbora*" output, S99dbora.org is not a link but a script created in the rc2.d directory.
-rwxr-x--- 1 bin bin 939 Apr 28 15:07 rc2.d/S99dbora.org


The intended script "dbora" startup does not even appear in the rc.log!!
lrwxrwxr-x 1 root sys 18 May 13 10:35 rc3.d/S99dbora3 -> /sbin/init.d/dbora


Thats presumes a step in the configuration that has not been done properly..

Shabir: please post the requested information as per my last post.


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

Re: startup script

let's check if the #! pragma in your shell is referencing a shell in /sbin
if not problem may comes from that point
sh5490
Frequent Advisor

Re: startup script

ho yogeeraj,

thanks for u reply

pls find the output
bash-3.2# cat /etc/rc.config.d/dbora
ORACLE_START=1
export ORACLE_START

thanks

shabir

sh5490
Frequent Advisor

Re: startup script

hi yoograj,
after rebooting the server ,pls the folowing entries are found in /etc/rc.log file


usage: /sbin/rc2.d/S99dbora {start|stop}
Output from "/sbin/rc2.d/S99dbora start":
----------------------------
/sbin/rc2.d/S99dbora[9]: hostname: not found.
/sbin/rc2.d/S99dbora[14]: touch: not found.
starting Oracle Net Listener
/sbin/rc2.d/S99dbora[25]: su: not found.
Starting Oracle databases
/sbin/rc2.d/S99dbora[28]: su: not found.

usage: /sbin/rc2.d/S99dbora.org {start|stop}
Output from "/sbin/rc2.d/S99dbora.org start":
----------------------------
/sbin/rc2.d/S99dbora.org[7]: hostname: not found.
/sbin/rc2.d/S99dbora.org[12]: touch: not found.
starting Oracle Net Listener
Starting Oracle databases
/sbin/rc2.d/S99dbora.org[23]: su: not found.
/sbin/rc2.d/S99dbora.org[26]: su: not found.


thanks

shabir
MarkSyder
Honored Contributor

Re: startup script

It seems to be telling you it can't find the commands hostname, su, etc. If you can edit the script, put the full path in.

Mark
The triumph of evil requires only that good men do nothing
Yogeeraj_1
Honored Contributor

Re: startup script

hi Shabir,

There is something with the script itself. We need to check what Fabien mentioned previously.

"let's check if the #! pragma in your shell is referencing a shell in /sbin if not problem may comes from that point"

Can you post your dbora script?

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

Re: startup script

hi yogreej,

kindly find contents of dbora script

ORACLE_HOME=/u01/app/oracle/OraHome_1;export ORACLE_HOME
#;export ORACLE_HOME
ORACLE_SID=ciehoi;export ORACLE_SID
# oracle owner at your site.
ORACLE=oracle
PATH=${PATH}:$ORACLE_HOME/bin
HOST=`hostname`
PLATFORM=`uname`
export ORACLE_HOME PATH
#
LOG=$ORACLE_HOME/stop1.log
touch $LOG
chmod a+r $LOG
#
case $1 in
'start')
echo "$0: starting up" >> $LOG
date >> $LOG
# Start Oracle Net
if [ -f $ORACLE_HOME/bin/tnslsnr ] ;
then
echo "starting Oracle Net Listener"
su - $ORACLE -c "lsnrctl start" >> $LOG2>&1 &
fi
echo "Starting Oracle databases"
su - $ORACLE -c "dbstart" >> $LOG2>&1 &
;;
'stop')
echo "$0: shutting down" >> $LOG
date >> $LOG
# Stop Oracle Net
if [ -f $ORACLE_HOME/bin/tnslsnr ] ;
then
echo "stopping Oracle Net Listener">> $LOG2>&1&
su - $ORACLE -c "lsnrctl stop" >> $LOG2>&1 &
fi
echo "stopping Oracle databases">>$LOG2>&1&
su - $ORACLE -c "dbshut" >> $LOG2>&1 &
;;
*)
echo "usage: $0 {start|stop}"
exit
;;

thanks

shabir

Yogeeraj_1
Honored Contributor

Re: startup script

Hi shabir,

This script is not according to standards. Please modify the script such that it looks something similar to /sbin/init.d/syslogd

i.e.
#!/sbin/sh
...
rval=0
set_return() {
x=$?
if [ $x -ne 0 ]; then
echo "EXIT CODE: $x"
rval=1
fi
}
...

exit $rval


Please let us know if this works!

kind regards
yogeeraj

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

Re: startup script

hi yogreej,

it didn't work
for u info,rc.log contents



usage: /sbin/rc2.d/S99dbora {start|stop}
Output from "/sbin/rc2.d/S99dbora start":
----------------------------
/sbin/rc2.d/S99dbora[11]: exit0: not found.
/sbin/rc2.d/S99dbora[18]: hostname: not found.
/sbin/rc2.d/S99dbora[23]: touch: not found.
starting Oracle Net Listener
/sbin/rc2.d/S99dbora[34]: su: not found.
Starting Oracle databases
/sbin/rc2.d/S99dbora[37]: su: not found.

usage: /sbin/rc2.d/S99dbora.org {start|stop}
Output from "/sbin/rc2.d/S99dbora.org start":
----------------------------
/sbin/rc2.d/S99dbora.org[7]: hostname: not found.
/sbin/rc2.d/S99dbora.org[12]: touch: not found.
starting Oracle Net Listener
Starting Oracle databases

thanks
shabir
Yogeeraj_1
Honored Contributor

Re: startup script

hi again,

can you please post your "new" dbora script?

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
MarkSyder
Honored Contributor

Re: startup script

This line seems to be part of your problem:

PATH=${PATH}:$ORACLE_HOME/bin

This is the first time PATH is declared. You need to incorporate the path of the commands su, hostname, etc.

Mark
The triumph of evil requires only that good men do nothing