How to Automate the restart of Oracle EBS WebLogic Managed OAcore & OAfm servers using Shell Script
Below shell script is used for restarting the Oracle EBS WebLogic Managed OAcore & OAfm servers. You can run shell script or you can scheduled in CRONTAB to restart the servers on every night
#! /bin/ksh
. /erp_apps/oracle/app/EBSapps.env RUN
#This script is used for restarting the Oracle EBS Weblogic Managed OAcore & OAfm servers.You can run shell script using CRONTAB
#-------------------------------------------------------------------
# Mail list is used to email the list of users once the restart is done
#Maillist="sender_emailid receipt_email_id"
# Mail file is the file which will get emailed to the mail list users
#Mailfile= "Daily_OACore_OAfm_Stop_Start.log"
#This is the temporary log file where daily restart result will be stored
> $HOME/dba/log/Daily_OACore_OAfm_Stop_Start.log
# Stopping the OAcore & OAfm Servers
echo "Stopping Oracle EBS Weblogic Managed OAcore & OAfm on $HOSTNAME Servers"
#{ echo $APPSUSER ; echo $APPSPASS ; echo $WLSADMIN ; }| adstrtal.sh @-nopromptmsg
WLSADMIN=**********(password of WebLogic console)
echo $WLSADMIN|$ADMIN_SCRIPTS_HOME/admanagedsrvctl.sh stopall oacore -nopromptmsg >> $HOME/dba/log/Daily_OACore_OAfm_Stop_Start.log 2>& 1
echo $WLSADMIN|$ADMIN_SCRIPTS_HOME/admanagedsrvctl.sh stopall oafm -nopromptmsg >> $HOME/dba/log/Daily_OACore_OAfm_Stop_Start.log 2>& 1
sleep 90
echo "Oracle EBS Weblogic Managed OAcore & OAfm on $HOSTNAME servers are stopped successfully"
# Starting the Server
echo "Trying to start Oracle EBS Weblogic managed OAcore & OAfm on $HOSTNAME servers"
echo $WLSADMIN|$ADMIN_SCRIPTS_HOME/admanagedsrvctl.sh startall oacore -nopromptmsg >> $HOME/dba/log/Daily_OACore_OAfm_Stop_Start.log 2>& 1
echo $WLSADMIN|$ADMIN_SCRIPTS_HOME/admanagedsrvctl.sh startall oafm -nopromptmsg >> $HOME/dba/log/Daily_OACore_OAfm_Stop_Start.log 2>& 1
sleep 90
echo "Oracle EBS Weblogic managed OAcore & OAfm on $HOSTNAME servers are started successfully"
/usr/bin/mailx -s "Oracle EBS OAcore & OAfm Daily Restart-$HOSTNAME" -r sender_emailid@nizamappsdba.blogspot.com receipt_email_id@nizamappsdba.blogspot.com < $HOME/dba/log/Daily_OACore_OAfm_Stop_Start.log
echo "Checking the port blocking 12353"
# Checking the Port Blocking for 12353 for all OAcore and OAfm managed servers, listing here the servers logs out file if any port block with 12353
x=$(find $EBS_DOMAIN_HOME -name *server*.out -type f -exec grep -l "The Distributed Caching System failed to initialize on port: 12353" {} +)
echo $x > $HOME/dba/log/Port_Block_12353.log
if [[ -n "$x" ]]
then
/usr/bin/mailx -s "The Distributed Caching System failed to initialize on port: 12353 - Please check servers" -r sender_emailid@nizamappsdba.blogspot.com receipt_email_id@nizamappsdba.blogspot.com < $HOME/dba/log/Port_Block_12353.log
fi
echo "Completed the script"
exit