Auto Start and Stop of Oracle in new school Linux

Source: Internet
Author: User
1. Modify the Oracle system configuration file etcoratabetcoratab in the format of SID: ORACLE_HOME: AUTO to set the AUTO domain to Y (uppercase). Only in this way can dbstar

1. Modify the Oracle configuration file/etc/oratab in the format of SID: ORACLE_HOME: AUTO to set the AUTO domain to Y (uppercase ).

1. Modify the Oracle system configuration file/etc/oratab
/Etc/oratab format: SID: ORACLE_HOME: AUTO
Set the AUTO domain to Y (uppercase). Only in this way can dbstart and dbshut of oracle be used. Mine is:
Ora9i:/home/oracle/ora/products/9.2.0: Y

2. Compile a service script:
As follows:
#! /Bin/bash
#
################# FUNCTION #############
#
# AutoStart Oracle and listener
# AutoStop Oracle and listener
#
#####################################
#
# Created by ZhouYS 2003-11-26
#
Case "$1" in
Start)
Echo "Starting Oracle Databases ..."
Echo "-----------------------------------------------">/var/log/oracle
Date "% T % a % D: Starting Oracle Databasee as part of system up.">/var/log/oracle
Echo "-----------------------------------------------">/var/log/oracle
Su-oracle-c "dbstart">/var/log/oracle
Echo "Done ."
Echo "Starting Oracle Listeners ..."
Echo "-----------------------------------------------">/var/log/oracle
Date "% T % a % D: Starting Oracle Listeners as part of system up.">/var/log/oracle
Echo "-----------------------------------------------">/var/log/oracle
Su-oracle-c "lsnrctl start">/var/log/oracle
Echo "Done ."
Echo ""
Echo "-----------------------------------------------">/var/log/oracle
Date "% T % a % D: Finished.">/var/log/oracle
Echo "-----------------------------------------------">/var/log/oracle
Touch/var/lock/subsys/oracle
;;
Stop)
Echo "Stoping Oracle Listeners ..."
Echo "-----------------------------------------------">/var/log/oracle
Date "% T % a % D: Stoping Oracle Listener as part of system down.">/var/log/oracle
Echo "-----------------------------------------------">/var/log/oracle
Su-oracle-c "lsnrctl stop">/var/log/oracle
Echo "Done ."
Rm-f/var/lock/subsys/oracle
Echo "Stoping Oracle Databases ..."
Echo "-----------------------------------------------">/var/log/oracle
Date "% T % a % D: Stoping Oracle Databases as part of system down.">/var/log/oracle
Echo "-----------------------------------------------">/var/log/oracle
Su-oracle-c "dbshut">/var/log/oracle
Echo "Done ."
Echo ""
Echo "-----------------------------------------------">/var/log/oracle
Date "% T % a % D: Finished.">/var/log/oracle
Echo "-----------------------------------------------">/var/log/oracle
;;
Restart)
$0 stop
$0 start
;;
*)
Echo "Usage: oracle {start | stop | restart }"
Exit 1
Esac
Name the script oracle and save it under/etc/rc. d/init. d.
Change file attributes: chmod 755 oracle
Note: In windows, the file cannot run normally due to DOS characters when editing this file. You are advised to use gedit or vi to edit it.

3. Establish a service connection:
When the system starts the database, we need the following link:
--------------------------------------------------------------------------------
$ Ln-s ../init. d/oracle/etc/rc. d/rc2.d/S99oracle
$ Ln-s ../init. d/oracle/etc/rc. d/rc3.d/S99oracle
$ Ln-s ../init. d/oracle/etc/rc. d/rc5.d/S99oracle # rc4.d unused
--------------------------------------------------------------------------------
To stop the database at restart, we need the following link:
--------------------------------------------------------------------------------
$ Ln-s ../init. d/oracle/etc/rc. d/rc0.d/K01oracle # Stop
$ Ln-s ../init. d/oracle/etc/rc. d/rc6.d/K01oracle # restart

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.