How to IBM MQ - Backup and Clearing Messages on queues in linux? - ibm-mq

I have tried saveqmgr and dmpmqcfg. i cannot get expected output.
dmpmqcfg -m qm.apple -t all -a -x all -o setmqaut
I am using MQ_7.5 version. Which command is used to take backup of MQ Message queue in linux

You can use a command similar to the following to backup the details of a specific queue (TEST.QUEUE in this example). The output will include both the DEFINE Q command along with SET AUTHREC commands to restore any OAM permissions granted to that specific queue. Note that this command will not backup OAM for any other queue or wild carded permissions.
dmpmqcfg -m qm.apple -n TEST.QUEUE -t queue -a -x all -o 1line
To backup the data in the queue you can use the MO03 SupportPac (aka QLOAD) from IBM. This SupportPac from IBM has been withdrawn because at v8 of the product it was integrated and renamed to dmpmqmsg. For versions of MQ prior to v8 you can still download the MQ03 SupportPac at the above link. The original author of the SupportPac also now maintains a version of the program called QLOAD.
Example command below will backup a queue called TEST.QUEUE with out removing the messages from the queue (change the -i to capital -I to also remove them from the queue).
qload -m qm.apple -i TEST.QUEUE -f TEST.QUEUE.qload
Output will show how many messages were read and written, example output is below:
Read - Files: 0 Messages: 3 Bytes: 4
Written - Files: 1 Messages: 3 Bytes: 4
Example command below will put the messages from the file back onto the queue.
qload -m qm.apple -f TEST.QUEUE.qload -o TEST.QUEUE

Related

QLoad utility to connect remote

Is it possible to use qload utility to connect to remote queue manager.
I am not able to connect currently and has anyone tried and connected, if so how?
QLoad version : 1.9
I cant see any documentation on how to connect to remote queue manager.
I also tried set MQSERVER variable from command line before executing the command.
qload -m <QM> -i <Queue> -f <filename>
QLOAD Program by Paul Clarke [ V1.9 Build:Jun 19 2012 ]
MQCONN on object '<QM>' returned 2058 QMgr name error..
Invoke QLOAD as follows to use the client libraries.
qload -m <QM> -i <Queue> -l mqic -f <filename>
The -l flag allows to chose the library to be used, mqic vs mqm. The default if the flag is omitted is to use mqm. You can read documentation for a rather more up-to-date version of qload here.
Alternatively, if you want to continue to use the mqm library, you can set the MQ_CONNECT_TYPE environment variable, as described here to make a client connection using the mqm library.

Getting Snmpwalk Timeout Error for AIX Server

I am trying to run the batch file which will do snmp walk for two AIX server. Here the problem is for the first device the walk is completed successfully but for the second device it is throwing "SNMP Timeout Error".
I have tried using the batch file which i created and using snmpwalk.exe. In snmpwalk.exe for both device the walk is happening but through batch file the device which is processing first will give the correct result and for the second one it is throwing timeout error.
#echo off
"C:\Program Files (x86)\test\snmpwalk.exe" -v3 -u test -a MD5 -A XXX -x DES -X YYY 172.21.20.19 .1.3
"C:\Program Files (x86)\test\snmpwalk.exe" -v3 -u test -a MD5 -A XXX -x DES -X ZZZ 172.21.20.21 .1.3
In environment where multiple devices enabled with SNMP, the snmpEngineID must be unique as it is the unique identifier.
In some cases, using cloned devices creates duplicate snmpEngineID in network results in above mentioned behavior (i.e., throwing SNMP timeout). In order to avoid this, do reset the hostID once cloned. Reference.

How to backup and delete first message in the queue using Shell Script in IBM MQ?

I need to backup the queue and delete the first message in the queue. I have used the below code
./qload -m qmgr SYSTEM.CLUSTER.TRANSMIT.QUEUE -r 1
Also I need to display first message has been deleted
I have found the answer.It works for me
qload -m $qmgr -I $qname -f <qmgr>_<qname>_<date>.log -r 1

How to restore clustered queue to its pre-cluster state in IBM MQ using linux?

` I need to restore clustered queues to its pre-cluster state which was previously removed from cluster. Is there any option to restore those removed queue to its cluster state. Thanks in advance
You can restore queues to the cluster that were previously part of the cluster using a backup created with the dmpmqcfg program prior to removing the queues from the cluster. This backup is only as current as of the date of your backup.
This command will output all queues:
dmpmqcfg -m <QMGR> -n TEST.QUEUE -t queue -a -x all -o 1line
This command will output only queues that have either CLUSTER or CLUSNL set to any value:
dmpmqcfg -m <QMGR> -t queue -a -z all -o 1line | grep "^DEFINE" | egrep -v "CLUSNL\(' '\) CLUSTER\(' '\)|^DEFINE QMODEL"
Running the commands generated prior to removing the queue(s) from the cluster would put them back into the cluster.
Note that this assumes that if you are using CLUSNL that you did not delete the NAMELIST

How to take queuemanager backup and restored in linux

Hello I have queue manager with name QM_1. Here I have taken backup of QM_1 like following.
after that I created queue manager(QM_1) with same name in other system and I need to restore the save qmgr properties. Pls provide how to restore the queuemanager properties?
saveqmgr -m QM_1 -f
Some of the options are are on the SupportPac MS03 landing page. (MS03 is the SupportPac that contains the saveqmgr program.) Detailed instructions are in the download documentation. The following instructions are copied from the SupportPac MS03 page:
You can run the following saveqmgr command (see below) to create 2 output files. Both output files are text and they can be edited.
one with the object definitions (using option -f) - the file name in this example is: qmgr_data.mqsc
the other with the authority records (using option -z which generates entries for setmqaut)
the file name in this example is: qmgr_auth.bat (in Windows) or qmgr_auth.sh (in UNIX)
The following command saves both the objects and the authority records:
UNIX:
saveqmgr -m QMGR -f /tmp/mq/qmgr_data.mqsc -z /tmp/mq/qmgr_auth.sh
Windows:
saveqmgr.exe -m QMGR -f C:\temp\mq\qmgr_data.mqsc -z C:\temp\mq\qmgr_auth.bat
The file qmgr_data.mqsc can be run as follows when trying to restore the contents into a new queue manager:
runmqsc TEST < qmgr_data.mqsc
The file qmgr_auth.bat (in Windows) or qmgr_auth.sh (in UNIX) has stand-alone entries that invoke the setmqaut command with the proper parameter for each authority record. This batch/script file will need to be executed in order to restore the authority records.
UNIX:
chmod u+x qmgr_auth.sh
./qmgr_auth.sh
Windows:
qmgr_auth.bat
To find this and all the other SupportPacs, go to the SupportPac landing page here.
Update 6 November 2014:
Although OP asked how to restore from a saveqmgr backup, it is worth noting that IBM has provided the dmpmqcfg command beginning with version 7.1. You can back up the QMgr in MQSC format using this syntax:
dmpmqcfg -m [QUEUE_MANAGER] > BACKUP_FILE.mqsc
This captures the object deinifions and the authorizations in a single file. The authorizations are captured as SET AUTHREC entries rather than as setmqaut commands by default.
Please note that the initial versions of dmpmqcfg did not capture all of the authorization settings that you might have defined. It is necessary for all versions to apply the latest Fix Pack to get a reliable backup using dmpmqcfg. This behavior may regress in later Fix Packs so it is advisable to reconcile your backup against your auths creation script when switching to this command and after applying a Fix Pack.
Restore a QMGgr from the dmpmqcfg file the same as you would from the saveqmgr file:
runmqsc [QMNAME] < output_of_dmpmqcfg_or_saveqmgr.mqsc > logfile.txt 2>&1
This runs the MQSC file definitions into the QMgr (including SET AUTHREC commands) and saves the output of STDOUT and STDERR to a log file.

Resources