2

I have to setup an autostart for a Oracle DB 12c on a RHEL 6.8 OS. The user oracle has no login shell e.g.

sudo su - oracle -s /bin/bash

I followed a guide for a RHEL setup. The init.d script Looks as follows:

#!/bin/bash
# chkconfig: 35 99 10
# description: Starts and stops Oracle processes

ORA_HOME=/opt/oracle/product/12cR1/db
ORA_OWNER=oracle

PATH=${PATH}:$ORACLE_HOME/bin
HOST=`hostname`
PLATFORM=`uname`
export ORACLE_HOME PATH
case $1 in
'start')
        su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
        su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart"
        ;;
'stop')
        su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
        su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut"
        ;;
*)
        echo "usage: $0 {start|stop}"
        exit 1
esac
#
exit

After os reboot. Oracle DB does not start. What could be wrong? Are there other logs beside $ORACLE_HOME/startup.log?

3
  • What happens, when you run the script manually as root? /etc/init.d/oracle start Commented Sep 30, 2016 at 7:06
  • /etc/init.d/oracle start LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 30-SEP-2016 09:15:29 Copyright (c) 1991, 2014, Oracle. All rights reserved. TNS-01106: Listener using listener name LISTENER has already been started ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener Usage: /opt/oracle/product/12cR1/db/bin/dbstart ORACLE_HOME Processing Database instance "XXXX": log file /opt/oracle/product/12cR1/db/startup.log
    – r0tt
    Commented Sep 30, 2016 at 7:18
  • Just for what it's worth, I never set up my db's for autostart. If my server has been shut down (planned or not) I want to check things out before I allow my databases to start. Does that mean I sometimes have to log in from home in the wee hours? Sure. But that kind of thing goes with the job for DBAs and SAs
    – EdStevens
    Commented Sep 30, 2016 at 12:31

1 Answer 1

0

The init.d script has to be modified by adding "-s /bin/bash" to the start and stop case. This should allow the oracle user to be login without the password.

#!/bin/bash
# chkconfig: 35 99 10
# description: Starts and stops Oracle processes

ORA_HOME=/opt/oracle/product/12cR1/db
ORA_OWNER=oracle

PATH=${PATH}:$ORACLE_HOME/bin
HOST=`hostname`
PLATFORM=`uname`
export ORACLE_HOME PATH
case $1 in
'start')
        su - $ORA_OWNER -s /bin/bash -c "$ORA_HOME/bin/lsnrctl start"
        su - $ORA_OWNER -s /bin/bash -c "$ORA_HOME/bin/dbstart"
        ;;
'stop')
        su - $ORA_OWNER -s /bin/bash -c "$ORA_HOME/bin/lsnrctl stop"
        su - $ORA_OWNER -s /bin/bash -c "$ORA_HOME/bin/dbshut"
        ;;
*)
        echo "usage: $0 {start|stop}"
        exit 1
esac
#
exit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.