Friday, September 7, 2012

How to Upgrade the JDBC driver in Weblogic10.3


How to upgrade the JDBC driver which bundled with WebLogic 10.3 with the later Oracle Database 11g Release 2?

Solution

WebLogic 10gR3 is bundled with JDBC driver 11.1.0.6; the latest  release version id is 11.2.0.1.0 (11g Release 2).

The steps below show you how to upgrade to the later release:

Download lastest version of JDBC driver from 


Replace BEA_HOME\wls103\wlserver_10.3\server\lib\ojdbc6.jar with the lastest ojdbc6.jar

Replace BEA_HOME\wlserver_10.3\server\ext\jdbc\oracle\11g\orai18n.jar with the lastest orai18n.jar

Restart WebLogic and test your data source

How to find the JDBC Driver Details in Weblogic


#JDBC Driver Details in Weblogic:
#-----------

import java.sql.*;  
public class dbinfo  
{  
  public static void main (String arr[]) throws Exception  
  {  
    String dbDriver="oracle.jdbc.driver.OracleDriver";  
    String dbURL = "jdbc:oracle:thin:@test-db:1521:testsid";  
    String dbPW = "my_password";  
    String dbUser = "my_username";  
   
    Connection con = null;  
    Class.forName(dbDriver);  
   
    con = DriverManager.getConnection (dbURL, dbUser, dbPW);  
    con.setAutoCommit(false);  
   
    DatabaseMetaData dbmd = con.getMetaData();  
   
    System.out.println("=====  Database info =====");  
    System.out.println("DatabaseProductName: " + dbmd.getDatabaseProductName() );  
    System.out.println("DatabaseProductVersion: " + dbmd.getDatabaseProductVersion() );  
    System.out.println("DatabaseMajorVersion: " + dbmd.getDatabaseMajorVersion() );  
    System.out.println("DatabaseMinorVersion: " + dbmd.getDatabaseMinorVersion() );  
    System.out.println("=====  Driver info =====");  
    System.out.println("DriverName: " + dbmd.getDriverName() );  
    System.out.println("DriverVersion: " + dbmd.getDriverVersion() );  
    System.out.println("DriverMajorVersion: " + dbmd.getDriverMajorVersion() );  
    System.out.println("DriverMinorVersion: " + dbmd.getDriverMinorVersion() );  
    System.out.println("=====  JDBC/DB attributes =====");  
    System.out.print("Supports getGeneratedKeys(): ");  
    if (dbmd.supportsGetGeneratedKeys() )  
      System.out.println("true");  
    else  
      System.out.println("false");  
  
    pstmt.close();  
    con.close();  
  }  
  
}  

--------------------------------------------------------------
We can find the jdbc driver version with out programming also 

Go to your weblogic home and set the env as shown belwo
/oracle/app/product/fmw/wlserver_10.3/server/bin> . ./setWLSEnv.sh

Now enter the following weblogic utils command as below.

/oracle/app/product/fmw/wlserver_10.3/server/bin> java weblogic.utils.Versions

Now you can see the jdbc driver version  along with other details.

JDBC ImplVersion: 11.2.0.3.0

Wednesday, September 5, 2012

How to add Oracle HTTP Server instance into Oracle Enterprise Manager


For OHS server, there is no stand-alone OHS server monitoring capability in OEM 11g. we can configure customized status monitor by using below options 


Process:1 Add OHS details in targets.xml file in agent home for STATUS monitoring


1. Take Backup of /oracle/app/agent11g/sysman/emd/targets.xml

2. Add below details in targets.xml file, modify according to your server which are in BOLD letters.

        <Target TYPE="oracle_apache" NAME="web1_ohs_instance1">
                <Property NAME="HTTPMachine" VALUE="Server HostName"/>
                <Property NAME="HTTPPort" VALUE="80"/>
                <Property NAME="useDefaultProxy" VALUE="false"/>
                <Property NAME="version" VALUE="11.1.1.4.0"/>
                <Property NAME="VersionCategory" VALUE="StdApache"/>
                <Property NAME="OracleHome" VALUE="/oracle/app/product/fmw/web"/>
        </Target>


3. Restart the OEM agent.

---------------------------------------------------------------------------------------------------------------------------
Process :2 OHS server to any weblogic domain as web tier (This will monitor status and performance)


How to register Oracle HTTP Server with Weblogic Server
Environment = Oracle Enterprise Linux 5.7, Oracle DB 11g, Oracle Weblogic Server 10.3.5
Resolution = Follow the below mentioned steps:
Step 1 - Login as Oracle user and complete all the prerequisites as mentioned here
Step 2 - Go to the directory where HTTP Server (Webtier) has been installed
$ cd /u01/app/oracle/admin/ohs_inst1/bin
Step 3 - Register your Admin Server URL (of HTTP server) with Weblogic:
$ ./opmnctl registerinstance -adminHost ADMIN.mycompany.com -adminPort 7001 -adminUsername weblogic
Command requires login to weblogic admin server (ADMIN.mycompany.com):
  Username: weblogic
  Password:
Deploying NonJ2EEManagement Application...weblogic.Deployer invoked with options:  -adminurl ADMIN.mycompany.com:7001 -username weblogic -name NonJ2EEManagement -source /u01/app/oracle/product/fmw/Oracle_WT1/opmn/applications/NonJ2EEManagement.ear -nostage -deploy -upload -noexit
<Apr 3, 2012 6:29:18 PM NZST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, NonJ2EEManagement [archive: /u01/app/oracle/product/fmw/Oracle_WT1/opmn/applications/NonJ2EEManagement.ear], to configured targets.>
Task 1 initiated: [Deployer:149026]deploy application NonJ2EEManagement [Version=11.1.1] on AdminServer.
Task 1 completed: [Deployer:149026]deploy application NonJ2EEManagement [Version=11.1.1] on AdminServer.
Target state: deploy completed on Server AdminServer
Done
Registering instance
Command succeeded.
Errors reported while registering Oracle HTTP Server with Weblogic Server
<Warning> <Deployer> <BEA-149124> <Failures were detected while initiating deploy task for application 'NonJ2EEManagement'. Error is: '[Deployer:149163]The domain edit lock is owned by another session in non-exclusive mode - this deployment operation requires exclusive access to the edit lock and hence cannot proceed. If you are using "Automatically Aquire Lock and Activate Changes" in the console, then the lock will expire shortly so retry this operation.'>
opmnctl registerinstance: failed.
Resolution - This is an issue with the Weblogic Server configuration. Follow the below mentioned steps:
Step 1 - Login to Oracle Weblogic Administration Console
Step 2 - Give user/password and hit login
Step 3 - In the top, go to "preferences" and give following setttings:
Warn If User Holds Lock - checked
Perform Asynchronous Activation - unchecked
Warn User Before Taking Lock - checked
Automatically Acquire Lock and Activate Changes: false
Step 4 - Save your changes
Step 5 - Activate Changes
Step 6 - Now retry registering HTTP Server with Weblogic with following command:
./opmnctl registerinstance -adminHost ADMIN.mycompany.com -adminPort 7001 -adminUsername weblogic
-------------------------------------------------------------------------------------------------------------------------------------------------------------