Auto start
Upcoming SlideShare
Loading in...5
×
 

Auto start

on

  • 44 views

 

Statistics

Views

Total Views
44
Views on SlideShare
44
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Auto start Auto start Document Transcript

    • 11g R2 (11.2.0.2) -- Script to Auto Start/Shutdown databases during reboots.I have a standalone 11 R2 (11.2.0.2) non-ASM database. The following is my script which can auto start/stop database and listener duringsystem reboots. Please note that script reads /etc/oratab file to check which database to start. During startups, any database entry which hasthe "Y" at the end in the /etc/oratab file, will be started and anything which ends with "N", will be skipped.Step 1:Login as root and create a file called /etc/init.d/oracle. Add the following lines in the script.#!/bin/bash######################################################################### Run-level Startup script for the Oracle Instance and Listener## chkconfig: 345 98 34# description: Startup/Shutdown script for 11g Oracle instances################################################################################################################################################# Note:# cp $ORACLE_HOME/bin/dbstart $ORACLE_HOME/bin/dbstart.orig# Make the following changes in $ORACLE_HOME/bin/dbstart## Line#80 has the following:# ORACLE_HOME_LISTNER=$1## Replace it with the following two lines:# export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1# ORACLE_HOME_LISTNER=$ORACLE_HOME## cp $ORACLE_HOME/bin/dbshut $ORACLE_HOME/bin/dbshut.orig# Make the following changes in $ORACLE_HOME/bin/dbshut## Line#50 has the following:# ORACLE_HOME_LISTNER=$1## Replace it with the following two lines:# export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1# ORACLE_HOME_LISTNER=$ORACLE_HOME
    • ## save the file and proceed with the steps below################################################################################################################################################Instructions to start start isntances manually## To Start --> /etc/init.d/oracle start# To Stop --> /etc/init.d/oracle stop# To restrart --> /etc/init.d/oracle restart########################################################################ORA_HM="/u01/app/oracle/product/11.2.0/db_1"ORA_OWNR="oracle"# if the executables do not exist -- display errorif [ ! -f $ORA_HM/bin/dbstart -o ! -d $ORA_HM ]thenecho "Oracle startup: cannot start"exit 1fi# depending on parameter -- startup, shutdown, restart# of the instance and listener or usage displaycase "$1" instart)# starting Oracle instancesecho -n "starting Oracle Instances"su - $ORA_OWNR -c $ORA_HM/bin/dbstarttouch /var/lock/subsys/oracleps -ef |grep pmon |grep -v grepps -ef |grep lsnr |grep -v grepecho "OK";;stop)# Oracle listener and instance shutdownsu - $ORA_OWNR -c $ORA_HM/bin/dbshutrm -f /var/lock/subsys/oracle
    • ps -ef |grep pmon |grep -v grepps -ef |grep lsnr |grep -v grepecho "OK";;reload|restart)$0 stop$0 startps -ef |grep pmon |grep -v grepps -ef |grep lsnr |grep -v grepecho "OK";;*)echo "Usage: $0 start|stop|restart|reload"exit 1esacexit 0clear###################### END of SCRIPT ##############################Step-2:Change the permission of the scriptchmod 750 /etc/init.d/oracleStep-3:Execute the following so that runlevel 3,4 & 5 will execute the script during system reboots.chkconfig --level 345 oracle onStep-4Execute the script and verify everything is working as expected. Alternatively, you candownload the script directory from here.Additionally you can turn on and turn on with the following.[root@bl-mm-db-dev ~]# /sbin/chkconfig oracle off[root@bl-mm-db-dev ~]# /sbin/chkconfig --levels 345 oracle on