Thursday, January 31, 2013

3 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.



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.


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


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

# chkconfig: 345 99 10
case "$1" in
        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" 
        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" 


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


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

service oracle start
service oracle stop





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