Debian 6 sets Oracle 11g R2 to automatically start upon startup

Source: Internet
Author: User

Debian 6 sets Oracle 11g R2 to automatically start upon startup

Log On with the root account.

Step 1: Modify/etc/oratab

Orcl:/home/oracle/product/11.2.0/db_1: Y

Where

Orcl: sid

/Home/oracle/product/11.2.0/db_1: db_home

Y: Start Y (yes) or N (no). The default value is N, which is changed to Y.

Step 2: Create an oracle file under the/etc/init. d directory

#! /Bin/bash
#
# Run-level Startup script for the Oracle Instance and Listener
#
# Chkconfig: 345 91 19
# Description: Startup/Shutdown Oracle listener and instance
ORA_HOME = "/home/oracle/product/11.2.0/db_1"
ORA_OWNR = "oracle"
# If the executables do not exist -- display error
If [! -F $ ORA_HOME/bin/dbstart-o! -D $ ORA_HOME]
Then
Echo "Oracle startup: cannot start"
Exit 1
Fi
# Depending on parameter -- startup, shutdown, restart
# Of the instance and listener or usage display
Case "$1" in
Start)
# Oracle listener and instance startup
Echo-n "Starting Oracle :"
Su-$ ORA_OWNR-c "$ ORA_HOME/bin/dbstart $ ORA_HOME"
Su-$ ORA_OWNR-c "$ ORA_HOME/bin/lsnrctl start"
# Optional: for Enterprise Manager software only
Su-$ ORA_OWNR-c "$ ORA_HOME/bin/emctl start dbconsole"
Touch/var/lock/oracle
Echo "OK"
;;
Stop)
# Oracle listener and instance shutdown
Echo-n "Shutdown Oracle :"
# Optional: for Enterprise Manager software only
Su-$ ORA_OWNR-c "$ ORA_HOME/bin/emctl stop dbconsole"
Su-$ ORA_OWNR-c "$ ORA_HOME/bin/lsnrctl stop"
Su-$ ORA_OWNR-c "$ ORA_HOME/bin/dbshut $ ORA_HOME"
Rm-f/var/lock/oracle
Echo "OK"
;;
Reload | restart)
$0 stop
$0 start
;;
*)
Echo "Usage: $0 start | stop | restart | reload"
Exit 1
Esac
Exit 0

Note: Modify the oracle home Directory.

/Home/oracle/product/11.2.0/db_1

And change the file permissions:

Chmod 755/etc/init. d/oracle

Step 3: Let the oracle file be called at system startup

Update-rc.d oracle ults 99 01

When performing this step, the system prompts a warning:

Insserv: warning: script 'oracle 'missing LSB tags and overrides

Restart the instance and execute lsnrctl status to find that the instance has been started. Open Toad and click OK. These errors are ignored for the moment.

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.