Tuesday, December 18, 2012

WebLogic Startup Mode: Development or Production? The (hopefully) Complete List of Differences


Differences

Startup Mode
Development                    Production
Auto deployment
(to admin server only)
YesNo
Automatically created
boot.properties for Admin server only under
$DOMAIN_HOME/servers/$SERVER_NAME/security 
YesNo
Nodemanger username and password
default admin
credentials
randomly
generated
SSL demo certificates cause warning in log files
NoYes
Log file are rotated at server startup
YesNo
On demand deployment of internal applications as default
YesNo
Availability of web service test client
YesNo
Availability of Classloader Analysis Tool
YesNo
Availability of Fast Swap
YesNo
Change Center Enabled
NoYes
Default start parameters
when using Sun JDK and the default
startWebLogic script 
java
-client
-Xms256m
-Xmx512m
-XX:CompileThreshold=
8000
-XX:PermSize=128m
-XX:MaxPermSize=256m
java
-server
-Xms256m
-Xmx512m
-XX:MaxPermSiz=256m
The following settings in the weblogic.xml deployment descriptors default to -1:
NoYes


Differences in previous WebLogic versions:
Up to WebLogic 11:
Default JDK used for new domain
SunJRockit
Up to WebLogic 8 only:
Default number of execute threads
1525
Up to WebLogic 8 only:
maximum number of JDBC connections default setting
1525

Configuration

There is different ways to configure the WebLogic startup mode:
  1. The startup mode can be configured with the admin console, as shown on the screenshot below (requires a restart). Once it’s set to production mode it cannot be reverted with the admin console.
  2. Supply the -Dweblogic.ProductionModeEnabled=true switch as startup parameter
  3. Set the PRODUCTION_MODE variable in the setDomainEnv script in the directory DOMAIN_NAME/bin.

What you should know

Some issues to be aware of:
  • The differences between the two settings depend on the WebLogic version. This can be a bit confusing when you are running different environments with different versions. See the table above: For WebLogic 8 the maximum number of connections in a JDBC connection pool defaults to 25 in production mode (but 15 in development mode); for WebLogic 12c it defaults to 15 in both cases.
  • You cannot revert to development mode from the WebLogic admin console. It’s like the child-proof lock in the back of your car. I understand that is makes sense to protect the children in the back seat your car from themselves but you are are logged with the admin role – still you cannot revert to development mode using the admin console.
  • Autodeployment is not used that much anymore since it only deploys to the admin server – so it doesn’t make sense for a production domain. What if you are a developer? Then your IDE is deploying to the admin server, that is correct – but your IDE is typically not using autodeployment.
  • Note, that there will be a randomly set user and password for nodemanager when creating your domain in production mode with config.sh (see comments from Jacco).
  • You cannot disable the change center in production mode

How to track down High CPU Thread with ps, top and the new JDK7 jcmd Tool In Weblogic



Track down High CPU Thread with ps, top and the new JDK7 jcmd Tool In Weblogic :

Step1 : Login to the weblogic server
                Find out the java process which is running for weblogic with “ps command”

   Eg : ps –ef | grep java

you will see a java process with id 6439

Here the java process id is 6439

 Step 2: To display all the threads with this java process use the “ top” command as below
 Eg: top  -H –p 6439



Here we can see the thread ID 6474 is consuming the max cpu in the thread list. Lets us convert the value to hexadecimal value
Use the following  syntax to convert the value
Printf “%x \n” 6474
Hexavaule is : 194a



Set the environment for JDK 7
/domain/testdomain/bin/> . ./setDomain.sh
Start the jmcd by typing : jcmd


Now take the thread dump of the java process 

 jcmd 6439 help 


Now open the thread dump and search for the hexadecimal value of max threaded. You will see the status of the thread and code with is causing the issue.






Monday, December 10, 2012

How to run Oracle HTTP Server on Port 80


If you are using the Oracle Web tier 11g (11.1.1.2.0 / 11.1.1.3.0 / 11.1.1.4.0) in your projects and specially the Oracle HTTP Server, you face normally the problem, that the Oracle HTTP Server is configured with a Listen Port of 7777 or something like this.

But end users don't like to remember always the Port number of the Oracle HTTP Server, so the goal is to reconfigure the Oracle HTTP Server. Under a UNIX operating system you have to consider one important point for this task, all ports <1024 belongs to root and normally the Oracle Web tier is installed under a own user (normally user oracle) which don't have root privileges. So the ownership of the .apachectl binary must be changed.

Following steps must be done:
·         Shutdown your Oracle HTTP Server
·         Reconfigure the Listen Port
·         Change the .apachectl binary
·         Restart your Oracle HTTP Server and test
The first step is to shutdown the Oracle HTTP Server, this must be done with opmnctl. The binary you can find under your WebtierHome/instances/instance1/bin.
Connect as the Oracle software user (oracle) to your server 

1
2
3
4
# assuming your MW_HOME is /u00/app/oracle/product/fmw-11.1.1
export MW_HOME=/u00/app/oracle/product/fmw-11.1.1
cd $MW_HOME/Oracle_WT1/instances/instance1/bin
./opmnctl stopall


Second step is to configure the Listen Port for the Oracle HTTP Server to port 80

1
2
3
4
5
6
7
8
# assuming you are still connected as oracle user to your sevrer
cd $MW_HOME/Oracle_WT1/instances/instance1/config/OHS/ohs1
cp httpd.conf httpd.conf.save
vi httpd.conf
# Now go to the line with Listen <portnumber> (normally 777x)
# and replace the port number to port 80
Listen 80
# save the changes


The third step is to change the ownership and permissions of the .apachectl binary, this step must be done as root user:

1
2
3
4
5
6
7
8
9
10
# assuming you are connected to the server as root user
# use the MW_HOME from step 1
cd $MW_HOME/Oracle_WT1/ohs/bin
# be aware, we have to modify the hidden file .apachectl (the dot is correct)
ls -la .apachectl
-rwxr-x--- 1 oracle oinstall 13278 Dec 17 03:54 .apachectl
chown root .apachectl
chmod 6750 .apachectl
ls -la .apachectl
-rwsr-s--- 1 root oinstall 13278 Dec 17 03:54 .apachectl

The last step is to startup your reconfigured Oracle HTTP Server, for this you must connect to your server as Oracle Software user:

1
2
3
4
5
6
cd $MW_HOME/Oracle_WT1/instances/instance1/bin
./opmnctl startall
# Then check the status with the option -l
# to see if your Oracle HTTP Server is up and
# the option -l display the used ports (see picture below)
./opmnctl status -l

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5x4YqgLpB67WHDWRiJm1QQcrMVMCp8enQ_QlUAXc93FrNZex23EEaz38ae3EGZBBgzPPEdGBuls-qg-wft1GPHY4p2_TAonpAP4rE0gUmb6PW2voyiqBDfT6zcLl07wAZ0BXHteB27zA/s320/opmnctl_status.png


The final test is, startup your browser and point to your Oracle HTTP Server

Tuesday, December 4, 2012

OBIEE 11g – Installation 11.1.1.6 on Windows 7 64bit OS

OBIEE 11.1.1.6 Installation Pre requisites on Windows 7 64bit OS

Before installation OBIEE 11.1.1.6 on Windows 7 64 bit Operating System, ensure the below requirements are taken care.

System Requirements :

Disk Space  20GB or higher
Physical Memory 4GB


Environmental Variables (TEM to C:\ directory)
Install Loopback Adapter with specific IP Address
JDK 7 (64bit)
Adobe Flash Player 11
Oracle Database 11.1.0.7.0 or higher
RCU Installation 11.1.1.6.0(no changes in RCU installation steps). 

Part1 : Install the Database
Part2 : RCU Installation Steps
Part3 : OBIEE11g Installation

Once you download all the files, extract them and keep them under one directory(Keeping RCU in the same directory is not mandatory, just for convinience).





Before starting the installation keep your have got database up and running. RCU will create two schemas in the installation process…
First step of installaton is running RCU (Repository Creation Utility), go to C:\Software\OBIEE11gR1\bishiphome\rcuHome\BIN and double click on rcu.bat file.
Welcome page of the installation wizard will open …click Next. Select Create
Click Next
Enter all the required information, be sure that the database user has got sysdba previlages…Click Next
Click OK
Enter the Prefix (or leave the default one DEV) and select the components install…
Click OK and enter the passwords for all the users (2 users) that created in the following screen…
Click Next
Click OK
Click OK
Click Create
Click Close..we are done with RCU

OBIEE11g (11.1.1.6) Installation Steps
Download all the OBIEE11g 64 bit files from Oracle site and unzip all the files and click on “setup.exe” on disk 1 to start the installation process.

 
 Click on next
 
Click on Skip software updates and click next
 
Click on simple install and click next
 
Click next
 
Create a OBIEE11g home directory and ensure there are no spaces on the folder name. Locate the folder and click next.
 
Provide the Administration user name and password.
 
Click next
 
Provide the connect string and metadata schema name (DEV_BIPLATFORM)
 
Click next
 
Uncheck the security update and click next.
 
 Click on Install
 
 Once the configuration is 100% complete, click on next.
Once the installation is complete click finish. The system will open up the analytics page.
 
Login with the weblogic user ID and Password and check the sample reports.



How to take Thread dump in Weblogic(linux/windows) using the WLST script



Action Plan

1. Save the content of the script as "ThreadDumps.py".
2. Modify the script as follows:
2.1 Specify the server name that you are going to monitor (serverName).
2.2 Specify the number of quantity of thread dumps to take (threadNumber).
2.3 Specify the parameters for the connection string: username, password, hostname and port of the Admin Server.
3. Save the file.
4. Set up the environment for WLST. Check the following documentation: http://download.oracle.com/docs/cd/E11035_01/wls100/config_scripting/using_WLST.html#wp1093943
5. Run the script as follow: java weblogic.WLST ThreadDumps.py
6. As the result of the script, you will get some dmp files that contain the thread dumps.


The following script will take 5 thread dumps on the server "ManagedServer1", 15 seconds apart form each other. 

Linux

*****************************************************************

connect('weblogic','weblogic1','localhost:7001')

from time import strftime
from java.text import SimpleDateFormat
serverName = 'ManagedServer1'
counter = 0
sleepTime = 15000
threadNumber = 5

for counter in range(threadNumber):
        currentDate = java.util.Date().toString()
        myDate = currentDate.split(' ');
        finalDate = myDate[3]
        java.lang.Thread.sleep(sleepTime)
        fileName = 'dump' + '_' + serverName + '_' + finalDate + '.dmp'
        threadDump('true', fileName, serverName)

disconnect() 

****************************************************************

Windows

This particular version of the script introduces some changes in the way how thread dump files are being saved.

****************************************************************
connect('weblogic','weblogic1','localhost:7001')

from java.lang import *
from java.util import Date

serverName = 'MS1'
counter = 0
sleepTime = 15000
threadNumber = 10

d= Date()

for counter in range(threadNumber):
        currentFile = 'Thread_Dump_%s_%s_%s.log' % (serverName, d.time,counter)
        threadDump(writeToFile='true', fileName=currentFile,serverName=serverName)
        currentFileRead = open(currentFile, 'r')
        currentFileRead.close()
        Thread.sleep(sleepTime)

disconnect()
*****************************************************************

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
-------------------------------------------------------------------------------------------------------------------------------------------------------------