Pages

Friday, March 6, 2015

Useful Weblogic Administration related Scripts


Below are the few tiny but useful shell scripts. I will be keep adding new scripts in this particular blog page for various task related to Weblogic Administration.

Configure JAVA_OPTONS for Particular WLS Servers Instance

 

Step1: Go to $DOMAIN_HOME\bin\setDomainEnv.sh



Modify the below shell script snipnet with your environment WLS Server Instance name and paste it inside setDomainEnv.sh file

The location could be anywhere inside setDomainEnv.sh, however I personally prefer after below lines.

 















# Customer Specific script -- BEGIN

if [ "`expr \"$SERVER_NAME\" : \".*AdminServer.*\"`" != "0" ];then
echo "Setting up Custom JAVA_OPTION Parameters for ADMIN SERVER"
JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.MaxMessageSize=50000000 -Xss:512k"
else
echo "Admin Server matching criteria not met, no Custom JAVA_OPTION will be set"
fi

or

In this script, if you notice server name I have mentioned "WLS_WSM", many time its happens like we have multiple SOA, BAM and OWSM server in domain, however if we want to specify JVM option for all WSM server together in one line then we can remove numeric digit from server name. e.g. let says domain contains two OWSM server called WLS_WSM1 and WLS_WLS2 and using below script both OWSM WLS server java option will be set.

if [ "`expr \"$SERVER_NAME\" : \".*WLS_WSM.*\"`" != "0" ];then
echo "Setting up Custom JAVA_OPTION Parameters for OWSM SERVERS"
JAVA_OPTIONS="${JAVA_OPTIONS} -Xms2048m -Xmx2048m -Djava.net.preferIPv4Stack=true -Doracle.net.SDP=true"
else
echo "OWSM SERVERS Server matching criteria not met, no Custom JAVA_OPTION will be set"
fi


Note: In above script change the name of "AdminServer" to your environment specific WLS Instance name. 



Save file and restart Admin Server. 


Step2: Verify the AdminServer.out for new configuration
 

 




=============================================================================

Starting AdminServer via Custom scripts


Whenever we do start of AdminServer we need to do it manually, also at the same time we need to specify .out file location again and again. We can automate this job using below script. 

Below script will start the Admin Server in background using “nohup” command, also it will specify the AdminServer.out location and will show you the PID after restart of Admin Server.

Step1:  go to $Domain_Home\bin

Create a new script file called “vi startAdminServer.sh

Paste the below script lines –

#!/bin/bash
#This script will start the Admin Server and will generate the standard out log at given location
logFileName=AdminServer.out;
logFilePath=/u01/app/oracle/admin/dev_pre_domain/aserver/dev_pre_domain/bin;
nohup ./startWebLogic.sh > $logFilePath/$logFileName 2>&1 &
sleep 5
echo `ps -ef | grep Dweblogic.Name=AdminServer`
echo ""
echo "Standard Out log file path is : $logFilePath/$logFileName";
exit
#EOF


Save the file file using “!wq

Note:  AdminServer.out location can be changed as per your requirement.

Step2: Change the access of this file using command “chmod 755 ./startAdminServer.sh

Step3: run this script “./startAdminServer.sh






No comments:

Post a Comment