Oracle DB Autostart – Unix/Linux Oracle User No Login Shell

oraclestartup

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?

Best Answer

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