How to delete/backup/restore old/new message from a queue in ibm mq

dmpmqmsg traditionally called qmload used to display ,delete ,backup the message from the queue and also can use to move the message from one queue to another queue .

Display the queues that are defined in the Queue manager 

echo ‘dis q(*) where(CURDEPTH gt 0)’ | runmqsc QMGRNAME1| tr ‘)’ ‘\n’ | grep “QUEUE(” | tr “(” “\n” | grep -v “\sQUEUE$” | grep -v “SYSTEM”

dmpmqmsg -m $QMgr -I$QName -T02:00:00 -F/home/mqm/${QMgr}_${QName}_%c_%HH%M%S.txt

-F to dump messages to files

T with single digit is for min, N:NN for hours and N:NN:NN for days 

I will use get operation 

i will use browse operation 

Here we will see some of the useful scenarios 

For example:

Display messages older than five minutes

dmpmqmsg -m QM1 -i Q1 -fstdout -T5

Display messages younger than five minutes

dmpmqmsg -m QM1 -i Q1 -fstdout -T,5

Display messages older than one day but younger than two days.

dmpmqmsg -m QM1 -i Q1 -fstdout -T1440,2880

The following command copies messages older than one hour from Q1 to Q2.

dmpmqmsg -m QM1 -i Q1 -o Q2 -T1:0

The following command moves messages older than one week from Q1 to Q2

dmpmqmsg -m QM1 -I Q1 -o Q2 -T7:0:0

To delete all messages, without backuping messages to files, you need to use command (without “-T” & “-F” keys):

dmpmqmsg -m $QMgr -I$QName

Display the ages of messages currently on a queue

Use the following options on the command line:


dmpmqmsg -m QM1 -i Q1 -f stdout -dT

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *