Set Oracle instances and listeners in Linux

Source: Internet
Author: User

Set Oracle instance and listener service to start automatically

1. Add a STARTUP script

Touch/etc/init. d/orcl

Vi orcl

#! /Bin/bash

# Whoami

# Root

# Chkconfig: 345 51 49

#/Etc/init. d/orcl

# Description: starts the oracle dabase deamons

#

ORA_HOME =/home/oracle/product/10.2.0/db_1/

ORA_OWNER = oracle

Case "$1" in

Start)

Echo-n "Starting orcl :"

Su-$ ORA_OWNER-c "$ ORA_HOME/bin/dbstart "&

Su-$ ORA_OWNER-c "$ ORA_HOME/bin/lsnrctl start"

Touch/var/lock/subsys/orcl

Echo

;;

Stop)

Echo-n "shutting down orcl :"

Su-$ ORA_OWNER-c "$ ORA_HOME/bin/dbshut "&

Su-$ ORA_OWNER-c "$ ORA_HOME/bin/lsnrctl stop"

Rm-f/var/lock/subsys/orcl

Echo

;;

Restart)

Echo-n "restarting orcl :"

$0 stop

$0 start

Echo

;;

*)

Echo "Usage: 'basename $ 0' start | stop | restart"

Exit 1

Esac

Exit 0

Save orcl and exit

2. Add Configuration Service

/Sbin/chkconfig -- add orcl

3. Modify the/etc/oratab File

Vi/etc/oratab

ORACLE_SID: ORACLE_HOME: Y -- whether to enable auto-start

4. Restart and test.

Or simply add two startup commands to/etc/rc. d/rc. local.

Su-oracle-c/home/oracle/product/10.2.0/db_1/bin/dbstart

Su-oracle-c/home/oracle/product/10.2.0/db_1/bin/lsnrctl start

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.