Tuesday, December 27, 2011

configure/Enable JDBC profiler

Hi Everyone,

Today we will discuss about one of diagnostic module which help us in diagnosing issues JDBC profiler is one of them.

I have come across the issue of increasing inactive session issues on Database level with weblogic server, we have found on DB level that all inactive connections are from weblogic server.
It gives SQL query as select * from dual. ( we have weblogic server in host level cluster mode with Oracle RAC 11g)

We have discussed with oracle support for the same, they suggest us to enable JDBC profiler in weblogic Node1 and Node2.

Following are the steps to configure/Enable JDBC profiler :


Step 1: Click on Diagnostics-->Diagnostic Modules

Step 2: Click on new and provide name of the module. for e.g ProfilerModule

Step 3: Once Module-0 is created. Click on it. It'll lead you to configuration tab of ProfilerModule.

Step 4: Click on Collected Matrics tab. Check Enabled check box. Here you've to define sampling period. In our case it should be 10 mins.(This value is specified in milliseconds). and click on new to create a new matrics.

Step 5: Choose server location Server Runtime and click next.

Step 6: Select mbean type as
weblogic.management.runtime.JDBCConnectionPoolRuntimeMBean and click next.

Step 7: Move all available collected attributes into chosen field by clicking on >> and click next.

Step 8: Move available instance to the chosen field.an click on finish.

Step 9: Click on targets tab. and deploy this diagnostic module to the specified server.

After configuring/ enabling JDBC profiler, we get logs in weblogic console under 
Diagnostics > log files > Managed_server log.

To Disable the profiler we just need to change Weblogic Server Targets to none or delete Diagnostic module which we have created.

I hope it will helps you in troubleshooting issues, we can create modules for different MBeans.

Enjoy working with Middleware Technologies.

Regards,
Ajinkya Vichare

ajinkya-vichare.blogspot.com

Saturday, December 3, 2011

Run Force Garbage Collector using WLST in Weblogic Server.


Hi Everyone,

Today we will talk about how to collect Garbage Collection (GC) forcefully with WLST.

At the time of month end, my server utilization was too high, and we all know that many times JVM misbehaves, and we may have to do force GC too freed up unused memory. So i tried from console, it works for me. But after goggling and talking to all my seniors, I have got an idea about WLST scripting.
  
The Script:

Step 1. Open a text editor and Copy – paste the text given below into the editor.

# WLST script which calls GC.
from java.util import *
from javax.management import *
import javax.management.Attribute
print 'starting the script .... '
#Script by Ajinkya
# please replace userid and password with your AdminServer userid and password
# plz change the IP adresss and port number accordingly
connect('userid','password',url='t3://localhost:7001')
state('AdminServer')
# For Force GC ....
domainRuntime()
cd('/ServerRuntimes/AdminServer/JVMRuntime/AdminServer')
print ' Performing Force GC...'
cmo.runGC()
disconnect()
print 'End of script ...'
exit()



Step 2. Save the file as ‘RunForceGC.py’

Step 3. Open a new command window à Run ‘setDomainEnv.cmd/.sh’ localted in the ‘domain\bin’ directory

Step 4. Run the python script using WLST.


java weblogic.WLST RunForceGC.py



Following result will display after running above script :


G:\Oracle\Middleware\user_projects\domains>java weblogic.WLST RunForceGC.py.txt

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

starting the script ....
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'bas
e_domain'.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

Current state of 'AdminServer' : RUNNING
Location changed to domainRuntime tree. This is a read-only tree with DomainMBea
n as the root.
For more help, use help(domainRuntime)

 Performing Force GC...
Disconnected from weblogic server: AdminServer
End of script ...


Exiting WebLogic Scripting Tool.


G:\Oracle\Middleware\user_projects\domains>



 
Step 5. This should have freed up some memory on your server.

Step 6. The above script runs ‘GC’ on ‘AdminServer’ to run the script of managed server replace the ‘AdminServer’ from the script with the name of the ‘Managed Server’.

Hope this helps :)

And Enjoy Working With Middleware.

Regards,
Ajinkya Vichare

http://ajinkya-vichare.blogspot.com