Search This Blog

Sunday, October 23, 2016

WLST Script to Change SOAMaxThreadsConfig in 12c

WLST Script to Change SOAMaxThreadsConfig in 12c
import javax.management.openmbean.CompositeDataSupport;
if __name__ == '__main__':
    from wlstModule import *#@UnusedWildImport
print 'starting the script ....'
username = 'weblogic'
password = 'Welcome1'
url='t3://locahost:7001'
connect(username,password,url)
servers = cmo.getServers()
domainRuntime()
for server in servers:
    serverName = server.getName()
    print 'server: ' + server.getName()
    SoaInfraConfigobj = ObjectName('oracle.as.soainfra.config:Location=AdminServer,name=soa-infra,type=SoaInfraConfig,Application=soa-infra')
    print 'Common Properties for soa_server1'
   
    print  mbs.getAttribute(SoaInfraConfigobj, 'GlobalTxRetryInterval')
    props1 = mbs.getAttribute(SoaInfraConfigobj, 'SOAMaxThreadsConfig')
    print props1.get("incomingRequestsPercentage")
    print props1.get("internalBufferPercentage")
    print props1.get("internalProcessingPercentage")
   
    print props1
   
    javaMap = java.util.HashMap()
    javaMap.put("incomingRequestsPercentage", java.lang.Integer(20))
    javaMap.put("internalBufferPercentage", java.lang.Integer(40))
    javaMap.put("internalProcessingPercentage", java.lang.Integer(40))
    print javaMap
   
    mbs.setAttribute(SoaInfraConfigobj, Attribute('GlobalTxRetryInterval', 22))
    print  mbs.getAttribute(SoaInfraConfigobj, 'GlobalTxRetryInterval')
   
    new_rec_config_obj = javax.management.openmbean.CompositeDataSupport(props1.getCompositeType(),javaMap)
    print new_rec_config_obj
   
    mbs.setAttribute(SoaInfraConfigobj, Attribute('SOAMaxThreadsConfig', new_rec_config_obj))
   
   
    props1 = mbs.getAttribute(SoaInfraConfigobj, 'SOAMaxThreadsConfig')
    print props1.get("incomingRequestsPercentage")
    print props1.get("internalBufferPercentage")
    print props1.get("internalProcessingPercentage")
   
   


Tags: Publish
October 24, 2016 at 08:42AM
Open in Evernote

Friday, October 21, 2016

P6 Spy with a stand alone jdbc program

P6 Spy with a stand alone jdbc program
package mdsleak;

import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Class1 {
    public Class1() {
        super();
    }

    public static void main(String[] argv) {

                    System.out.println("-------- Oracle JDBC Connection Testing ------");

                    try {

                         //  Class.forName("oracle.jdbc.driver.OracleDriver");
                        Class.forName("com.p6spy.engine.spy.P6SpyDriver");

                    } catch (ClassNotFoundException e) {

                            System.out.println("Where is your Oracle JDBC Driver?");
                            e.printStackTrace();
                            return;

                    }

                    System.out.println("Oracle JDBC Driver Registered!");

                    Connection connection = null;

                    try {

                       //     connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott","tiger");
                       connection = DriverManager.getConnection("jdbc:p6spy:oracle:thin:@localhost :1521:orcl", "scott","tiger");

                        Statement stmt3 = connection.createStatement();
                        ResultSet rs3 = stmt3.executeQuery("SELECT COUNT(*) FROM EMP,EMP,EMP,EMP,EMP");
                            while(rs3.next()){
                            System.out.println(rs3.getInt(1));
                            }

                    } catch (SQLException e) {

                            System.out.println("Connection Failed! Check output console");
                            e.printStackTrace();
                            return;

                    }

                    if (connection != null) {
                            System.out.println("You made it, take control your database now!");
                    } else {
                            System.out.println("Failed to make connection!");
                    }
            }

}


Create a directory c:\temp\p6spy

Copy the file p6spy.jar to c:\temp\p6spy

Create a new file c:\temp\p6spy\spy.properties with the following
contents

++++++++++
realdatasourceclass=oracle.jdbc.driver.OracleDriver
autoflush=true
logfile=c:/temp/spy.log
append=false
+++++++++

Run the Java Program with the following arguments

C:\jdk1.7.0_79\bin\java.exe -classpath D:\myjdevwork\jdev1117\mywork\Application2\MDSLeak\classes;c:\temp\p6spy;c:\temp\p6spy\p6spy.jar;D:\sqldeveloper\jdbc\lib\ojdbc7.jar Class1


 you should see a file c:/temp/spy.log with the following

1477027846045|193|statement|connection 0|SELECT COUNT(*) FROM EMP,EMP,EMP,EMP,EMP|

Here 193 is the time it took in ms and 1477027846045 is the The Current Unix Timestamp

Import changes to the JDBC Program 

 //  Class.forName("oracle.jdbc.driver.OracleDriver");
  Class.forName("com.p6spy.engine.spy.P6SpyDriver");

   //     connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott","tiger");
         connection = DriverManager.getConnection("jdbc:p6spy:oracle:thin:@localhost :1521:orcl", "scott","tiger");




Tags: Publish
October 21, 2016 at 12:20PM
Open in Evernote

Enable JDBC Tracing with ODI (p6spy)

Enable JDBC Tracing with ODI (p6spy)
Create a directory c:\temp\p6spy

Copy the file p6spy.jar to c:\temp\p6spy

Create a new file c:\temp\p6spy\spy.properties with the following
contents

++++++++++
realdatasourceclass=oracle.jdbc.driver.OracleDriver
autoflush=true
logfile=c:/temp/spy.log
append=false
+++++++++


Open the file odi.conf file and add the following lines

after the line

AddJavaLibFile ../../../oracle_common/modules/features/com.oracle.db.jdbc7-dms.jar

+++
AddJavaLibFile c:/temp/p6spy/
AddJavaLibFile c:/temp/p6spy/p6spy.jar
+++

Invoke odi and edit the connection setting

For the JDBC driver name specify it as
com.p6spy.engine.spy.P6SpyDriver

and change the JDBC url to

jdbc:p6spy:oracle:thin:@localhost:1521:orcl

Perform some operations and you should see a file c:/temp/spy.log with the following

1477027846045|193|statement|connection 0|SELECT COUNT(*) FROM EMP,EMP,EMP,EMP,EMP|

Here 193 is the time it took in ms and 1477027846045 is the The Current Unix Timestamp


Tags: Publish
October 21, 2016 at 12:19PM
Open in Evernote

Tuesday, October 18, 2016

How to find out which jar file is loading the class I am looking for ??

How to find out which jar file is loading the class I am looking for ??
In SOA add the following java code to BPEL Java embeding activity 

++++
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
        try {


System.out.println(Class.forName("oracle.tip.adapter.ftp.SFTPClient").getProtectionDomain().getCodeSource().getLocation());

        }
        catch(Exception e1)
        {
         e1.printStackTrace();
        }

System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ");
+++

Result :

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
file:/apps/erikad1/aerikad1/app_ECTH/ecthd0runtime/SOA/domain/ECTH_SOA_Domain/servers/ECTH_SOA1/stage/FtpAdapter1/FtpAdapter.rar
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx




You can also add the flag 

export JAVA_OPTIONS="-verbose:class". This writes all the class loading
information to the standard out file.

This displays messages like

[Loaded oracle.tip.adapter.ftp.SFTPAgent from
file:/apps/erikad1/aerikad1/app_ECTH/ecthd0runtime/SOA/domain/ECTH_SOA_Domain/servers/ECTH_SOA1/stage/FtpAdapter1/FtpAdapter.rar]
[Loaded oracle.tip.adapter.ftp.SFTPClient from
file:/apps/erikad1/aerikad1/app_ECTH/ecthd0runtime/SOA/domain/ECTH_SOA_Domain/servers/ECTH_SOA1/stage/FtpAdapter1/FtpAdapter.rar]
[Loaded oracle.tip.adapter.file.outbound.FileLister from
file:/apps/erikad1/aerikad1/app_ECTH/ecthd0soa/fmw/SOA/soa/connectors/FileAdapter.rar]




Tags: Publish
March 29, 2016 at 09:08AM
Open in Evernote