Automatic database startup and shutdown (START and close oracle at startup)

Source: Internet
Author: User
Tags tru64
Exam: http://download.oracle.com/docs/pdf/B10812_02.pdf

Use the dbstart and dbshut scripts to automate database startup and shutdown.
Perform the following tasks to set up these scripts so that they are called at System
Startup and shutdown. perform these steps for every new database that you want
Configure for automated startup and shutdown:
1. log in as the root user.
2. Edit the oratab file for your platform:
■ Solaris:
/Var/opt/Oracle/oratab
Note: The procedure described in this section applies
Single-instance databases only.
See also: For more information about system startup and
Shutdown procedures, see the init command in your UNIX
System documentation.
Automating startup and Shutdown
Starting and stopping Oracle software 2-11
■ Other operating systems:
/Etc/oratab
Database entries in the oratab file appear in the following format:
Sid: ORACLE_HOME: {Y | n}
In this example, Y or N specifies whether you want the scripts to start up or
Shut down the database. For each database that you want to start up and shut
Down, find the instance identifier (SID) for that database, identified by the SID
In the first field, and change the last field for each to y.
3. Change directory to one of the following directories, depending on your
Platform:
4. Create a file called dbora with the following contents. Change the value
Specified for the ORACLE_HOME environment variable to an Oracle Home
Directory for your installation, and change the value of the Oracle
Environment variable to the username of the owner of the database installed in
The Oracle Home Directory (typically Oracle ):
#! /Bin/sh-x
#
# Change the value of ORACLE_HOME to specify the correct Oracle Home
# Directory for you Installation
ORACLE_HOME =/u01/APP/Oracle/product/10.1.0/db_1
#
# Change the value of Oracle to the login name of
# Oracle owner at your site
#
Oracle = Oracle
Path =$ {path}: $ ORACLE_HOME/bin
Host = 'hostname'
Platform initialization file directory
AIX/etc
Linux and Solaris/etc/init. d
HP-UX and Tru64 UNIX/sbin/init. d
Automating startup and Shutdown
2-12 administrator's reference
Platform = 'uname'
Export ORACLE_HOME path
#
If [! "$2" = "ora_db"]; then
If ["$ platform" = "HP-UX"]; then
Remsh $ host-L $ Oracle-n "$0 $1 ora_db"
Exit
Else
Rsh $ host-L $ Oracle $0 $1 ora_db
Exit
Fi
Fi
#
Log = $ ORACLE_HOME/startup. Log
Touch $ log
Chmod A + r $ log
#
Case $1 in
'Start ')
Echo "$0: Starting up" >>$ log
Date> $ log
# Start Oracle Net
If [-F $ ORACLE_HOME/bin/tnslsnr]; then
Echo "Starting Oracle Net Listener"
$ ORACLE_HOME/bin/LSNRCTL start >$ log 2> & 1 &
Fi
Echo "Starting Oracle databases"
$ ORACLE_HOME/bin/dbstart >$ log 2> & 1 &
;;
'Stop ')
Echo "$0: Shutting Down" >>$ log
Date> $ log
# Stop Oracle Net
If [-F $ ORACLE_HOME/bin/tnslsnr]; then
Echo "Stopping Oracle Net Listener"
$ ORACLE_HOME/bin/LSNRCTL stop >>$ log 2> & 1 &
Fi
Echo "Stopping Oracle databases"
$ ORACLE_HOME/bin/dbshut >>$ log 2> & 1 &
;;
Automating startup and Shutdown
Starting and stopping Oracle software 2-13
*)
Echo "Usage: $0 {START | stop }"
Exit
;;
Esac
#
Exit
5. Change the group of the dbora file to the osdba group (typically dBA) and set
The permissionto 750:
# Chgrp DBA dbora
# Chmod 750 dbora
6. Create Symbolic Links to the dbora script in the appropriate run-level script
Directories, as follows:
Note: This script works only if a password has not been set for
Oracle Net Listener. If a password has been set for the listener, this
Script cannot stop the listener. Also, if the listener name is not
Default name listener, you must specify the listener name in
Stop and start commands:
$ ORACLE_HOME/bin/LSNRCTL {START | stop} listener_name
Platform symbolic links commands
AIX # ln-S/etc/dbora/etc/rc. d/rc2.d/s99dbora
# Ln-S/etc/dbora/etc/rc. d/rc2.d/k01dbora
The HP-UX # ln-S/sbin/init. d/dbora/sbin/rc3.d/s990dbora
# Ln-S/sbin/init. d/dbora/sbin/rc3.d/k001dbora
Linux # ln-S/etc/init. d/dbora/etc/rc. d/rc3.d/k01dbora
# Ln-S/etc/init. d/dbora/etc/rc. d/rc3.d/s99dbora
# Ln-S/etc/init. d/dbora/etc/rc. d/rc5.d/k01dbora
# Ln-S/etc/init. d/dbora/etc/rc. d/rc5.d/s99dbora
Solaris # ln-S/etc/init. d/dbora/etc/rc3.d/k01dbora
# Ln-S/etc/init. d/dbora/etc/rc3.d/s99dbora
Tru64 UNIX # ln-S/sbin/init. d/dbora/sbin/rc3.d/s99dbora
# Ln-S/sbin/init. d/dbora/sbin/rc3.d/k01dbora

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.