Friday, July 29, 2011

ORA-12516, TNS:listener could not find available handler with matching protocol stack

In one of my SOA project, we are running SOA Suite 11g - 11.1.1.4  on Weblogic 11g Cluster in Bladframe machine. Backend used here for SOA Schema database is Oracle 11g RAC database.

After couple of weeks of successfully execution in developement environment we hit this issue of  ORA-12516, TNS:listener. This error generally means there is no connection available to the database.We need to configure the database to allow more connection.

As suggested by Oracle, we should have number of processes setting to 200 for SOA Suite 11g. This setting is already in place and still we hit the ORA-12516, TNS:listener-issue. This happens mostly because of wrong Data sources connection settings, which allows to exapand its connection pool to hundreds of connections.

Even while restarting the weblogic server you will not be able to get the weblogic server in running mode , because all data sources will fail while trying to connect to database and you server state will go to Admin mode because of this.

Solution to ORA-12516, TNS:listener Error

  1. Loging to one of the database node using sqlplus as sys or system (basically sysdba role required)
  2. Increase the number processes and sessions by executing below commands
    • ALTER SYSTEM SET PROCESSES=400 SCOPE=SPFILE;
    • ALTER SYSTEM SET SESSIONS=400 SCOPE=SPFILE;
  3. Bounce the database again to take these changes
    • SHUTDOWN IMMEDIATE;
    • STARTUP;
  4. To Verify the settings are updated properly; execute below sql commands
    1. SHOW PARAMETERS PROCESSES;
    2. SHOW PARAMETERS SESSIONS;
If you are using Oracle RAC database you may want to perform these steps again on another node.

Thursday, July 14, 2011

Installing Oracle XE 11g Database on Redhat 5.6 / Linux 64 bit

Recently Oracle has announced the Beta release of Oracle Express Edition (XE) 11g. Below is the step by step process for the installation of Oracle XE 11g database on Linux x86-64 machine.

Installation of Oracle XE 11g is pretty straight forward process and all step by step installation steps are included here in this tutorial. All XE version of oracle are very easy to install and configure while you are in development mode.

Oracle XE 11g Installation steps :
  1. You can download the most recent version of Oracle XE 11g database by refering the details on http://www.oracle.com/technetwork/database/express-edition/overview/index.html.
  2. This installation will require minimum of 1.5 GB of RAM, so please make sure you have required space available on your machine.
  3. Swap space required is 2 GB or twice the size of RAM. Whichever is less.
    1. To check current you can run command swapon -s on shell.
  4. And to start the installation it requires root permission on linux box.
  5. execute the below command to install the Oracle XE 11g 
  6. Oracle does not provide a way to install Oracle XE 11g on particular directory. It will install it directly on root /u01 but if you want to install this on directory of your choice use my post Hacker's choice.
  7. rpm -ivh oracle-xe-11.2.0-0.5.x86_64.rpm below is the command with output
  8.  rpm -ivh oracle-xe-11.2.0-0.5.x86_64.rpm
    Preparing...                ########################################### [100%]
       1:oracle-xe              ########################################### [100%]
    Executing post-install steps...

    You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.
  9. Execute below command to configure Oracle XE 11g database.
    $ /etc/init.d/oracle-xe configure
  10. It will ask for HTTP Port , database listener port, and password for the database which will be used for SYS and SYSTEM. Below is the complete installation output.
  11. --> /etc/init.d/oracle-xe configure

    Oracle Database 11g Express Edition Configuration
    -------------------------------------------------
    This will configure on-boot properties of Oracle Database 11g Express
    Edition.  The following questions will determine whether the database should
    be starting upon system boot, the ports it will use, and the passwords that
    will be used for database accounts.  Press to accept the defaults.
    Ctrl-C will abort.

    Specify the HTTP port that will be used for Oracle Application Express [8080]:

    Specify a port that will be used for the database listener [1521]:

    Specify a password to be used for database accounts.  Note that the same
    password will be used for SYS and SYSTEM.  Oracle recommends the use of
    different passwords for each database account.  This can be done after
    initial configuration:
    Confirm the password:

    Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:

    Starting Oracle Net Listener...Done
    Configuring database...Done
    Starting Oracle Database 11g Express Edition instance...Done
    Installation completed successfully.

     
  12. Now start the Oracle XE 11g database by using below command
  13. --> /etc/init.d/oracle-xe start
  14. If you want to stop command is --> /etc/init.d/oracle-xe stop
    Uninstalling the Oracle XE 11g #
    --> rpm -qa | grep oracle 
    --> rpm -e oracle-xe
     
     

Hacker's Choice - How to Install Oracle 11g XE on Specified Targeted Directory

If you are installing Oracle 11g XE on Linux machine, it is getting installed by default on root (/). And it does not provide a way to change.

Oracle is not providing a way to specify the destination directory / user defined directory for Oracle XE 11g Database. So here is the hack for how to install Oracle XE database on directory of your choice.

create a symbolic link with the name /u01 in root directory which point to /app/oracle.
For Oracle XE 11g  use below commands
--> cd /
--> ln -s / u01

Same trick works for Oracle XE 10g as well.

And .... yeah enough you are done. Go ahead with your normal installation and it will be installed to /app/oracle.

How to enable GUI while connecting to Remote Redhat / Linux machine using Putty

Hi, This post cover details about how we can enable GUI interfacing using Xserver while connecting to Remote Redhat 5.6 / Linux Machine using Putty on Windows based local machine.

First all of you need to install Xserver in your local box. Here is the download location for Windows. Here Xserver will be installed using Xming.
Location :  http://sourceforge.net/projects/xming.

After downloading install the Xming server in your localbox and run it with option ":0 -clipboard -multiwindow -ac". To do this, right click the short cut of Xming -> go to properties -> and in target  its should look similar to this "C:\Program Files\Xming\Xming.exe" :0 -clipboard -multiwindow -ac (here double quates are part of the string itself), depending on the location of Xming installation path may change.

On Redhat / Linux machine has feature called X11Forwarding, depending on the value of this parameter it enables or disables the display of graphics on the server.

On Redhat / Linux machine
For example, 
  1. login on Linux/BSD system called myserver.mydomain.com
  2. Open /etc/ssh/sshd_config file using text editor:
    1. # vi /etc/ssh/sshd_config
  3. Find out parameter X11Forwarding and set it to yes:
    1. X11Forwarding yes
    2. Save file & exit shell prompt
  4. Restart sshd service under Debian Linux:
    1. # /etc/init.d/ssh restart
    2. Alternatively, if you are using Fedora / Red Hat Linux restart sshd:
    3. # /etc/init.d/sshd restart

Client Side Setting on Windows Machine
For connecting to Redhat Linux box I am using the most popular SSH client putty. Below are the steps to configure putty on Windows machine.

  1. Run the putty.exe
  2. provide Host Name (or you can use IP address of host machine as well
  3. Select SSH as Connection Type 
  4. Port should be 22 default
  5. Enter again the same name as you entered in Hostname in to Saved Session Input box.
  6. In Connection Category, Find out the Connection Tree. In SSH, expand it and you will see "Enable X11 Forwarding".. 
  7. Enable X11 Forwarding by selecting the check box
  8. X Display location  should be set to localhost:0
  9. Save this entire information as a session by click on Save button
  10. Now start the Xming Server on location machine
  11. Now connect to the Redhat / Linux Machine using saved session from putty
  12. And to verify that Graphics are enable use this command xclock &
  13. You should be able to new graphical window coming up.
Now you are all set to roll, you can execute and run any GUI based application from the Redhat / Linux box and it will get displayed on you local machine. Makes your life much easier :) cheers

Monday, July 4, 2011

Purging / Deleting / Limiting Database Growth in SOA Schema in SOA Suite 11g

This post is about how to control the SOA database schema and its growth while running SOA Suite 11g. All the instructions given here are specifically for SOA Suite 11g version 11.1.1.4. From this version onward there are new scripts provided by Oracle and only updated scripts should be used as this version has schema and table structure changes.

There are basically three ways to delete/purge the SOA  Schema database.
  1. Using Enterprise Manager console -> Delete with options
  2. Deleting large number of instances using purge script
  3. Partitioning component database table
Using Enterprise Manager Console : Here, first option, using Enterprise Manager console is ok for small amount of instances where you want to remove one or two thousand instances . For large number of instances it will throw Time out error.There is a option provided in EM console for increasing the timeout period but still its not enough for large amount of data.

Deleting Large Number Of Instances Using Purge Script :  This is very useful and straight forward process to clean up SOA database schema. In real world , server are receiving millions of requests in a day and keeping these all data as instances in SOA Suite database schema is very costly. It can affect a performance of the server up to some extent. After few days or month probably you will start receiving table space errors as allotted all the table sapce is already been used by the instances created within SOA database schema. For this reason you need to plan your tablesapce accordingly and generally it should be in between 50 GB - 80 GB in loaded server. And still it requires regular purging for data on the SOA database.

Below is the process for purging / deleting the composite instances from SOA Database schema.

1. First of all you will required Repository creation utility for 11.1.1.4. This installable contain the all required purging script provided by oracle to purge the database schema. You can find the purge script at location RCU_HOME/rcu/integration/soainfra/sql/soa_purge.

Note : this script can not run with Microsoft SQL Server and IBM DB2 Database.

2. In SQL*Plus, connect to the database AS SYSDBA:

3. Execute the following SQL commands:
                      GRANT EXECUTE ON DBMS_LOCK to dev_soainfra;
                      GRANT CREATE ANY JOB TO dev_soainfra;

4. RCU_HOME/rcu/integration/soainfra/sql/soa_purge/soa_purge_scripts.sql

5. execute SET SERVEROUTPUT ON on SQL prompt

6.  execute below SQL block and description of each variable is given below

  • min_creation_date : minimum date when instance was created
  • max_creation_date : Maximum date when instance was created
  • batch_size :Batch size used to loop the purge. The default value is 20000.
  • max_runtime :Expiration at which the purge script exits the loop. The default value is 60. This value is specified in minutes. 
  • retention_period :Retention period is only used by the BPEL process service engine only (in addition to using the creation time parameter). The default value is null
  • purge_partitioned_component  : Users can invoke the same purge to delete partitioned data. The default value is false

DECLARE

   MAX_CREATION_DATE timestamp;
   MIN_CREATION_DATE timestamp;
   batch_size integer;
   max_runtime integer;
   retention_period timestamp;

BEGIN

   MIN_CREATION_DATE := to_timestamp('2011-06-23','YYYY-MM-DD');
   MAX_CREATION_DATE := to_timestamp('2011-07-03','YYYY-MM-DD');
    max_runtime := 15;
    retention_period := to_timestamp('2011-07-04','YYYY-MM-DD');
   batch_size := 5000;
     soa.delete_instances(
     min_creation_date => MIN_CREATION_DATE,
     max_creation_date => MAX_CREATION_DATE,
     batch_size => batch_size,
     max_runtime => max_runtime,
     retention_period => retention_period,
     purge_partitioned_component => false);
  END;


 Here is very important to note that this script provided is able to delete instances from database schema however it will not free up the memory of that table / tablespace.

For freeing up the memory you can try this option below on tables.

alter table enable row movement.
alter table shrink space;