Thursday, January 31, 2013

4 Auto restart Oracle and related service via dbstart

For  Oracle Grid or ASM environment , the Oracle restart is being used to start the Oracle after the OS startup. However, the Oracle instance does not use the Oracle RAC and ASM, we still need to use dbstart/dbshut to start the oracle.

 

dbstart and dbshut

 

Edit the /etc/oratab file

The file contains the Oracle SID and the oracle home directory. The last parameter decide whether dbstart would bring it up or not.

SID: ORACLE_HOME: Y/N

image

After the ORALCE_SID is set to Y, we can use dbstart to bring up the oracle instance.

Known issue with ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener

There is known issue with the dbstart. We would get the error message about “ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener”. The database would startup fine but the listener does not start.

image

To fix the error, we need to pass the $ORACLE_HOME to the dbstart ..

image

However, this would only bring up the default listener. I can not find anyway to bring up the named listener via dbstart. I have to create the customize script in the init.d to do this.

Create /etc/init.d/oracle

#!/bin/sh
# chkconfig: 345 99 10
 
ORA_OWNER=oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0
 
case "$1" in
    'start')
        su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start LISTENER_ORACLEDB1" 
        su - $ORA_OWNER -c "$ORACLE_HOME/bin/dbstart" 
        su - $ORA_OWNER -c "$ORACLE_HOME/bin/emctl start dbconsole" 
    ;;
    'stop')
        su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop LISTENER_ORACLEDB1" 
        su - $ORA_OWNER -c "$ORACLE_HOME/bin/emctl stop dbconsole" 
        su - $ORA_OWNER -c "$ORACLE_HOME/bin/dbshut" 
    ;;
esac

 

In order for chkconfig to recognize the script, we need to have “# chkconfig: 345 99 10

chmod 750 oracle
chkconfig --add oracle
chkconfig --list oracle

image

To test the init.d script, we can use service command

service oracle start
service oracle stop

 

Reference

4 comments:

  1. Replies
    1. Great Article IoT Projects for Students

      Deep Learning Projects for Final Year

      JavaScript Training in Chennai

      JavaScript Training in Chennai

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. It's a nice article, Which you have shared here about oracle. Your article is very interesting and I really liked the way you expressed your views in this post. Thank you. oracle apps cloud training

    ReplyDelete

 

SQL Panda Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates