Sunday, October 24, 2010

Oracle Enterprise Manager perl Syntax

We needed to enable metric "Log File Pattern Matched Line Count" from OEM.
We were looking for java.lang.OutOfMemory string within our weblogic log file.
As first time user, I went ahead and added the string name and really did not care to check the "Ignore Pattern in Perl" that had "%" by default.

This was telling the EM to ignore virtually everything and no wonder we did not receive alerts.
The right to look for a string "java.lang.OutOfMemoryError" was:

Tuesday, October 19, 2010

Jrockit JRCMD

If you are one of those shops where remote access from JRMC (Jrockit Management Console) is not possible, jrcmd comes to rescue.
All we need is access through SSH.
This came in real handy for our environments where remote access is not allowed.

$ ./Jrockit_home/bin/jrcmd PID heap_diagnostics
This would print heap summary, Memory layout (similar to pmap in solaris) and details object statistics

If you are new to Jrockit and familiar with other JVM tools like Jhat or MAT,and would need to do an offline analysis, then a heap dump can be generated in HPROF format.

$ ./Jrockit_home/bin/jrcmd PID hprofdump filename=heapdump.hprof
(heapdump.hprof is created from JVM process spawning directory. For weblogic it will be under domain directory - assuming startscript is triggred from there)
This hprof can be further analyzed with tools like jhat or MAT (Eclipse Memory analyzer tool).
MAT would provide all sorts of info from leak suspects to Accumulated Objects by Class as shown above.

Another neat feature from JRMD is baselining the heap and native memory.
$./Jrockit_home/bin/jrcmd PID print_memusage scale=M baseline
This prints base line of memory usage (both java and native heap) something like:

Subsequent runs of same command would baseline to first snapshot and shows the added java & native heaps.