Enable and disable Oracle automatically with the system in Linux

Source: Internet
Author: User

To achieve the following goals:
A. Enable auto-start of Oracle instances
B. Shut down the Oracle database before shutting down the operating system or restarting the operating system.


A. Follow these steps to start an oracle instance:
1. modify the content of the Oracle system configuration file/etc/oratab and change the N of the last character in the last line to Y.

Root User Logon Modification
# Vi/etc/oratab
As follows:
Wwl:/oracle/orahome/10.2.0/db_1: N

Change to the following and save and exit.
Wwl:/oracle/orahome/10.2.0/db_1: Y


2. Modify the/etc/rc. d/rc. local file in RedHat and add the following content:
Modify/etc/init. d/after. local in SUSE and add the following content:

# Vi/etc/rc. d/rc. local
Su-c "dbstart"-oracle


3. Switch to oracle user login and modify $ ORACLE_HOME/bin/dbstart, find ORACLE_HOME_LISTNER =, and change the value to the ORACLE_HOME path or environment variable.
# Su-oracle
$ Vi $ ORACLE_HOME/biin/dbstart

# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER = $ ORACLE_HOME --- modify here. You can use $ ORACLE_HOME or the absolute path.
If [! $ ORACLE_HOME_LISTNER]; then
Echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
Else
LOG = $ ORACLE_HOME_LISTNER/listener. log

# Start Oracle Net Listener
If [-f $ ORACLE_HOME_LISTNER/bin/tnslsnr]; then
Echo "$0: Starting Oracle Net Listener" >>$ LOG 2> & 1
$ ORACLE_HOME_LISTNER/bin/lsnrctl start >$ LOG 2> & 1 &
Export VER10LIST = '$ ORACLE_HOME_LISTNER/bin/lsnrctl version | grep "LSNRCTL for" | cut-d ''-f5 | cut-d'.'-f1'
Else
Echo "Failed to auto-start Oracle Net Listene using $ ORACLE_HOME_LISTNER/bin/tnslsnr"
Fi
Fi

B. perform the following steps to disable oracle instances:

1. Create the k01orashut file and write the su-c "dbshut"-oracle command to this file.
Vi/etc/init. d/k01orashut
Add
Su-c "dbshut"-oracle

2. Modify the permission to execute
# Chown 777/etc/rc. d/init. d/k01orashut


3. Go to the/etc/rc3.d/directory and create a connection to shut down and execute commands.
# Ln-s/etc/rc. d/init. d/k01orashut

For more information about Oracle, see Oracle topics page http://www.bkjia.com/topicnews.aspx? Tid = 12

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.