Search This Blog

Thursday, October 19, 2006

High CPU Usage Java

Add this variable to opmn.xml file

ias-instance id="j2ee2.asdtbde.idc.oracle.com"
environment
variable id="TMP" value="/tmp"
variable id="LD_ASSUME_KERNEL" value="2.4.1"
variable



Find out the java process using the command
opmnctl status
and not down the PID

opmnctl status

Processes in Instance: j2ee2.asdtbde.idc.oracle.com
-------------------+--------------------+---------+---------
ias-component | process-type | pid | status
-------------------+--------------------+---------+---------
DSA | DSA | N/A | Down
LogLoader | logloaderd | N/A | Down
dcm-daemon | dcm-daemon | N/A | Down
OC4J | home | 28370 | Alive
WebCache | WebCache | 28380 | Alive
WebCache | WebCacheAdmin | 28371 | Alive
HTTP_Server | HTTP_Server | 28373 | Alive

Use this command to find out the actual process ID , In this case the actual java process is ,
28377.

ps -ef | grep 28370
rac 28370 28354 0 11:23 ? 00:00:01 /home/rac/j2ee2/jdk/bin/java
rac 28377 28370 0 11:23 ? 00:00:00 /home/rac/j2ee2/jdk/bin/java

Run the command ,

watch "ps -eLo pid,ppid,tid,pcpu,comm | grep 28377"

Find out the therad ID which taking lot of CPU time ,
i.e it should be there in the first column

Now take the thread dump

kill -3 28370 (process-id-from-opmn-status-output)

Convert the Thread ID you got from the command ,
ps -eLo pid,ppid,tid,pcpu,comm | grep 28377
hexadecimal and then search for this value in the thread dump.

For the JDK 5.0 you do not need to the LD_ASSUME_KERNEL etc.

Please also check the Article

http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_18339

Tuesday, October 10, 2006

SSH Tunneling for DB Connections

This is actually very simple ,

I want to connect to my db "infra2" running on machine asdtbde.idc.oracle.com
with the listner port as say 1521.

To use the connect string as my local machine and port 1621 I need to set the following ,

for example ,

SECURED_SERVER =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1621))
)
(CONNECT_DATA =
(SID = infra2)
)
)

From my local machine run the following from the root user ,

ssh -NfL 1621:localhost:1521 asdtbde.idc.oracle.com
--
output :
ssh -NfL 1621:localhost:1521 asdtbde.idc.oracle.com
The authenticity of host 'asdtbde.idc.oracle.com (152.69.168.61)' can't be established.
RSA key fingerprint is 7b:ee:40:82:f9:7e:1e:24:e9:00:cf:e9:e8:b5:c4:c4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'asdtbde.idc.oracle.com' (RSA) to the list of known hosts.
root@asdtbde.idc.oracle.com's password:
---

Now from the local machine connect using

sqlplus scott/tiger@SECURED_SERVER