Think Foward Logo Tested on Oracle 8i Tested on Oracle 9i Tested on Oracle 10g

Shell Script

Database Shutdown

Updated: 18-Apr-2002
Version: 2.0

Description

Simple database shutdown script. Gets the ORACLE_HOME from /etc/oratab. This script is an alternative to the Oracle supplied dbstart and dbstop scripts.

Parameters

Simple database shutdown script. Gets the ORACLE_HOME from /etc/oratab. This script is an alternative to the Oracle supplied dbstart and dbstop scripts.

SQL Source

REM Copyright (C) Think Forward.com 1998- 2005. All rights reserved. 
#!/bin/ksh DATABASE=$1 MODE=$2 # Check that we have a database if [ -z "${DATABASE}" ] then echo echo "No Database Specified !" echo echo "Usage : ora_stop.ksh " echo echo "where ORACLE_SID (Mandatory) - SID of database to start" echo " SHUTDOWN MODE - (OPTIONAL, DEFAULT NORMAL) NORMAL,IMMEDIATE,ABORT, TRANSACTIONAL echo echo " e.g. $ dbstop.ksh PROD NORMAL" echo exit 1 fi # Get the ORACLE_HOME from the oratab file ORACLE_HOME=`cat /etc/oratab | grep $DATABASE | awk -F: '{print $2}'` if [ ! -d "${ORACLE_HOME}" ] then echo echo "$ORACLE_HOME does not exist !" echo exit 1 fi ORACLE_SID=$DATABASE export ORACLE_SID PATH=.:$ORACLE_HOME/bin:$PATH; export PATH echo " " echo "Shutting down Database" $DATABASE "in" $MODE "mode" echo " " sqlplus << EOF connect / as sysdba shutdown ${MODE} EOF exit 0

Related Links

Oracle 8: (Shell Script) Database Shutdown

Return to Index of SQL Scripts


Site Map

General Information : Home | Company Profile | Contact Us | Legal
Database Support : Proactive Support | Pay Per Incident Support
Expert Services : High Availability | Creative Solutions | Training
Build Services : Oracle Installations | Revive your Oracle Setup | Low Cost Development
Free Oracle Resources: DBA Scripts | Oracle Links