Linux Start Oracle As a Service

How do I start the Oracle database server as a service under Linux operating systems?

Starting the Oracle database server is very easy under Linux:

ADVERTISEMENTS

a) Login as an oracle user

b) First start the Oracle listener processes using lsnrctl utility

c) Next start the Oracle database using dbstart utility that reads the oratab file (/etc/oratab)

d) Connect to server using sql plus client or isql pluse web based client

Type the following commands:
$ su - oracle
$ lsnrctl start
$ dbstart

To make the entire process easy we have a shell script that starts and stops Oracle database.

Download script to /tmp directory and rename it as oracle

Copy script to /etc/init.d directory:
# cp /tmp/oracle /etc/init.d/oracle
Create a soft link (Run level 3):

# cd /etc/rc3.d/
# ln -s ../init.d/oracle S100oracle
# ln -s ../init.d/oracle K100oracle

Alternatively, use the chkconfig command to add script:
# chkconfig --add oracle
# chkconfig --list oracle

Please note that you can just use script directly, to start the Oracle type the following command:
# /etc/init.d/oracle start
To stop the Oracle type the following command:
# /etc/init.d/oracle stop

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
9 comments… add one
  • gokalp May 7, 2008 @ 10:56

    Thanks a lot

  • abid mirza Feb 20, 2009 @ 10:00

    i did worked, thanks a lot

  • amit Apr 16, 2009 @ 12:06

    it’s working..
    thanks a lot..

  • william Aug 11, 2009 @ 10:33

    it works
    thanks a lot!

  • Daniel Sep 15, 2010 @ 6:18

    The download link has been blocked.
    Safe Browsing
    Diagnostic page for bash.cyberciti.biz
    What is the current listing status for bash.cyberciti.biz?
    Site is listed as suspicious – visiting this web site may harm your computer.
    Part of this site was listed for suspicious activity 3 time(s) over the past 90 days.
    What happened when Google visited this site?
    Of the 17 pages we tested on the site over the past 90 days, 15 page(s) resulted in malicious software being downloaded and installed without user consent. The last time Google visited this site was on 2010-09-14, and the last time suspicious content was found on this site was on 2010-09-14.
    Malicious software is hosted on 1 domain(s), including superstoreviagra.com/.
    1 domain(s) appear to be functioning as intermediaries for distributing malware to visitors of this site, including simplyguide.com/.
    This site was hosted on 1 network(s) including AS36351 (SOFTLAYER).
    Has this site acted as an intermediary resulting in further distribution of malware?
    Over the past 90 days, bash.cyberciti.biz did not appear to function as an intermediary for the infection of any sites.
    Has this site hosted malware?
    No, this site has not hosted malicious software over the past 90 days.
    How did this happen?
    In some cases, third parties can add malicious code to legitimate sites, which would cause us to show the warning message.
    Could you please fix it?
    Thank you.

    • 🐧 nixCraft Sep 15, 2010 @ 7:35

      This has been already fixed, but Google will take day or two to remove the same. Try wget.

      wget http://bash.cyberciti.biz/dl/122.sh.zip

      HTH

  • bill Oct 20, 2010 @ 19:16

    cheers. was very helpful.
    on RHEL5U4.
    Can you explain what the

    # set username
    SUSER=”suser”
    # set password
    SPASS=”spass”

    are for?

  • clinton fisher Nov 18, 2010 @ 20:09

    thank you for the script.
    do i need to modify the script to use it in Ubuntu 10.10 Desktop , Debian base

  • Mark Sobkow Mar 25, 2012 @ 0:24

    For Ubuntu, if you use “alien” to install the Oracle 11g Express server, you will be left with an /etc/init.d/oracle-xe process management script intended for init.d based distributions.

    Ubuntu has excellent documentation on how to wire that script to the system so it autostarts.

Leave a Reply

Your email address will not be published.

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