Wednesday, July 30, 2014

Scripts to start and stop Oracle Business Intelligence (OBIEE) on Linux

Tested for OBIEE version: 11.1.1.7, and Linux version: OEL 6

Environment variables:

export MW_HOME=/u01/bi/mw_home
export DOMAIN_HOME=$MW_HOME/user_projects/domains/bifoundation_domain
export WL_HOME=$MW_HOME/wlserver_10.3
export ORACLE_INSTANCE=$MW_HOME/instances/instance1
export PATH=$WL_HOME/server/bin:$DOMAIN_HOME/bin:$ORACLE_INSTANCE/bin:$PATH
export ORACLE_HOME=$MW_HOME/Oracle_BI1

The scripts asks username and password for weblogic while starting/stopping. We can store them in below files so they will not be asked.
$DOMAIN_HOME/servers/AdminServer/security/boot.properties
$DOMAIN_HOME/servers/bi_server1/security/boot.properties

Contents to add in the above mentioned files:

username=weblogic
password=xxxxx

Though we are storing passwords in clear text, they will be encrypted automatically after weblogic started.

Start script:

 
export MW_HOME=/u01/bi/mw_home
export DOMAIN_HOME=$MW_HOME/user_projects/domains/bifoundation_domain
export WL_HOME=$MW_HOME/wlserver_10.3
export ORACLE_INSTANCE=$MW_HOME/instances/instance1
export PATH=$WL_HOME/server/bin:$DOMAIN_HOME/bin:$ORACLE_INSTANCE/bin:$PATH
export BI_LOG_DIR=/u01/bi/logdir
export ORACLE_HOME=$MW_HOME/Oracle_BI1

#################################################################
date

echo "Starting Weblogic"

nohup sh $DOMAIN_HOME/bin/startWebLogic.sh >> $BI_LOG_DIR/wls_start.log &
echo "Log: $BI_LOG_DIR/wls_start.log"

c=0
msg="<Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>"

while [ $c -eq 0 ]
do
 sleep 1
 c=`tail -1 $BI_LOG_DIR/wls_start.log | grep "$msg"  | wc -l`
done

echo "Weblogic started"

#################################################################
date 

echo "Starting Node manager"

nohup sh  $WL_HOME/server/bin/startNodeManager.sh >> $BI_LOG_DIR/startNodeManager.log &
echo "Log: $BI_LOG_DIR/startNodeManager.log"

c=0
msg="INFO: Secure socket listener started on port"

while [ $c -eq 0 ]
do
 sleep 1
 c=`tail -1 $BI_LOG_DIR/startNodeManager.log | grep "$msg"  | wc -l`
done

echo "Node manager started"

#################################################################
date

echo "Starting Managed server"

nohup sh $DOMAIN_HOME/bin/startManagedWebLogic.sh bi_server1 >> $BI_LOG_DIR/start_bi_server1.log &
echo "Log: $BI_LOG_DIR/start_bi_server1.log"

c=0
msg="<Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>"

while [ $c -eq 0 ]
do
 sleep 1
 c=`tail -1 $BI_LOG_DIR/start_bi_server1.log | grep "$msg"  | wc -l`
done

echo "Managed server started"

#################################################################
date

echo "Starting OPMN"

$ORACLE_INSTANCE/bin/opmnctl startall
opmnctl status

echo "OPMN started"

#################################################################

Stop script:


export MW_HOME=/u01/bi/mw_home
export DOMAIN_HOME=$MW_HOME/user_projects/domains/bifoundation_domain
export WL_HOME=$MW_HOME/wlserver_10.3
export ORACLE_INSTANCE=$MW_HOME/instances/instance1
export PATH=$WL_HOME/server/bin:$DOMAIN_HOME/bin:$ORACLE_INSTANCE/bin:$PATH
export BI_LOG_DIR=/u01/bi/logdir
export ORACLE_HOME=/u01/bi/mw_home/Oracle_BI1

$ORACLE_INSTANCE/bin/opmnctl stopall
$DOMAIN_HOME/bin/stopManagedWebLogic.sh bi_server1 
$DOMAIN_HOME/bin/stopWebLogic.sh 

ps -ef | grep weblogic.NodeManager | grep -v grep

p=`ps -ef | grep weblogic.NodeManager | grep -v grep | tr -s ' ' |  cut -f 2 -d ' '`


if [ -n "$p" ] 
then
 echo "Killing pid $p"
 kill -9 $p
fi