We have
1> IAS server
2> Infra server , which has database server
Scripts files in IAS server are
startIas
stopIas
and script file to setup the env named as “setIas.env”
the file contents are a
“setIas.env”
export ORACLE_HOME=/opt1/oracle/ias2
export DISPLAY=:0.0
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
“startIas”
#Script used for starting up iAS instance
#set oracle iAS environment
. /home/oracle/setIas.env
#Start all opmn managed processes
$ORACLE_HOME/opmn/bin/opmnctl startall
#Start enterprise manager
$ORACLE_HOME/bin/emctl start iasconsole
#Print startup completed message
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~”
echo “ ( iAS startup completed )”
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~”
“stopIas”
#Stop all opmn managed processes
$ORACLE_HOME/opmn/bin/opmnctl stopall
#Prints number of ias proceses still running
ias_processes=`ps -fe|grep oracle|grep ias|grep -v grep|wc|awk ‘{print $”1″}’`
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~~~”
echo “ ( $ias_processes ias processes running )”
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~~~”
if [ ${ias_processes} = 0 ] ; then
#Print shutdown completed message
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~~”
echo “ ( ias shutdown completed )”
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~~”
# command to kill all ias processes
# ps -fe|grep oracle|grep ias|grep -v grep|awk ‘{print $”2″}’|xargs kill -9
fi
###########
In INfra server we have database running , there are scripts to startDatabase , stopdatabase, startInfra , stopInfra and the env settings
startInfra
the scripts contents are as follows
“setDB.env”
export ORACLE_HOME=/opt1/oracle/oraDb
export ORACLE_SID=orclho
export PATH=$ORACLE_HOME/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/oracle/bin
“setInfra.env”
export ORACLE_HOME=/opt1/oracle/infra2
“startDB”
. setDB.env
$ORACLE_HOME/bin/sqlplus “/ as sysdba” @/home/oracle/startup
$ORACLE_HOME/bin/lsnrctl start
#Print startup completed message
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~”
echo “ ( database startup completed )”
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~”
“stopDB”
. setDB.env
$ORACLE_HOME/bin/lsnrctl stop
sqlplus “/ as sysdba” @/home/oracle/shutdown
#Print shutdown completed message
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~”
echo “ ( database shutdown completed )”
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~”
“startInfra”
#Script used for starting up infrastructure and database
#Call the database startup script
#sh startDB
#set oracle Infrastructure environment
. setInfra.env
#Start all opmn managed processes
$ORACLE_HOME/opmn/bin/opmnctl startall
#Start enterprise manager
$ORACLE_HOME/bin/emctl start iasconsole
#Print startup completed message
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~~~”
echo “ ( infra startup completed )”
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~~~”
stopInfra
#Script used for shutting down infrastructure and database
#Note: If some infrastructure processes did not die properly, this script will
# wait 5 seconds and check again. Sometimes it may be necessary
# to kill the infrastructure process manually!
#set oracle Infrastructure environment
. setInfra.env
#Stop enterprise manager
$ORACLE_HOME/bin/emctl stop iasconsole
#Stop all opmn managed processes
$ORACLE_HOME/opmn/bin/opmnctl stopall
#Check if all Infra processes have been stopped
#If not wait for 5 seconds and check again
infra_processes=`ps -fe|grep oracle|grep infra|grep -v grep|wc|awk ‘{print $”1″}’`
#Print running processes
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~”
echo “ ( $infra_processes infra processes running )”
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~”
while [ ${infra_processes} != 0 ]
do
echo “sleeping for 5 seconds”
sleep 5
infra_processes=`ps -fe|grep oracle|grep infra|grep -v grep|wc|awk ‘{print $”1″}’`
done
#Print shutdown completed message
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~~~~”
echo “ ( infra shutdown completed )”
echo “ ~~~~~~~~~~~~~~~~~~~~~~~~~~~”
#Call the database shutdown script
#sh stopDB
Tags: DataBase, linux, Oracle, Scripts, systemadmin