Monday, 20 June 2011

How to Make Oracle Database Start and Shutdown Automatically - Linux

The automatic startup and shutdown of the Oracle database can be achieved with the files dbstart and dbshut both provided by Oracle.

These files rely on the existance of the file /etc/oratab to work (although by altering the dbshut and dbstart files this can be moved).


The file oratab is used by ORACLE utilities (DbStart and DbShut).  It is created by root.sh and updated by the Database Configuration Assistant when creating a database.

The format of the /etc/oratab file is as follows: 


SID:ORACLE_HOME:AUTO

An example:


orcl:/home/oracle/7.3.3.0.0:Y  -- 'Y' -- To Start Automatically
leaveup:/home/oracle/7.3.2.1.0:N -- 'N' -- Not to start Automatically.
 
This is not it, there is more to it. The above will work only when the DbStart and DbShut scripts are run during the startup of the linux system. Please read on:



init.d & rc.d

To start and stop the database when the machine comes up and goes down by modifying the startup routines for the Linux machine. This is quite easy, although I should point out here that this may change depending on which flavour of Linux (slackware, debian, redhat, etc). I will show examples which work for Redhat Linux 5.0. To modify these for your own flavour of Linux, please see your Linux documentation sets. (Although it should hold true for any Sys V type UNIX).
Firstly, we need to create the script which will run dbshut and dbstart in the /etc/rc.d/init.d directory.

Create the following file as /etc/rc.d/init.d/OracleDB:

#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.

ORA_HOME=<Oracle Home>
ORA_OWNER=oracle

if [ ! -f $ORA_HOME/bin/dbstart ]
then
    echo "Oracle startup: cannot start"
    exit
fi

case "$1" in
   'start')
        # Start the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
        su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME"
        touch /var/lock/subsys/dbora
        ;;
    'stop')
        # Stop the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME"
        su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
        rm -f /var/lock/subsys/dbora
        ;;
esac




After checking the correctness of the above script, This script needs to be linked to the Linux runlevel directories.

The following commands will ensure that the databases will come up in runlevels 3,4 and 5:



$ ln -s /etc/rc.d/init.d/OracleDB /etc/rc.d/rc3.d/S99OracleDB


$ ln -s /etc/rc.d/init.d/OracleDB /etc/rc.d/rc4.d/S99OracleDB
$ ln -s /etc/rc.d/init.d/OracleDB /etc/rc.d/rc5.d/S99OracleDB





The following commands will ensure that the databases will shut down in runlevels 0,1,2 and 6:





$ ln -s /etc/rc.d/init.d/OracleDB /etc/rc.d/rc0.d/K10OracleDB          # Halting
$ ln -s /etc/rc.d/init.d/OracleDB /etc/rc.d/rc1.d/K10OracleDB
$ ln -s /etc/rc.d/init.d/OracleDB /etc/rc.d/rc2.d/K10OracleDB
$ ln -s /etc/rc.d/init.d/OracleDB /etc/rc.d/rc6.d/K10OracleDB        # Rebooting




 Reference: Oracle Database HOWTO

Tuesday, 3 May 2011

How to configure SQL IDentity Provider for ORACLE BPEL or Worklist application in 11g SOA (Troubleshooting)

If you are looking to setup SQL IDentity Provider  for ORACLE BPEL or Worklist application in 11g SOA then you are in the right place.

The solution is basically provided by an Oracle Sample.

You can download the Oracle Sample here: workflow-120-SQLIdentityProvider.zip

Please follow the steps in the sample provided. Also you can double check the steps with this blog: SQLAuthenticator and Human Worklist Application

Credits to: .

By now you have setup the SQL Identiy provider for BPEL and worklist app.

Troubleshooting: (WorklistApp only)

When you have setup the SQL Identiy Provider, there is a very much likely chance that you might face an issue with the user name case sensitivity.

For example if you had a user in mixed case such as  UserName. Then when you try to log in to worklist app, it will complain that the user does not exist, despite that you witness the UserName exist in the database. This will not work for the following reasons.

Human workflow system (Worklist app) appears to be case insensitive for user names login. By default  all user names are stored in lowercase (Not using SQL identity, as this is a different case). As is the case we need to change a property to notify worklist app. 

Solution:

User name case insensitivity property should be changed in Oracle Enterprise Manager Fusion Middleware Control.

Please follow the steps provided in the
Document:  Oracle® Fusion Middleware Developer's Guide for Oracle SOA Suite 11g Release 1 (11.1.1)
Following the steps mentioned in the document and set the value to "true".

This will resolve the issue.

Tuesday, 26 April 2011

How To Generate Encrypted Password For admin.encrypted.password Property In ant-orabpel.properties File

This blog post will provide steps to generate an encrypted password for admin.encrypted.password property in <Oracle Home>/bpel/utilities/ant-orabpel.properties file.

In order to encrypt the password for admin.encrypted.password property in
ant-orabpel.properties file please do the following:

For example your password is "welcome1"

Make sure you are in <Oracle Home>/bpel/bin

Issue the following commands:

[SOA:~/product/10.1.3.1/OracleAS_1/bpel/bin]$ . ./devprompt.sh
[SOA:~/product/10.1.3.1/OracleAS_1/bpel/bin]$ java com.collaxa.cube.util.EncryptPassword welcome1

This will generate the password encrypted like:
AK6qvYcrlNMqnYt1uPZFjw==

Tuesday, 19 April 2011

How to Enable Oracle BPEL Debugger in Oracle SOA 10.1.3.5 MRL#1

In this section I will provide you with steps to enable BPEL Debugger in Oracle SOA suite 10.1.3.5 MRL#1.

If you read this document: Oracle® Application Server Release Notes and New Features
10g Release 3 (10.1.3.5.1) Part Number E15342-03

Section:

5.8.4 Debugging BPEL Processes and Instances from Oracle BPEL Control

Note: This feature is only available 10.1.3.5 MLR#1 onwords 


It tells you about how you can debug BPEL processes and instances from Oracle BPEL Control with the BPEL debugger.

But before you can start working on or using this feature, you need enable the debugging feature.

Follow the below steps to enable debugging in Oracle BPEL PM:

1. Edit File <SOA_HOME>\bpel\domains\default\config\domain.xml.

2. Add or make changes to domain.xml as below:

<property id="enableDebugger">
<name>enableDebugger</name>
<value>true</value>
<comment>
<![CDATA[debugger<p/>]]>;</comment>
</property>

3. A table is required for debugger that is not created by default in the ORABPEL schema.

   To create the table.

   Execute this script by logging into database with orabpel as user.

    $SOA_HOME\bpel\system\database\script\debugger_oracle.ddl

4. Restart the BPEL server. 

hope this helps.

ORACLE BPEL 11g, Composite Deployment Propagation Issue Due To Coherence.

If you are facing BPEL (SOA) composite deployment propagation issues in 11g oracle SOA cluster, then there is a very good chances that this happening due to the cluster communication section.

In 11g the cluster communication is maintained by another Oracle product called Coherence.

When you look at the Soa Diagnostic logs (and/or the coherence log if you have redirected the coherence logs to some other file)  you might witness logs such as:


Log from SOA1Cohearance.log

2011-03-30 11:08:27.270 Oracle Coherence GE 3.3.2/391 <Warning> (thread=PacketPublisher, member=1): Experienced a 22869 ms communication delay (probable remote GC) with Member(Id=2, Timestamp=2011-03-30 10:17:51.636, Address=IPAddress:Port, MachineId=<MachineID>, Location=process:<Process@Domain>); 123 packets rescheduled, PauseRate=0.0075, Threshold=6802011-03-30 11:31:00.643 Oracle Coherence GE 3.3.2/391 <Warning> (thread=Cluster, member=1): This senior Member(Id=1, Timestamp=2011-03-29 16:13:25.607, Address=IPAddress:Port, MachineId=<Machine ID>, Location=process:<Domain@DomanName>) appears to have been disconnected from another senior Member(Id=2, Timestamp=2011-03-30 10:17:51.636, Address=IPAddress:Port, MachineId=<MachineID>, Location=process:<Process@Domain>), which is the only member of its cluster, but did not respond to any of the termination requests; manual intervention may be necessary to stop that process.2011-03-30 11:31:00.695 Oracle Coherence GE 3.3.2/391 <D5> (thread=Cluster, member=1): TcpRing: disconnected from member 2 due to a disconnect request2011-03-30 11:31:01.652 Oracle Coherence GE 3.3.2/391 <D5> (thread=Cluster, member=1): TcpRing: connecting to member 2 using TcpSocket{State=STATE_OPEN, Socket=Socket[addr=/<IPAddress>,port=<Port>,localport=<Port>]}2011-03-30 11:31:01.949 Oracle Coherence GE 3.3.2/391 <D6> (thread=PacketPublisher, member=1): Member(Id=2, Timestamp=2011-03-30 10:17:51.636, Address=IPAddress:Port, MachineId=<MachineID>, Location=process:<Process@Domain>) has failed to respond to 17 packets; declaring this member as paused.2011-03-30 11:31:03.672 Oracle Coherence GE 3.3.2/391 <D5> (thread=Cluster, member=1): TcpRing: connecting to member 2 using TcpSocket{State=STATE_OPEN, Socket=Socket[addr=/<IPAddress>,port=<Port>,localport=<Port>]}2011-03-30 11:31:05.694 Oracle Coherence GE 3.3.2/391 <D5> (thread=Cluster, member=1): TcpRing: connecting to member 2 using TcpSocket{State=STATE_OPEN, Socket=Socket[addr=/<IPAddress>,port=<Port>,localport=<Port>]}



Log from SOA2Cohearance.log

2011-03-30 11:30:53.820 Oracle Coherence GE 3.3.2/391 <Warning> (thread=PacketPublisher, member=2): Timeout while delivering a packet; removing Member(Id=1, Timestamp=2011-03-29 16:13:25.607, Address=IPAddress:Port, MachineId=<Machine ID>, Location=process:<Domain@DomanName>)
2011-03-30 11:30:53.820 Oracle Coherence GE 3.3.2/391 <D5> (thread=PacketPublisher, member=2): Member 1 left service soa_domain_SOA_ClusterCacheService with senior member 2
2011-03-30 11:30:53.821 Oracle Coherence GE 3.3.2/391 <D5> (thread=PacketPublisher, member=2): Member 1 left Cluster with senior member 2
2011-03-30 11:30:53.821 Oracle Coherence GE 3.3.2/391 <D5> (thread=ReplicatedCache:soa_domain_SOA_ClusterCacheService, member=2): Service soa_domain_SOA_ClusterCacheService: sending ServiceConfigSync to all
2011-03-30 11:30:54.181 Oracle Coherence GE 3.3.2/391 <D5> (thread=Cluster, member=2): TcpRing: disconnected from member 1 due to the peer departure
2011-03-30 11:31:00.683 Oracle Coherence GE 3.3.2/391 <Warning> (thread=Cluster, member=2): The member formerly known as Member(Id=1, Timestamp=2011-03-30 11:30:53.82, Address=IPAddress:Port, MachineId=<Machine ID>, Location=process:<Process@Domain>) has been forcefully evicted from the cluster, but continues to emit a cluster heartbeat; henceforth, the member will be shunned and its messages will be ignored.
2011-03-30 11:31:01.670 Oracle Coherence GE 3.3.2/391 <D4> (thread=TcpRingListener, member=2): Rejecting connection to member 1 using TcpSocket{State=STATE_OPEN, Socket=Socket[addr=/<IPAddress>,port=<Port>,localport=<Port>]}
2011-03-30 11:31:03.685 Oracle Coherence GE 3.3.2/391 <D4> (thread=TcpRingListener, member=2): Rejecting connection to member 1 using TcpSocket{State=STATE_OPEN, Socket=Socket[addr=/<IPAddress>,port=<Port>,localport=<Port>]}
2011-03-30 11:31:05.704 Oracle Coherence GE 3.3.2/391 <D4> (thread=TcpRingListener, member=2): Rejecting connection to member 1 using TcpSocket{State=STATE_OPEN, Socket=Socket[addr=/<IPAddress>,port=<Port>,localport=<Port>]}
When you see log message such as above, All it says is that Coherence is not able to communicate to the other node member in the cluster. In other words the other node, which keeps disconnecting very often, is not responding to coherence connection request.

The following was the solution in my/our case: 

Finally with various testing and researching, found out that the second node container was taking a long time with Garbage collection (GC) and was found that the second node's Java start up parameters where not set up to standards.

As a result  the Java start up parameters were tuned as following:

-XX:+UseParallelGC -XX:+UseAdaptiveSizePolicy -XX:ParallelGCThreads=4 -XX:+UseGetTimeOfDay -Xms4096m -Xmx4096m -XX:PermSize=512m -XX:MaxPermSize=756m -XX:NewSize=512m -XX:MaxNewSize=512m -XX:MaxTenuringThreshold=0 -XX:SurvivorRatio=10

and aded -Dtangosol.coherence.mode=prod to EXTRA_JAVA_OPTIONS variable

Note: Dont forget to restart your weblogic managed servers.

With the above settings, the issue with BPEL composite Deployment propagation disappeared.

Monday, 4 April 2011

How to Trace or Debug Database for issues / How to setup Tracing in database.

often during integration testing we encounter ORA Data base errors,  In this case we are debugging ORA- 02074 error.

here is how we can get more info about the tracing.

You need to set the command as below to you DB:

alter system set events '2074 trace name errorstack level 3';

If you would like to know more about the alter system set events command please

Oracle event trace types - by Burleson Consulting

When you set the above command and reproduce the issue, what ever that might be, look into the Alert_xxx.log file for statements such as below



Mon Apr 04 10:31:34 2011
Errors in file <Path>/trace/<InstanceName>_ora_20926.trc:
ORA-02074: cannot SET NLS in a distributed transaction
Mon Apr 04 10:31:36 2011
Errors in file <Path>/trace/<InstanceName>_ora_20950.trc:
ORA-02074: cannot SET NLS in a distributed transaction

This file gives the trace file name which contains the session dumps. In order to read the trace file, I believe you need extensive DBA skills. But do give it a shot.

How to Reset or Refresh Oracle ESB (10g) MetaData Repository.


Sometimes ESB repository does not behaves as expected especially after a rigorous DEV cycles or for some other reasons. In order to bring it back to clean, at $ORACLE_HOME/integration/esb/bin directory a script called ‘reset.bat/sh’ is available. This script will cleanup the ESB repository. Simply execute the command as shown below and follow the output.

./reset.sh -DDB_URL=jdbc:oracle:thin:@//db_host:db_port/sid -DDB_USER=<User> -DDB_PASSWORD=<Password>

Note: Once you are able to execute it successfully, its very important to restart your ESB instance before using it.

Also remember to Deploy/redeploy all the ESB and BPEL process once again.