Wednesday, February 8, 2012

Purge/Delete AQ Messages

Manual deletion of AQ message leads to various problem error such as " A resource exception occurred while waiting for inbound messages", it's always advisable to use scripts to delete the AQ messages.


Below script deletes the messages from Queue table.

DECLARE
po dbms_aqadm.aq$_purge_options_t;
BEGIN
po.block := FALSE;
DBMS_AQADM.PURGE_QUEUE_TABLE(
queue_table => 'AIA_SALESORDERJMSQTAB',
purge_condition => NULL,
purge_options => po);
END;

Tuesday, February 7, 2012

How to increase heap size in 64 bit machine OC4J Container?

In 64 bit machine you can increase the heap size to about 2^64. To increase the heap size in 64 bit JVM, the processor and operating system should also have 64 bit type to support almost unlimited heap size.

Note: The heap size should be kept at optimum size, even though it supports huge allocation. Performance will be degraded if you allocate more heap. Its better to use half the size of RAM as your heap size.

How to determine the maximum heap that can be allocated for your JVM?

Use the command "java -d64 -mx10g -version", if your JVM supports 64 bit you will get the jdk version otherwise you will get "Unrecognized option: -d64" message.

$ java -d64 -mx15g -version
java version "1.5.0.16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0.16-_09_mar_2009_04_02)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0.16 jinteg:03.09.09-12:27 IA64W, mixed mode)

$ java -d64 -mx1024g -version
java version "1.5.0.16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0.16-_09_mar_2009_04_02)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0.16 jinteg:03.09.09-12:27 IA64W, mixed mode)

How to change the heap size in OC4J container?

Take a backup of opmn.xml and edit the opmn.xml at location $ORACLE_HOME/opmn/conf.

Edit the startParameters of your container and add "-d64 -ms10g -mx10g" in value of 'java-options' to increase the heap size to 10GB

<category id="start-parameters">
<data id="java-options" value="-server -d64 -ms10g -mx10g -XX:MaxPermSize=512M -XX:AppendRatio=3 -Djava.security.policy=$ORACLE_HOME/j2ee/oc4j_soa/config/java2.policy -Djava.awt.headless=true -Dhttp.webdir.enable=false -Doraesb.home=$ORACLE_HOME/integration/esb -Dhttp.proxySet=false -Doc4j.userThreads=true -Doracle.mdb.fastUndeploy=60 -Doc4j.formauth.redirect=true -Djava.net.preferIPv4Stack=true -Dorabpel.home=$ORACLE_HOME/bpel -Xbootclasspath^/p:$ORACLE_HOME/bpel/lib/orabpel-boot.jar -Dhttp.proxySet=false -XX:MaxNewSize=614m -XX:NewSize=614m -XX:SurvivorRatio=6 -Daia.home=$AIA_HOME/AIA -Dbpel.delivery.operationNameCheck=true -Dbpel.dms=false" />
</category>

How to increase heap size in 32 bit machine OC4J Container?

java.lang.OutOfMemoryError occurs after complete utilization of heap memory.

In 32bit machine you can increase the heap approximately to 2GB. This also varies depending on various parameters like the size of RAM, Operating System etc.,

Generally in Windows machine half the RAM capacity will be used by the System and remaining by the applications. Configuration can be changed to reduce the system memory usage in Windows machine.

How to determine the maximum heap that can be allocated for your JVM?

Use the command "java -mx2048m -version", if your JVM supports given memory size you will get the JDK version message otherwise you will receive Invalid maximum heap size message.

$ java -mx3072m -version
java version "1.6.0.06"
Java(TM) SE Runtime Environment (build 1.6.0.06-jinteg_20_jan_2010_05_50-b00)
Java HotSpot(TM) Server VM (build 14.3-b01-jre1.6.0.06-rc1, mixed mode)


$ java -mx4096m -version
Invalid maximum heap size: -Xmx4096m
The specified size exceeds the maximum representable size.
Could not create the Java virtual machine.


How to change the heap size in OC4J container?

Take a backup of opmn.xml and edit the opmn.xml at location $ORACLE_HOME/opmn/conf.

Edit the startParameters of your container and add "-ms3072M -mx3072M" in value of 'java-options' to increase the heap size to 3GB

<category id="start-parameters">
<data id="java-options" value="-server -ms3072M -mx3072M -XX:MaxPermSize=512M -XX:AppendRatio=3 -Djava.security.policy=$ORACLE_HOME/j2ee/oc4j_soa/config/java2.policy -Djava.awt.headless=true -Dhttp.webdir.enable=false -Doraesb.home=$ORACLE_HOME/integration/esb -Dhttp.proxySet=false -Doc4j.userThreads=true -Doracle.mdb.fastUndeploy=60 -Doc4j.formauth.redirect=t
rue -Djava.net.preferIPv4Stack=true -Dorabpel.home=$ORACLE_HOME/bpel -Xbootclasspath^/p:$ORACLE_HOME/bpel/lib/orabpel-boot.jar -Dhttp.proxySet=false -XX:MaxNewSize=614m -XX:NewSize=614m -XX:SurvivorRatio=6 -Daia.home=$AIA_HOME/AIA -Dbpel.delivery.operationNameCheck=true -Dbpel.dms=false" />
</category>

Monday, February 6, 2012

OC4J Container log file rotation

default_group~<CONTAINER_NAME>_soa~default_group~1.log is created by JVM to print the output to console. This log file cannot be enabled for log file rotation using em console or configuration file.

Please follow below instruction to enable log file rotation.

1) Shutdown the server

2) Take back up of $ORACLE_HOME/opmn/conf/opmn.xml

3) Add "-Dstdstream.filesize=10" parameter to java-options of your container "start-parameters". 10 denotes the log file rotation size, after log file reaches 10MB new log file will be created.

4) Add "oc4j-options" data element, "<data id="oc4j-options" value="-out $ORACLE_HOME/opmn/logs/oc4j_soa.out -err $ORACLE_HOME/opmn/logs/oc4j_soa.err"/>"

5) Start the server

<data id="java-options" value="-server -mx1024M -ms1024M -XX:MaxPermSize=512M -XX:AppendRatio=3 -Djava.security.policy=$ORACLE_HOME/j2ee/oc4j_soa/config/java2.policy -Djava.awt.headless=true -Dhttp.webdir.enable=false -Doraesb.home=$ORACLE_HOME/integration/esb -Dhttp.proxySet=false -Doc4j.userThreads=true -Doracle.mdb.fastUndeploy=60 -Doc4j.formauth.redirect=true -Djava.net.preferIPv4Stack=true -Dorabpel.home=$ORACLE_HOME/bpel -Xbootclasspath^/p:$ORACLE_HOME/bpel/lib/orabpel-boot.jar -Dhttp.proxySet=false -XX:MaxNewSize=614m -XX:NewSize=614m -XX:SurvivorRatio=6 -Daia.home=$AIA_HOME/AIA -Dbpel.delivery.operationNameCheck=true -Dbpel.dms=false -Dstdstream.filesize=10"/>

<data id="oc4j-options" value="-out $ORACLE_HOME/opmn/logs/oc4j_soa.out -err $ORACLE_HOME/opmn/logs/oc4j_soa.err"/>


Note: After changes log file will be created in the below location.
$ORACLE_HOME/opmn/logs/oc4j_soa_default_group_1/oc4j_soa_2012_02_06_18_41_30.out
$ORACLE_HOME/opmn/logs/oc4j_soa_default_group_1/oc4j_soa_2012_02_06_18_41_31.err

Tip: If you want to create only one log file then point the out and err stream to the same file as '<data id="oc4j-options" value="-out $ORACLE_HOME/opmn/logs/oc4j_soa.out -err $ORACLE_HOME/opmn/logs/oc4j_soa.out"/>'