Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

init.d autostart working but not autostop

EdStevensDec 11 2009 — edited Dec 12 2009
Dell Latitude Laptop --> Win XP Pro --> VM Player --> OEL 5 --> Oracle rdbms 10.2.0.4

So far the above configuration is working exactly like I want except for one last detail. Configuring for automatic start and stop of the Oracle database. The automatic start on server startup is working as advertised, but not the automatic shutdown. Here's what I've done so far:

1) placed entry for db ins /etc/oratab
2) placed the follwowing file, named 'dbora' in /etc/init.d Things to note in this file:
a) the 'touch' command to create evidence that the file executed at all,
b) the reference to /usr/local/bin/locvars - this is a file that exports oracle related env variables such as ORACLE_HOME and ORACLE_SID
c) the called files 'dbstart' and 'dbshut' have similar 'touch' statements to create a trail of what got executed.
[root@vmsvr03 ~]# cat /etc/init.d/dbora
#!/bin/sh
touch /home/oracle/dbora_ran_$1
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORACLE_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the 
# Oracle database in ORACLE_HOME.

#ORACLE_HOME=/ora00/app/oracle/product/10.2.0/db_1
#ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
source /usr/local/bin/locvars
ORA_OWNER=oracle

if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
    echo "Oracle startup: cannot start" >> /mnt/hgfs/initsetup/dboralog
    exit
fi

case "$1" in
    'start')
        # Start the Oracle databases:
        # The following command assumes that the oracle login 
        # will not prompt the user for any values
        su - $ORA_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
        echo su - $ORA_OWNER -c '$ORACLE_HOME/bin/dbstart $ORACLE_HOME' >> /mnt/hgfs/initsetup/dboralog
        ;;
    'stop')
        # Stop the Oracle databases:
        # The following command assumes that the oracle login 
        # will not prompt the user for any values
        su - $ORA_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
        echo su - $ORA_OWNER -c '$ORACLE_HOME/bin/dbshut $ORACLE_HOME' >> /mnt/hgfs/initsetup/dboralog
        ;;
esac
[root@vmsvr03 ~]# 
3) after placing the above file in /etc/init.d/dbora, I executed the following commands as root:
chown root:root /etc/init.d/dbora
chmod 750 /etc/init.d/dbora
chkconfig --level 345 dbora on
Now, when the virtual machine is started, the files dbora and orastart are executed and everything is as expected. However, on machine shutdown, (and I do a controlled shutdown, not just killing vmplayer from the host OS) there is no evidence that dbora is executed.

Digging a bit deeper, I looked into /etc/rc3.d where I found an 'S99dbora' for the startup but no 'Knndbora' for the shutdown:
[root@vmsvr03 rc3.d]# ls -l |grep ora
lrwxrwxrwx 1 root root 15 Dec 11 11:59 S99dbora -> ../init.d/dbora
[root@vmsvr03 rc3.d]# 
I presume that of the 'K' file is why we don't get the auto shutdown, but given that the 'S' file was created by the actions listed above (nothing that I explicitly did) what could I have missed to create the 'K' file?
This post has been answered by Tommy.Reynolds-Oracle on Dec 11 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 9 2010
Added on Dec 11 2009
6 comments
2,370 views