LINUX Oracle Automatic Start and Stop

xiaoxiao2021-03-06  103

LINUX Oracle Automatic Start and Stop

1. Modify Oracle System Profile / etc / ORATAB

/ etc / oratab format: SID: Oracle_Home: Auto

Set the Auto domain as y (uppercase), only the Oracle comes with DBSTART and DBSHUT can play a role. My is:

ORA9I: /Home/oracle/ora/products/9.2.0: y

2. Write a service script: as follows

#! / bin / bash

#

#############################################################################

#

# 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 Listener ..."

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 listener ..."

echo "------------------------------------------------ - ">> / var / log / oracledate "% 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, save it under /etc/rc.d/init.d

Change file properties: chmod 755 Oracle

Note: DOS format characters have caused the DOS format characters in Windows, which is not possible to run properly under Linux. It is recommended to use gedit or edit with VI.

3. Establish a service connection: Start the database when the system starts, we need the following link:

-------------------------------------------------- ------------------------------

$ ln -s ../init.d/oracle /etc/rc.d/rc2.d/s99racle

$ ln -s ../init.d/racle /etc/rc.d/rc3.d/s99racle

$ ln -s ../init.d/racle /etc/rc.d/rc5.d/s99racle # rc4.d unused

-------------------------------------------------- ------------------------------

To stop the database while restarting, we need the following link:

-------------------------------------------------- ------------------------------ $ ln -s ../init.d/oracle /etc/rc.d/rc0 .d / k01racle # stop

$ ln -s ../init.d/racle /etc/rc.d/rc6.d/k01racle # Restart

转载请注明原文地址:https://www.9cbs.com/read-102707.html

New Post(0)