Oracle Automatic Start and Stop

Source: Internet
Author: User
During recent development, we found that if the Oracle database is not closed every time we restart the server, we must first shut it down and restart RedHat advance server before oracle can run properly. I feel so troublesome to think about whether the database can be shut down and started together with the Web server and the operating system. After searching for relevant information on the Internet, I found only one article entitled "Oracle Database howto Automatic Start and Stop .htm", but I did not find any article about Automatic Start and Stop of weblogic. After exploration, I realized my initial idea, so I want to write it out and communicate with you.
Server environment:
RedHat advance server2.1
Oracle 9.2.2 for Linux
Weblogic7.0 for Linux
1. Oracle Automatic Start and Stop
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. Write the service script as follows:
#! /Bin/bash

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: When editing this file in windows, the file may contain dos characters, which may cause abnormal operation in Linux. We recommend that you use gedit or VI to edit the file.

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

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.