Service Scripts for Oracle

Source: Internet
Author: User
Tags stop script

[Email protected] init.d]# Vim Oracle

#!/bin/sh

# chkconfig:35 80 10

# description:oracle Auto Start-stop script.

#

# Set Ora_home to being equivalent to the $ORACLE _home

# from which-Wish to execute Dbstart and Dbshut;

#

# Set Ora_owner to the user ID of the OWNER of the

# Source function library.

. /etc/rc.d/init.d/functions

# Oracle database in Ora_home.

ora_home=/usr/local/oracle/product/10201

Ora_owner=oracle

if [!-F $ORA _home/bin/dbstart]

Then

echo "Oracle startup:cannot start"

Exit

Fi

Case "$" in

' Start ')

# Start the Oracle databases:

# echo "Starting Oracle Databases ... "

Action $ "Starting $ORA _owner:"/bin/true

echo "-------------------------------------------------" >>/var/log/oracle

Date + "%T%a%d:starting Oracle Databases as part of the system up." >>/var/log/oracle

echo "-------------------------------------------------" >>/var/log/oracle

su-$ORA _owner-c "$ORA _home/bin/dbstart" >>/var/log/oracle

echo "Done"

# Start The Listener:

# echo "Starting Oracle Listeners ... "

Action $ "Starting $ORA _owner Listeners ...:"/bin/true

echo "-------------------------------------------------" >>/var/log/oracle

Date + "%T%a%d:starting Oracle Listeners as part of the system up." >>/var/log/oracle

echo "-------------------------------------------------" >>/var/log/oracle

su-$ORA _owner-c "$ORA _home/bin/lsnrctl start" >>/var/log/oracle

echo "Done."

echo "-------------------------------------------------" >>/var/log/oracle

Date + "%T%a%d:finished." >>/var/log/oracle

echo "-------------------------------------------------" >>/var/log/oracle

Touch/var/lock/subsys/oracle

;;

' Stop ')

# Stop the Oracle Listener:

Action $ "stoping $ORA _owner Listeners ...:"/bin/true

echo "-------------------------------------------------" >>/var/log/oracle

Date + "%T%a%d:stoping Oracle Listener as part of the system down." >>/var/log/oracle

echo "-------------------------------------------------" >>/var/log/oracle

su-$ORA _owner-c "$ORA _home/bin/lsnrctl Stop" >>/var/log/oracle

echo "Done."

Rm-f/var/lock/subsys/oracle

# Stop the Oracle Database:

# echo "Stoping Oracle Databases ... "

Action $ "stoping $ORA _owner:"/bin/true

echo "-------------------------------------------------" >>/var/log/oracle

Date + "%T%a%d:stoping Oracle Databases as part of the system down." >>/var/log/oracle

echo "-------------------------------------------------" >>/var/log/oracle

su-$ORA _owner-c "$ORA _home/bin/dbshut" >>/var/log/oracle

echo "Done."

echo ""

echo "-------------------------------------------------" >>/var/log/oracle

Date + "%T%a%d:finished." >>/var/log/oracle

echo "-------------------------------------------------" >>/var/log/oracle

;;

' Restart ')

$ stop

$ start


Esac

[Email protected] init.d]# chmod 755/etc/init.d/oracle

[[email protected] init.d]# chkconfig--level 2435 Oracle on

[Email protected] init.d]# chkconfig--list|grep Oracle

Oracle 0:off 1:off 2:on 3:on 4:on 5:on 6:off


To add a self-boot, you must change N to y in the following file

[Email protected] init.d]# Vim/etc/oratab

Bill:/usr/local/oracle/product/10201:y ====> here originally N


This article from "Linux" blog, declined reprint!

Service Scripts for Oracle

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.