# Run level script to start Oracle 10g services on RedHat Enterprise Linux (RHAS 4)
# Script should work on other UNIX like oses :)
# -------------------------------------------------------------------------
# Copyright (c) 2006 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# Comment/suggestion: <vivek at nixCraft DOT com>
# -------------------------------------------------------------------------
# chkconfig: 345 91 19
# description: Startup/Shutdown Oracle service
# check Oracle db status
function chkdb_status() {
# set username
# set password
sqlplus -s /nolog > /dev/null 2>&1 <<EOF
whenever sqlerror exit failure
connect $SUSER/$SPASS
exit success
if [ $? -ne 0 ]; then
 echo "Connection failed : DB is down"
 exit 1
 echo "Connection succeeded : DB is up"
case "$1" in
        echo  "*** Starting Oracle *** "
        su - $OUSER -c "$OPATH/bin/lsnrctl start"
        su - $OUSER -c "$OPATH/bin/dbstart"
        echo  "*** Stopping Oracle *** "
        su - $OUSER -c "$OPATH/bin/lsnrctl stop"
        su - $OUSER -c "$OPATH/bin/dbshut"
        $0 stop
        $1 start
        echo  "*** Starting Oracle iSQL Plus *** "
        su - $OUSER -c "$OPATH/bin/isqlplusctl start"
        echo "*** Note: You can access service at url:  http://$(hostname):5560/isqlplus"
        echo  "*** Stopping Oracle iSQL Plus *** "
        su - $OUSER -c "$OPATH/bin/isqlplusctl stop"
        echo  "*** Starting Oracle Enterprise Manager 10g Database Control ***"
        su - $OUSER -c "$OPATH/bin/emctl start dbconsole"
        echo "*** Note: You can access service at url:  http://$(hostname):1158/em"
        echo  "*** Stopping Oracle Enterprise Manager 10g Database Control ***"
        su - $OUSER -c "$OPATH/bin/emctl stop dbconsole"
        echo "*** Oracle database status ***"
        echo $"Usage: $0 {start|stop|isqlstart|isqlstop|emstart|emstop}"
        exit 1
exit 0
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source, and DevOps topics via:
Category List of Unix and Linux commands
Disk space analyzers ncdu pydf
File Management cat
Firewall Alpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilities NetHogs dig host ip nmap
OpenVPN CentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Manager apk apt
Processes Management bg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searching grep whereis which
User Information groups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPN Alpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
10 comments… add one
  • Hosney Osman Apr 25, 2017 @ 9:41

    i want to do the same script for linux suse and oracle 12 c
    is that possible or not

  • Anonymous Mar 22, 2011 @ 20:03

    startup pfile =’/home/oracle/$dirname/admin/pfile/initswamy.ora’ nomount;

  • José Mosco Mar 3, 2011 @ 2:41

    A quick search on google reveal:
    To enable hugetlbpages, first you need 2.6 kernel, and then you need to recompile it with the following config options enabled:


    or just disable hugetlb tables:


    If you are doing this you need to have a lot of free RAM

    Anyway optimizing oracle is a heavy job. Take a look after limits.conf and oracle. You need to increase the number of file descriptors and a lot of other things.


  • Phil Page Oct 26, 2009 @ 13:22

    The problem I am having is that although this script will start and stop oracle when run on the command line, it does not shutdown oracle at re-boot. After logging a call with RH they told me to check the status within the script by adding the following to the script
    # Source function library.
    . /etc/rc.d/init.d/functions
    and then in the status case statment
    status dbora # ie name of script

    This then returned
    [root@host init.d]# ./dbora status
    dbora dead but subsys locked
    because the status of the system is not running no attempt will be made to shut it down at boot.

    Anyone know what code is required such that status returned will be running?

  • WilliamG Jun 9, 2009 @ 18:07

    Hi Nikhil, I had the same problem.
    I settled with the following instructions

    pront > sqlplus /nolog
    SQL>connect / as sysdba

    pront> cd $ORACLE_HOME/bin
    pront> lsnrctl start

  • Nikhil Apr 15, 2009 @ 12:50

    I am using oracle 10g through command line..It gives me following error while connecting. i am trying to connect as a dba..i am suse LINUX operating system…

    SQL*PLUS:Release10. Production on Wed: Apr 15 17:26:27 2009

    Copyright(c) 1982, 2005, Oracle. All Rights Reserved.

    SQL> connect
    Enter user-name:SYS
    Enter password:123
    ORA-01034: ORACLE not available.
    ORA-27121: unable to determine the size of share memory segment.
    Linux Error:13:Permission Denied

    kindly suggest me what to do?

  • seckin turk Jan 12, 2009 @ 14:30

    COuld you please sendm me a mail?I want to ask you which editor did you use to paste this good looking code?

    Is it html code ?

  • Thomas Jan 3, 2009 @ 5:14

    Thank you. Quite helpful. :)

  • Internetagentur Aug 4, 2008 @ 11:19

    Thank you … that tutorial has me very helped.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.