Friday, November 14, 2014

WLST: Resume/Start all the Datasources

dbresume.py

A wlst script to suspend/start all the weblogic  datasources at one shot, can be used as healthcheck tool also



import re
print  "Enter Admin username used for logging into admin console (ex)ohsadmin"
username = raw_input("Enter username: ").strip()
print  "Enter Adminstrator password"
pwd = raw_input("Enter password: ").strip()
print  "Enter Admin server t3 url format t3://adminhost:adminport (ex)  t3://datahost.com:7001"

url = raw_input("Enter url : ").strip()

connect(username, pwd,url)
p=re.compile('Warning.*')
allServers=domainRuntimeService.getServerRuntimes();
if (len(allServers) > 0):
  for tempServer in allServers:
    jdbcServiceRT = tempServer.getJDBCServiceRuntime();
    dataSources = jdbcServiceRT.getJDBCDataSourceRuntimeMBeans();
    if (len(dataSources) > 0):
      for dataSource in dataSources:
        result=dataSource.testPool()
        m=p.match(str(result))
        if m or str(result)=='None':
          print 'The DS Name and state is '+dataSource.getName()+':Running'
        elif m or 'Suspended' in str(result):
          print 'The DS Name and state is '+dataSource.getName()+':Suspended , will be Resumed '
          dataSource.resume();
        elif m or 'not active' in str(result):
          print 'The DS Name and state is '+dataSource.getName()+':Shutdown, will be started'
          dataSource.start();
        else:
          print 'The DS Name and state is '+dataSource.getName()+':'+str(result).strip()
disconnect()
exit()

Tuesday, December 4, 2012

GREP logs

When you want to scan logs in unix , you want to see the all the entries starting plus another 5 lines before and after

grep command 

 grep "" AdminServer.log -A 5 -B 5

Sunday, July 22, 2012

WLS 11 Apache Plugin


Installing Apache Webserver in Oracle Enterprise Linux 5 as reverse proxy  to Weblogic Domain

 OEL Prerequisite : please make sure you have this packages else the apache build will fail


 rpm -ivh gcc-4.1.2-50.el5.x86_64.rpm glibc-devel-2.5-58.x86_64.rpm  glibc-headers-2.5-
58.x86_64.rpm  kernel-headers-2.6.18-238.el5.x86_64.rpm
libstdc++-devel-4.1.2-50.el5.x86_64.rpm     gcc-c++-4.1.2-50.el5.x86_64.rpm
they are part of the OS media

Apache Server

1.      Download the apache source code and Weblogic plugin to /home/oracle/apache

http://httpd.apache.org/download.cgi#apache22

2.      mkdir -p /u01/app/apache/product  
                           
3.      cd /home/oracle/apache/

4.      tar -xf  httpd-2.2.22.tar

5.      cd httpd-2.2.22

6.      ./configure --prefix=/u01/app/apache/product  --enable-module=so

7.      make install

8.      make

Weblogic Plugin

plugin can be downloaded from http://www.oracle.com/technetwork/middleware/ias/downloads/wls-plugins-096117.html, I assume you have weblogic domain ready.

1.      cd /home/oracle/apache

2.      mkdir plugin

3.      unzip WLSPlugin11g-64bit-Apache2.2-linux64-x86_64.zip -d plugin

4.      cp  plugin/lib/mod_wl.so /u01/app/apache/product/lib/

5.      cd  /u01/app/apache/product/conf

6.      vi httpd.conf add entries specific to each domain
 
#load module
LoadModule weblogic_module   product\lib\mod_wl_20.so
#tag for plugin

  WebLogicHost myweblogic.server.com
  WebLogicPort 7001 
vide http://docs.oracle.com/cd/E15051_01/wls/docs103/plugins/apache.html#wp131399
7.      start the apache instance  #apachectl start  (script available in the bin directory of apache)




Monday, July 16, 2012

SOA Tuning

Some of my favorite  MOS( http://support.oracle.com) knowledge ids for SOA tuning

EM Console
=========
1423893.1 enable caching .


SOA
====
1341180.1  design/configuration tuning 

Database/Dehydration 
================
 1372928.1

JVM
====
1358719.1

Opatch

Quick start guide to Opatch for FMW 11g

    OPatch


Readme files from the downloaded archives needs to be reviewed for every fix since they are unique in each case steps below are  generic but not guaranteed for every fix .

1.      Set the oracle home
export ORACLE_HOME=/u01/app/oracle/product/fmw/Oracle_SOA1
2.      Add opatch bin directory to path
export PATH=$ORACLE_HOME/OPatch:$PATH
3.      Run opatch lsinventory to make sure you have the environment variables correct
# opatch lsinventory

4.      Download the fix from MOS site
Log in using MOS credentials and select the Patches & Updates tab, provide the fix number and download the update.
5.      Unzip the patch zip file into the PATCH_TOP.
   $unzip -d PATCH_TOP p11853131_111160_Generic.zip
6.      Set your current directory to the directory where the patch is located.
   $cd PATCH_TOP/11853131
7.       Run OPatch to apply the patch. Run following command:
   $opatch apply
8.      Restart the server instances
Rollback Procedure  
9.      Change to the directory where the patch was unzipped.
 $cd PATCH_TOP/11853131
10.  Run OPatch to deinstall the patch.
   $opatch rollback -id 11853131 

Thursday, May 31, 2012

stopNodeManager.sh


here is a stop script that can be helpful when you have multiple node managers running in a machine

first edit your startNodeManager.sh to give a name for your server by a -D flag, I have it as  TSTNM

JAVA_OPTIONS="-Dbea.home=${BEA_HOME} -DTSTNM  ${JAVA_OPTIONS}"

 next create below ssh file,  location doesn't matter I would put under nodemanager home to avoid confusion. Invoking  ./stopNodeManager.sh   should stop your nm

stopNodeManager.sh


#!/bin/sh
#
function ConfirmOrExit() {
while true
do
echo -n "Please confirm (y or n) :"
read CONFIRM
case $CONFIRM in
y|Y|YES|yes|Yes) break ;;
n|N|no|NO|No)
echo NM stop not attemped since  - you entered $CONFIRM
exit
;;
*) echo Please enter only y or n
esac
done
}
PID=`ps -ef | grep TSTNM | grep -v grep | awk '{print $2}'`
if [ "$PID" == "" ]; then
        echo "TSTNM is inactive!"
else
        echo -e Terminate TSTNM with PID: $PID..
        ConfirmOrExit
        kill -9 $PID
        echo -e Terminated TSTNM with PID: $PID..
fi



Monday, May 21, 2012

Oracle FMW Sailor, if you have any issues feel free to tweet for help