Monday, June 27, 2011

How to find out Oracle AIA Patches applied on the server

1. Make sure Oracle Standalone Interim Patch Installer version is equal or greater than 11.1.0.0.0
[oracle@soaserver ~]$ opatch version
Invoking Standalone OPatch 11.1.0.0.0
OPatch Version: 11.1.0.0.0
OPatch succeeded.

2. Set ORACLE_HOME variable to point to your AIA_HOME
[oracle@soaserver ~]$export ORACLE_HOME=/oracle/aia
(Where /oracle/aia is the location of AIA directory on my soaserver)

3. Set SOA_HOME varaible to point to your SOA Home
[oracle@soaserver ~]$export SOA_HOME=/oracle/orasoa

(Where /oracle/orasoa is the location of SOA directory on my soaserver)

4.Set AIA_HOME variable to point to your AIA_HOME
[oracle@soaserver ~]$export AIA_HOME=/oracle/aia

5. Use opatch lsinventory to find out the AIA Patches
[oracle@soaserver ~]$opatch lsinventory -invPtrLoc $SOA_HOME/oraInst.loc -oh $AIA_HOME -jre $SOA_HOME/jdk/jre

Sunday, June 19, 2011

JAVA API to Turn a BPEL Process ON/OFF

import java.util.Map;
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.Context;
import com.oracle.bpel.client.Locator;
import com.oracle.bpel.client.ServerException;
import org.apache.xml.resolver.helpers.PublicId;

import com.oracle.bpel.client.IBPELProcessConstants;
import com.oracle.bpel.client.IBPELProcessHandle;
import com.oracle.bpel.client.BPELProcessId;
import com.oracle.bpel.client.IService;


public class ProcessManager {

private Locator locator;

public ProcessManager() {
/*
connect to a BPEL server
*/
String jndiFactory = "com.evermind.server.rmi.RMIInitialContextFactory";
String jndiUsername = "oc4jadmin";
String jndiPassword = "soaserver1";
String jndiProviderUrl = "opmn:ormi://soaserver:6003:oc4j_soa/orabpel";
Hashtable jndi = new Hashtable();
jndi.put(Context.PROVIDER_URL, jndiProviderUrl);
jndi.put(Context.INITIAL_CONTEXT_FACTORY, jndiFactory);
jndi.put(Context.SECURITY_PRINCIPAL, jndiUsername);
jndi.put(Context.SECURITY_CREDENTIALS, jndiPassword);
try {
locator = new Locator("default", jndi);
}
catch(Exception e) {
e.printStackTrace();
}
}

public static void main(String[] args) {
try{
ProcessManager pm = new ProcessManager();
pm.TurnOffProcess();
}catch(Exception e)
{
e.printStackTrace();
}
}
public void TurnOnProcess() throws ServerException{
IBPELProcessHandle pmhandler = locator.lookupProcess("ProcessSalesOrderSiebelJMSConsumer");
com.oracle.bpel.client.BPELProcessMetaData BPMD = pmhandler.getMetaData();
BPMD.setState(IBPELProcessConstants.STATE_ON);
pmhandler.updateMetaData(BPMD);
System.out.println("ProcessSalesOrderSiebelJMSConsumer BPEL Process is turned ON");
}

public void TurnOffProcess() throws ServerException {
IBPELProcessHandle pmhandler = locator.lookupProcess("ProcessSalesOrderSiebelJMSConsumer");
com.oracle.bpel.client.BPELProcessMetaData BPMD = pmhandler.getMetaData();
BPMD.setState(IBPELProcessConstants.STATE_OFF);
pmhandler.updateMetaData(BPMD);
System.out.println("ProcessSalesOrderSiebelJMSConsumer BPEL Process is turned OFF");
}
}

Saturday, June 11, 2011

9318256 - PLACEHOLDER BUG OF EHROLLUP FOR 2.5 (2.0 & 2.0.1 SPECIFIC)

1.1 Patch Pre-installation instructions

1. Patch 9318256 is Merge patch for patch no. 9361469 and patch no. 8934996.

2. Backup environments. (Application Server and DB)

3. If it’s a cluster environment then this patch needs to be applied on the all the nodes separately.

Only the node on which this patch is currently being applied should be UP. Rest of the nodes should be down.

4. set AIA_HOME environment variable.
export AIA_HOME=/oracle/aia

5. Open deploy.properties in edit mode
vi /oracle/aia/config/deploy.properties

6. Add the following two lines in the deploy.properties
deployer.uri=deployer:oc4j:opmn://${http.hostname}:${opmn.port}/${iasinstancename}/${oc4jinstancename}
dburl=jdbc:oracle:thin:@${db.hostname}:${db.port}:${SID}

7. Save the file.

1.2 Patch Installation Instructions

1. Please make sure you have the standalone OPATCH that's available from metalink via patch 5912518.
[oracle@TEST1AIA01 orasoa]$ opatch version
Invoking Standalone OPatch 11.1.0.0.0
OPatch Version: 11.1.0.0.0
OPatch succeeded.

2. Please make sure that Opatch Directory is in your PATH.

3. To apply the patch, unzip the PSE zip file:
unzip p9318256_201_GENERIC.zip

4. Set your current directory to where the patch is located:
[oracle@TEST1AIA01 9318256]$ pwd
/stage/191010-SR/9318256

5. Set the following two environment variable ORACLE_HOME(should point AIA_HOME),SOA_HOME(should point SOA Home)
[oracle@TEST1AIA01 9318256]$ export ORACLE_HOME=/oracle/aia
[oracle@TEST1AIA01 9318256]$ export SOA_HOME=/oracle/orasoa

6. on Linux:
# : opatch apply -invPtrLoc $SOA_HOME/oraInst.loc -oh $AIA_HOME -jre $SOA_HOME/jdk/jre
[oracle@test1aia01 9318256]$ opatch apply -invPtrLoc $SOA_HOME/oraInst.loc -oh $AIA_HOME -jre $SOA_HOME/jdk/jre
Invoking Standalone OPatch 11.1.0.0.0
Oracle Standalone Interim Patch Installer version 11.1.0.0.0
Copyright (c) 2007, Oracle Corporation. All rights reserved.
Oracle Home : /media/hda2/oracle/aia
Oracle Home Inventory : /media/hda2/oracle/aia/sainventory
OPatch version : 11.1.0.0.0
Product information : /media/hda2/oracle/aia/product.xml
Log file location : /media/hda2/oracle/aia/cfgtoollogs/opatch/opatch2011-01-06_19-54-47PM.log
ApplySession applying interim patch '9318256' to OH '/media/hda2/oracle/aia'
Interim Patch 9318256 has Conflict with patch(es) [ 9361469 ] in OH /media/hda2/oracle/aia
Conflict patches: 9361469
Patch(es) 9361469 conflict with the patch currently being installed (9318256).
If you continue, patch(es) 9361469 will be rolled back and the new patch (9318256) will be installed.
If a merge of the new patch (9318256) and the conflicting patch(es) ( 9361469) is required, contact Oracle Support Services and request a Merged patch.
Do you want to proceed? [y
n]
User Responded with: Y
Running prerequisite checks...
OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.
Backing up files and inventory (not for auto-rollback) for the Oracle Home
Backing up files affected by the patch '9361469' for restore. This might take a while...
ApplySession rolling back interim patch '9318256' from OH '/media/hda2/oracle/aia'
Patching component oracle.aia, 2.0.1.0.0...
Copying file to "/media/hda2/oracle/aia/install/classes/oracle/apps/aia/core/eh/PublishMessageSession.class"
RollbackSession removing interim patch '9361469' from inventory
OPatch back to application of the patch '9318256' after auto-rollback.
Backing up files affected by the patch '9318256' for rollback. This might take a while...
Patching component oracle.aia, 2.0.1.0.0...
Copying file to "/media/hda2/oracle/aia/install/classes/oracle/apps/aia/core/util/AIADBUtil.class"
Copying file to "/media/hda2/oracle/aia/install/classes/oracle/apps/aia/core/util/XmlNamespaceContext.class"
.
.
.
Copying file to "/media/hda2/oracle/aia/install/classes/oracle/apps/aia/core/eh/i18n/EHResourceBundle.class"
Copying file to "/media/hda2/oracle/aia/install/classes/oracle/apps/aia/core/eh/logging/AIALogger.class"
Copying file to "/media/hda2/oracle/aia/install/classes/oracle/apps/aia/core/eh/resubmit/util/AIAEHResubmissionUtil.class"
Copying file to "/media/hda2/oracle/aia/seeddata/DatabaseObjects/UpgradeEHTablesTo25.sql"
ApplySession adding interim patch '9318256' to inventory
Verifying the update...
Inventory check OK: Patch ID 9318256 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 9318256 are present in Oracle Home.
--------------------------------------------------------------------------------
The following warnings have occurred during OPatch execution:
1) OUI-67012:Interim Patch 9318256 has Conflict with patch(es) [ 9361469 ] in OH /media/hda2/oracle/aia
--------------------------------------------------------------------------------
OPatch Session completed with warnings.
OPatch completed with warnings.

1.3 Patch Post-Installation Instructions

1. Browse to $AIA_HOME/config.
[oracle@TEST1AIA01 9318256]cd $AIA_HOME/config

2. Open AIAConfigurationProperties.xml file in edit mode
[oracle@TEST1AIA01 config]$ vi AIAConfigurationProperties.xml

3. Add the below snippet in the properties file
<ModuleConfiguration moduleName="ResourceBundle">

<Property name="Telco/BillingManagement">oracle.apps.aia.core.i18n.AIAListResourceBundle</Property>
<Property name="Telco/ProductLifeCycle">oracle.apps.aia.core.i18n.AIAListResourceBundle</Property>
<Property name="Telco/SalesOrder">oracle.apps.aia.core.i18n.AIAListResourceBundle</Property>
<Property name="Telco/CustomerParty">oracle.apps.aia.core.i18n.AIAListResourceBundle</Property>
</ModuleConfiguration>

4. Navigate to cd $AIA_HOME/bin and source aiaenv.sh.
[oracle@TEST1AIA01 config]$ cd $AIA_HOME/bin
[oracle@TEST1AIA01 bin]$ source aiaenv.sh

5. Now navigate to cd $AIA_HOME/install/conf/eh/AIAReadJMSNotificationProcess and execute ant(Type ant and enter).
[oracle@TEST1AIA01 bin]$ cd $AIA_HOME/install/conf/eh/AIAReadJMSNotificationProcess
[oracle@TEST1AIA01 AIAReadJMSNotificationProcess]$ ant

.
.

BUILD SUCCESSFUL
Total time: 20 seconds

6. Copy $AIA_HOME/lib/classes to $ORACLE_HOME/bpel/system/classes. Make sure custom files are not moved.
[oracle@TEST1AIA01 AIAReadJMSNotificationProcess]$ cd $ORACLE_HOME/bpel/system/
[oracle@TEST1AIA01 system]$ tar –cf classes.tar classes/
[oracle@TEST1AIA01 system]$ cd classes/
[oracle@TEST1AIA01 classes]$ cp –Rf $AIA_HOME/lib/classes .

7. Restart the oc4j server.

[oracle@TEST1AIA01 classes]$ source /home/oracle/setsoaenv.sh
[oracle@TEST1AIA01 classes]$ opmnctl shutdown
[oracle@TEST1AIA01 classes]$ opmnctl startall

8. If you apply this patch for cluster, please do the following steps

a) Check if the ESBErrorListenerMDB is available on both the Nodes.
If yes, then you have to undeploy the ESBErrorListenerMDB.ear from both the Nodes and then continue with the post patching steps.
Take back up of ESBErrorListenerMDB.ear in location $AIA_HOME/lib/
Change directory to $AIA_HOME/install/scripts/
cd $AIA_HOME/install/scripts/
Undeploy the ESBErrorListenerMDB.ear
ant --noconfig –f ConfigDatasources.xml UndeployESBErrorListenerMDB
You can see the file ESBErrorListenerMDB.ear in the location
$AIA_HOME/lib/cluster/
This needs to be copied to location $AIA_HOME/lib/
cp $AIA_HOME/lib/cluster/ESBErrorListenerMDB.ear $AIA_HOME/lib/ESBErrorListenerMDB.ear
This has to be done on both the nodes.

b) Re-deploying the ESB Error Handler on APPHOST1
In the deploy.properties file of APPHOST1, set the http.hostname/port to APPHOST1 and save.
Change directory to $AIA_HOME/install/scripts/
cd $AIA_HOME/install/scripts/
Redeploy this MDB using the enterprise manager or using the following command
ant --noconfig –f ConfigDatasources.xml DeployESBErrorListenerMDB
Now change the value of http.hostname/port in deploy.properties again to LBR details.

c) Re-deploying the ESB Error Handler on APPHOST2
In the deploy.properties file of APPHOST2, set the http.hostname/port to APPHOST2 and save.
Change directory to $AIA_HOME/install/scripts/
cd $AIA_HOME/install/scripts/
Redeploy this MDB using the enterprise manager or using the following command
ant --noconfig –f ConfigDatasources.xml DeployESBErrorListenerMDB
Now change the value of http.hostname/port in deploy.properties again to LBR details.

9. In case you are getting "java.sql.SQLException: The method 'commit' cant be called when a global transaction is active" error then a change is needed to be done for AIAConnectionPool. You need to add tx-level="local" as shown below.
<managed-data-source connection-pool-name="AIAConnectionPool" jndi-name="jdbc/AIADataSource" name="AIADataSource" tx-level="local"/>
The above error also results in OutOfMemory exception.

10. For the error "oracle.apps.aia.core.config.PropertyNotFoundException: Property Not Found (SystemConfiguration/COMMON.ERRORHANDLER_EXT.IMPL)". For this we need to below line in the AIAConfigurationProperties.xml
<Property name="COMMON.ERRORHANDLER_EXT.IMPL">oracle.apps.aia.core.eh.AIAErrorHandlerExtImpl</Property>
Save and reload.

11. If this patch causes out of memory issue for native memory then increase the value of -XX:MaxPermSize.

12. Optional Step : [Recommended]
This step is applicable only if number of listeners on AIA_ERROR_TOPIC are greater than one and listeners are named with some random numbers.
On Production systems, this step can be done during backup phase.
Take backup of AIA_ERROR_TOPIC queue contents. Then drop and recreate AIA_ERROR_TOPIC.
This step will fix - messages not getting deleted from AIA_ERROR_TOPIC_TABLE table after reading them from the topic bug.
If this step is not applied, the AQ table keeps growing.
Since it is on DB, you have to do it once on DB.
But ensure to follow the below steps here.

i. You have to stop the Queue
ii. Take back up of Queue Table.
iii. Drop the Queue
iv. Run the following script to re-create and start the queue
$AIA_HOME//seeddata/DatabaseObjects/AIAerrorAQ.sql

The Number of listeners can be equivalent to number of Subscribers for that particular Queue.
The number of Subscribers can be determined from a table which will be something like following
AQ$AIA_ERROR_TOPIC_S
Also, please note that the reason for this step is that dummy Subscribers MAY get created and the Queue table keeps on growing.
Hence it is recommended to this step (irrespective of number of subscribers that are currently existing).
Ensure to stop, take back up before you drop the queue and re-create it.