Monthly Archives: July 2013

Shell script to keep 10 recent files and delete all oldest

ls -t *.log | sed -e '1,10d' | xargs rm

AMQ8101: WebSphere MQ error (893) has occurred

Problem:

You experience following error while creating/starting/stopping/deleting a queue manager

AMQ8101: WebSphere MQ error (893) has occurred

And queue manager error logs are showing following error message

AMQ6119: An internal WebSphere MQ error has occurred ('28 - No space left on device' from semget.)

Cause:

max number of semaphore arrays are lower than required by queue manager.

root@mq:~# cat /proc/sys/kernel/sem
250     32000   32      128

Solution:

Increase maximum number of semaphore arrays limit

root@mq:~# echo "250 32000 32  256" > /proc/sys/kernel/sem

Clearing WebSphere MQ shared memory resources

if it is necessary to remove IPC resources owned by mqm, follow these instructions.

WebSphere MQ provides a utility to release the residual IPC resources allocated by a queue manager. This utility clears the internal queue manager state at the same time as it removes the corresponding IPC resource. Thus, this utility ensures that the queue manager state and IPC resource allocation are kept in step. To free residual IPC resources, follow these steps:

    1. End the queue manager and all connecting applications.
    2. Log on as user
      mqm
    3. Type the following:

      On Solaris, HP-UX, and Linux:

      /opt/mqm/bin/amqiclen -x -m QMGR 

      This command does not report any status. However, if some WebSphere MQ-allocated resources could not be freed, the return code is nonzero.

  1. Explicitly remove any remaining IPC resources that were created by user
    mqm.

If you want to remove all shared memory resources and semaphores that belong to user mqm:

ipcs -m | awk ' $3 == "mqm" {print $2, $3}' | awk '{ print $1}' | while read i; do ipcrm -m $i; done
 ipcs -s | awk ' $3 == "mqm" {print $2, $3}' | awk '{ print $1}' | while read i; do ipcrm sem $i; done 

Note: If you do this when you’ve got more than 1 QM, or things like client trigger monitors running on the same box, you’ll be in big trouble. Run this only if you want to clear everything!

Array ( [marginTop] => 100 [pageid] => @techish1 [alignment] => left [width] => 292 [height] => 300 [color_scheme] => light [header] => header [footer] => footer [border] => true [scrollbar] => scrollbar [linkcolor] => #2EA2CC )