Increasing shared memory segments

When WebSphere® Business Monitor attempts to process an event on the AIX® platform , an SQL error is returned. And also when WebSphere fails to initialize database connection, both during startup or event processing. The failure results from an operating-system-imposed limit on the number of shared memory segments available to IBM® DB2®.

when a Test Connection from WebSphere Admin Console (jdbc resources) fails with the following error:
Test connection failed for data source MonitorDataSource on server server1 at node Node01 with the following exception: java.lang.Exception: java.sql.SQLException: SQL1224N A database agent could not be started to service a request, or was terminated as a result of a database system shutdown or a force command.  SQLSTATE=55032 DSRA0010E: SQL State = 55032, Error Code = -1,224.
This error likely indicates that the number of shared memory segments allowed by AIX to the database has been exceeded.

When this error occurs, you must change the DB2 configuration to increase the number of shared memory segments. Currently, recovery expert does not support the use of defining a DB2 alias with a loopback to avoid the shared memory problem.

Solution

An extended shared memory feature is used by DB2 that circumvents this problem. To enable this feature, place the following lines near the beginning of both /etc/rc.db2 and <instance_home>/sqllib/db2profile, (where <instance_home> is the home directory of each instance user; for example, /home/db2inst1) after the block comment, but before any executable lines:
# Local addition to fix AIX shared memory problem:
EXTSHM=ON
export EXTSHM
Note: The entry is case sensitive. Place the entry in the db2profiles of all instance users and the administrator server user. Then log in as each instance user and the administrator server user, and execute the following command:
db2set DB2ENVLIST=EXTSHM

This sets a DB2 profile variable within each instance that causes the value of the EXTSHM environment variable to be included in the environment of the DB2 daemon processes as they are started. Defining EXTSHM in the db2profiles of each instance, which are executed at login, ensures that the variable is set in any instance-owner environment. Finally, putting it in /etc/rc.db2 ensures that the variable is set when the DB2 processes are started at startup time. Finally, restart the system to ensure that all DB2 processes are started with EXTSHM=ON in their environment.

If you want the fix to be automatically applied to new instances when they are created in the future, add the lines that set and export EXTSHM to the file /usr/lpp/db2_08_02/cfg/db2profile, which is copied to <instance_home>/sqllib/db2profile on instance creation. To ensure that the DB2ENVLIST profile variable is also set, add this code after the variable INSTHOME is set:
if [ -x $INSTHOME/sqllib/adm/db2set ]
    then if [ "`$INSTHOME/sqllib/adm/db2set DB2ENVLIST`" != "EXTSHM" ]
    then $INSTHOME/sqllib/adm/db2set DB2ENVLIST=EXTSHM
    fi
    fi 
This code causes the DB2ENVLIST instance profile variable to be set the first time a new instance is used.
Note:
  • It is assumed that DB2Version 8.0 is installed under /usr/lpp/db2_08_02. If your installation is elsewhere, you must work with your install location.
  • For DB2 version 8.0, you should add the following lines to the <instance_home>/sqllib/userprofile file, if it exists; otherwise, create a user profile file with permissions 755 . The lines are :
    EXTSHM=ON
    export EXTSHM 

Copyright IBM Corporation 2005. All Rights Reserved.