Automatically start and close Oracle databases on Linux (9i/10g/11g)

Source: Internet
Author: User
Tags stop script oracle database linux

Oracle Clusterware automatically starts and stops Oracle database instances when using RAC or ASM under Oracle 1GR2 or later, so the following procedure is not required, and in other cases you can use the method described below.

SU command

The following description is a method recommended by Oracle to automatically start and close Oracle 9i instances.

Once the instance is created, the tag/etc/oratab file sets the restart flag for each instance to "Y":

Tsh1:/u01/app/oracle/product/9.2.0:y

Next, log in as root to create a file called/etc/init.d/dbora, including the following:

#!/bin/sh
# chkconfig:345
# description:oracle Auto start-stop script.
#
# Set Ora_home t O is equivalent to the $ORACLE _home
# which for you wish to execute Dbstart and Dbshut;
#
# Set Ora_owner to The user ID of the owner of the
# Oracle database in Ora_home.
ora_home=/u01/app/oracle/product/9.2.0
Ora_owner=oracle
If [!-f $ORA _home/bin/dbstart]
then
Echo Oracle Startup:cannot start
Exit
Fi
Case "in
' start ')
# Start the Oracle databases:
# the FO Llowing command assumes that Oracle login
# won't prompt the user for any values
su-$ORA _owner-c "$ORA _h Ome/bin/lsnrctl start "
su-$ORA _owner-c $ORA _home/bin/dbstart
;;
' Stop ')
# Stop The Oracle databases:
# The following command assumes that Oracle login
# would not prompt the user For any values
su-$ORA _owner-c $ORA _home/bin/dbshut
su-$ORA _owner-c "$ORA _home/bin/lsnrctl Stop"
;;
Esac

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.