How to automatically start the Oracle service in Linux

Source: Internet
Author: User
In windows, you can set ORACLE service to automatic in Computer Service Management. After Oracle is installed in Linux, If you restart Linux, Oracle will not

In windows, you can set ORACLE service to automatic in Computer Service Management. After Oracle is installed in Linux, If you restart Linux, Oracle will not

In windows, you can set Oracle service to automatic in Computer Service Management. After Oracle is installed in Linux, Oracle will not start automatically if Linux is restarted, you can manually call the dbstart command to start the instance, but it seems complicated. We can configure the Oracle Automatic startup script and then use the Linux Service to start the Oracle server.

First, configure the Oracle service file in the/etc/rc. d/init. d/directory.

Touch oracle10g
Chmod a + x oracle10g

Edit the oracle10g file. The content is as follows.

#! /Bin/bash
# Whoami
# Root
# Chkconfig: 345 51 49
# Description: starts the oracle dabase deamons
#
ORA_HOME =/opt/oracle
ORA_OWNER = oracle
Case "{GetProperty (Content)}" in
'Start ')
Echo-n "Starting oracle10g :"
Su-$ ORA_OWNER-c "$ ORA_HOME/bin/dbstart "&
Su-$ ORA_OWNER-c "$ ORA_HOME/bin/lsnrctl start"
Touch/var/lock/subsys/oracle10g
Echo
;;

'Stop ')
Echo-n "shutting down oracle10g :"
Su-$ ORA_OWNER-c "$ ORA_HOME/bin/dbshut "&
Su-$ ORA_OWNER-c "$ ORA_HOME/bin/lsnrctl stop"
Rm-f/var/lock/subsys/oracle10g
Echo
;;

'Restart ')
Echo-n "restarting oracle10g :"
{GetProperty (Content)} stop
{GetProperty (Content)} start
Echo
;;
*)
Echo "usage: oracle10g {start | stop | restart }"
Exit 1

Esac
Exit 0

Save the file. After exiting, add and start the service.

/Sbin/chkconfig -- add oracle10g
/Sbin/chkconfig -- list oracle10g

When you restart Linux, if the Oracle startup item appears OK, it means that Oracle is successfully started with Linux.

,
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.