Oracle DB startup details

After installing Oracle DB 11g R2, we have to create a BD using :

$ dbca

If you don’t have (yet) the environment variables, you have to create at .bash_profile :

ORACLE_BASE="/home/oracle/Oracle/angellore/"
ORACLE_HOME="/home/oracle/Oracle/angellore/product/11.2.0/dbhome_1/"
ORACLE_SID="soa"
ORACLE_HOME_LISTNER=LISTENER

After creating the database we have to configure the listener to allow TCP connections :

$ netmgr

After NetManager opens, go to Oracle Net Configuration > Local > Listeners > LISTENER and provide the SID as you defined in the DB creation steps. Save the configuration and close the NetManager.

After that, we have to start the listener as :

$ lsnrctl start && dbstart

Automatic statartup script

Depending on your system, you have to create script at startup scripts; we can create (on Fedora/RedHat) the script /etc/init.d/oracle as :

#!/bin/sh
#
# /etc/rc.d/init.d/oracle
# Description: Starts and stops the Oracle database, listeners and Enterprise Manager
# See how we were called.
case "$1" in
start)
echo "Starting Oracle"
echo -n "Starting Oracle Databases: "
su angellore -c dbstart >> /tmp/oracle.log
echo "Done."

echo -n "Starting Oracle Listeners: "
su angellore -c "lsnrctl start" >> /tmp/oracle.log
echo "Done."

echo -n "Starting Oracle Enterprise Manager: "
su angellore -c "emctl start dbconsole" >> /tmp/oracle.log
echo "Done."
touch /var/lock/subsys/oracle
;;
stop)
echo "Shutting Down Oracle"
echo -n "Shutting Down Oracle Enterprise Manager: "
su angellore -c "emctl stop dbconsole" >> /tmp/oracle.log
echo "Done."

echo -n "Shutting Down Oracle Listeners: "
su angellore -c "lsnrctl stop" >> /tmp/oracle.log
echo "Done."

rm -f /var/lock/subsys/oracle
echo -n "Shutting Down Oracle Databases: "
su angellore -c dbshut >> /tmp/oracle.log
echo "Done."
;;
*)
echo "Usage: oracle {start|stop|restart}"
esac

Finally, in /etc/oratab we have to tell oracle that out instance has to be started up at boot time :

# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ‘:’, is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, ‘#’, are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , “Y”, or should not,
# “N”, be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
oracle:/home/angellore/Oracle/angellore/product/11.2.0/dbhome_1:Y
soa:/home/angellore/Oracle/angellore/product/11.2.0/dbhome_1:Y

If you have problems with the shared memory at startup time, you have to create more shared memory space as :

$ mount -t tmpfs shmfs -o size=4g /dev/shm && echo "shmfs /dev/shm tmpfs size=4g 0" >> /etc/fstab