Oracle: Script to find all the INDEX hints from the files with specific extension


foreach i (`grep -l -e ‘\/\s*\*\s*+’ -e ‘–\s*+’ *.$1`)
echo “$i”
echo `cat “$i”` | grep -o -P -e ‘\/\*\+.*?\*\/’ | grep –color -i -o -P -e ‘index.*?\(.+?\)’
cat “$i” | grep -o -P -e ‘–\+.*’ | grep –color -i -o -P -e ‘index.*?\(.+?\)’

[pupakare@unix ~/tmp]$ 0
index( _PK )
index( _PK1 )
index( _PK2 )
index_asc ( _PK33 )
index( _U1 )
index( _U2 )
index( _U3 )
index( _U4 )
index( _U5 )
index( _U6 )
index( _U7 )
index( _U01 )
index( _U02 )
index( _U03 )
index( _U11 )
index( _U K )
index( _UK1 )
index( _UK2 )
index( _UK3 )

Posted in Uncategorized | Leave a comment

How to see if the string is all numeric using regex

sql> l
1 select 1
2 from dual
3* where regexp_like(‘500000’, ‘[^0-9]’)

sql> /

no rows selected  — which means that all the characters in the string are NUMERIC

sql> l
1 select 1
2 from dual
3* where regexp_like(‘500A000′, ‘[^0-9]’)

sql> /

1 row selected  — which means that one or more characters in the string are NOT NUMERIC

You can use similar pattern regexp_like(‘IAMTestInGHeRe’, ‘[^a-zA-Z]’) to find if there is anything but alphabets  ..

Posted in Uncategorized | Leave a comment

Remove extra parentheses

A small utility to get rid of those extraneous parentheses from a SQL query (or any string for that matter) ..

Just copy the attached .class in your directory — and use as follows ..

And… use it as follows..

$ java RemoveExtraBraces ((((()))))(())
<<<——————— Changed String is ———————>>>
                         (        )(  ) 

Requirement: Balanced String with same# of open [(] and close [)] parentheses.


Make the input string dense.


Get the String into charArray.

static char[] charArray;

static char[] setCharArray(String str)
charArray = str.toCharArray();
return charArray;

Loop thru the whole charArray and find all open and closing parentheses

keep them in a hash map with the position of a parenthesis. This will prepare you for next looping – hopefully there are other strings that don’t need to be scanned in next round.

static HashMap<Integer, Character> parenthesisMap = new LinkedHashMap<Integer, Character>();

static boolean fillInArrayOfParentheses(int startPosition)
int position;
char charAt;
int i=0, j=0;
for (position = startPosition; position < charArray.length; position++)
charAt = charArray[position];
if (charAt == ‘(‘)
parenthesisMap.put(position, charAt);
else if (charAt == ‘)’)
parenthesisMap.put(position, charAt);
if (i != j)
return false;
return true;

For each open parenthesis [‘(‘] and loop thru parenthesisMap and find the last closing parenthesis [‘)’] position.

static int getClosingBracketPosition(int startPosition)
char charAt;
int position = startPosition, bracketCount = 0;
if (!parenthesisMap.isEmpty())
for (Integer i: parenthesisMap.keySet())
if (i >= startPosition)
position = i;
charAt = parenthesisMap.get(i);
if (charAt == ‘(‘)
if (–bracketCount == 0)
return position;

Main algorithm:

ArrayList<Integer> whichSubscriptToBlankout = new ArrayList<Integer>();

for (pos = 0; pos < charArray.length; pos++)
curChar = charArray[pos];
if (curChar == ‘(‘)
endPos = getClosingBracketPosition(pos);
if (prevChar == ‘(‘)
endPlusOneChar = charArray[endPos + 1];
if (prevChar == ‘(‘ && endPlusOneChar == ‘)’)
//System.out.println(” to be changed”);
prevChar = curChar;

for (Integer bracketPosition: whichSubscriptToBlankout)
// blankout the elements for which the subscript was captured in whichSubscriptToBlankout
charArray[bracketPosition] = ‘ ‘;
String strFinal = String.valueOf(charArray);


Posted in Uncategorized | Leave a comment

Dynamic partner link (how to)

For dynamic partner link stuff to work one would need following:
1) Composite ‘Called’ created and deployed to SOA server.
2) Create a Caller composite.
   a) Create a partner link using a deployed composite from (1) above.
   b) You could copy the wsdl (we call it now a concrete wsdl – will have the port information) from the SOA server.
   c) Composite.xml
      <reference name=”CalledServie”
        <interface.wsdl interface=”;
          < port=”
                location=”called_client_ep.wsdl” soapVersion=”1.1″>
            <property name=”weblogic.wsee.wsat.transaction.flowOption” type=”xs:string”
              < port=””/&gt;
   d) concrete wsdl [called_client_ep.wsdl] (this could be the oramds location or in a Composite project 

<wsdl:service name=”called_client_ep”>
         <wsdl:port name=”Called_pt” binding=”client:CalledBinding”>
            <soap:address xmlns:soap=”; location=”<blankout>“/>

   e) In Caller’s bpel you will need to have following
      a) Variable needed.
         1) copy schema from into xsd folder as say ws_addressing.xsd
         2) create a variable of type EndpointReference using the schema above.
               <variable name=”ep_variable” element=”ns2:EndpointReference”/>
      b) Assignment of the REAL (concrete) address to Address portion of the EndpointReference variable.   
         <assign name=”Assign”>
                <from expression=”‘'”/&gt;
                <to variable=”ep_variable” query=”/ns2:EndpointReference/ns2:Address”/>
      c) And, assignment of EndpointReference variable to a partnerlink
                <from variable=”ep_variable” query=”/ns2:EndpointReference”/>
                <to partnerLink=”CalledServie”/>

     f) Not really required but for consistency following can be changed

         a) File composite.xml

             <import namespace=”;

          b) File CallerProcess.componentType

               <reference name=”CalledServie”
                        ui:wsdlLocation=”<blank out>
                         <interface.wsdl       interface=”; callbackInterface=””/&gt;

Posted in Uncategorized | Leave a comment

My experience with installing SOA suite RCU

  1. Installing Jdev and WLS server
  2. run soa 1.2 suite and
  3. (only then) run soa 1.3
  4. run rcu1.3

Installing the rcu on windows XP.
Run <drive>\rcu3\rcuHome\BIN\rcu.bat.

The RCU attempt failed for whatever reason and I had to undertake some clean up activity–

I had to get rid of the users with DEV_* and the table spaces created with DEV_*.

select * from all_users;

drop user DEV_SOAINFRA cascade;
drop user DEV_ORASDPM  cascade;
drop user DEV_PORTLET  cascade;
drop user DEV_MDS      cascade;

drop tablespace DEV_MDS;
drop tablespace DEV_SOAINFRA;
drop tablespace DEV_ORABAM;
drop tablespace DEV_IAS_PORTLET;
drop tablespace DEV_IAS_ORASDPM;

select * from dba_data_Files;

Also got rid of datafiles (physical delete) after getting rid of tablespaces.

sqlplus sys/sys as sysdba
show parameters processes
show parameters open_cursors

##Removed the RCU : 6107 DB using

ALTER SYSTEM SET processes=500 SCOPE=spfile;
ALTER SYSTEM SET open_cursors=500 SCOPE=spfile;

SHUT DOWN the db and brought it back up.

SQL Test=select 1 from schema_version_registry where owner=(select user from dual) and mr_type=’SOAINFRA’ and version=’′

CFGFWK-60850: Test Failed!
CFGFWK-60853: A connection was established to the database but no rows were returned from the test SQL statement.

Connect as SYS
select * from schema_version_registry where mr_type=’SOAINFRA’ and version=’′;

delete schema_version_registry ; (5 rows deleted)

Again ran <drive>\rcu3\rcuHome\BIN\rcu.bat.

this time successfully 🙂

================= admin server.bat =====================
title ADMIN server

set DOMAIN_HOME=D:\Oracle\Middleware\user_projects\domains\xe_domain

call “%DOMAIN_HOME%\bin\startWebLogic.cmd” %*

================= soa server.bat =======================
title SOA server

set DOMAIN_HOME=D:\Oracle\Middleware\user_projects\domains\xe_domain

%DOMAIN_HOME%\bin\startManagedWebLogic.cmd soa_server1


create a file if does not exist under ~\Middleware\user_projects\domains\<domain>\servers\soa_server1\security

with following two entries

#Tue Jun 15 23:40:54 EDT 2010

If you get dreaded

Testing JSR-160 Runtime … failed.
Cannot establish connection.
Testing JSR-160 DomainRuntime … skipped.
Testing JSR-88 … skipped.
Testing JSR-88-LOCAL … skipped.
Testing JNDI … skipped.
Testing JSR-160 Edit … skipped.
Testing HTTP … success.
Testing Server MBeans Model … skipped.

try to disable proxy settings in JDeveloper (Tools –>Preferences –> Web Browser and Proxy).
Then, re-start JDeveloper IDE and re-test your application server Connection, it might  work.


Configuring DBAdaptor for your own JNDI.

Create jdbc/myjndi
follow thru – and test the connection.

Set appropriate targets using Target’s tab. (soa-server1 for example)

Click on DbAdapter
Settings for DbAdapter
Outbound Connection Pools
Groups and Instances expand javax.resource.cci.ConnectionFactory by hitting (+)
Hit New
Choose javax.resource.cci.ConnectionFactory
JNDI Name: eis/myjndi
you should see eis/myjndi under Groups and Instances
click on eis/myjndi
Outbound Connection Properties
xADataSourceName  : jdbc/myjndi

<< this is where the eis/myjndi and jdbc/myjndi are connected >>

Redeploy the DBAdaptor. Check DBAdaptor->Update->Redeploy.

We will use eis/myjndi from JDev on our DBAdaptor.


If you do get error “Error occurred during initialization of VM
Could not reserve enough space for object heap” — then  setSOADomainEnv.cmd file the following
set DEFAULT_MEM_ARGS=%DEFAULT_MEM_ARGS% -XX:PermSize=128m -XX:MaxPermSize=360m

Posted in Uncategorized | 1 Comment

How to find the jar file or the location where the .class exists?


package util;


class WhichJarIsUserClassIn {
public static void main (String[] args) {
if (args.length != 1) {
System.out.println(“usage: java -classpath <yourclasspath> util.WhichJarIsUserClassIn fullyQualifiedClassName (like util.WhichJarIsUserClassIn)”);

try {
Class cls = Class.forName(args[0]);
ProtectionDomain pDomain = cls.getProtectionDomain();
CodeSource cSource = pDomain.getCodeSource();
URL loc            = cSource.getLocation();
System.out.println(“The class ‘” + args[0] + “‘ is in ” + loc + “\n”);

} catch (ClassNotFoundException e) {
String     clspth= System.getProperty(“java.class.path”);
System.out.println(“The class ‘” + args[0] + “‘ not found in the classpath ‘”+clspth +”‘”);

catch (NullPointerException e) {
System.out.println(“The class ‘” + args[0] + “‘ may be a core java class!”);




Sample run and output —

D:\Pushkar>java  -classpath D:\Oracle\MIDDLE~1\WLSERV~1.3\server\ext\jdbc\oracle
ient.jar;D:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\xqrl.jar; util.WhichJarIsUserC
lassIn weblogic.servlet.internal.WebAppModule

The class ‘weblogic.servlet.internal.WebAppModule’ is in file:/D:/Oracle/Middlewar

Posted in Uncategorized | Leave a comment