Wednesday, 3 April 2013

What is a Resource Manager, Transaction & Syncpoint

What is a resource manager?
A resource manager is a computer subsystem that owns and manages resources that can be accessed and updated by applications (i.e., WMQ queue manager – whose resources are its queues, DB2 database – whose resources are its tables).

What is a unit of work?
When a application updates the resources of one or more resource managers, it's often vital that all updates complete successfully as a group, or none of them complete. Updates that complete this way are said to occur within a 'unit of work' or 'transaction'.

What is a sync point coordinator?

The point in time when all updates within a unit of work are either committed or backed out is called a 'sync point'. The computer subsystem that manages units of work is called a sync point coordinator.

What Is Dead Letter Queue & Dead Letter Handler

Dead Letter Queue (DLQ)

- When messages can not be delivered to the intended queue, the messages may be delivered to a Dead Letter Queue (DLQ) if the queue manager has one defined.

- By default a queue manager does not have a Dead Letter Queue but you should define one for every queue manager.

- In every Queue Manager default dead letter queue is SYSTEM.DEAD.LETTER.QUEUE.


Dead Letter Messages

1) Messages can be placed on the DLQ by the queue manager, the channels (MCA) or by applications
2) When the messages are put onto DLQ, they should have a Dead Letter Header (DLH). DLH will be generated by Queue manager and MCA.
3) If application are putting the messages onto DLQ, applications must create the Dead Letter Header (DLH) to message.

Dead Letter Queue Handler

Once a message arrives on the DLQ you can automate the handling of that message using the DLQ handler program. You can have the handler running and waiting for messages to arrive on the DLQ or you can set up the DLQ to trigger the start of the handler program

Starting the DLQ Handler
You can start the DLQ handler using the RUNMQDLQ command.
Example: RUNMQDLQ -Q <DEDA LETTER QUEUE NAME> -M <QMGR NAME>  <rules.tb

where DLQ = name of your dead letter queue
QMGR = queue manager name and
rules.tb is a file with your rules table

Rules Table
It Defines how the DLQ handler will process the messages on the DLQ
Two types of entries in the rules table
-Control Data
-Rules

runmqdlq can take rules table from command line or redirect from file.

Sample Program

Websphere MQ supplies a sample program called amqsdlq which provides similar function as runmqdlq. This allows users to customize the way messages are handled from the DLQ, especially useful if you have applications placing messages directly onto DLQ.

How to write Rules in rule table explained
Rule table is looks something like: Pattern/Keyword Action. ( simillat to find a particular keyword and the do the action specified)

Pattern Keywords – allow you to match only certain messages on the DLQ
Ex: REASON – match only messages with a specified reason code

Action Keywords describe how a matching message is processed
ACTION(DISCARD|IGNORE|RETRY|FWD)
FWDQ – name of queue where message is forwarded
FWDQM – name of qmgr where message is forwarded
HEADER(YES|NO) – do messages have DLH header
PUTAUT(DEF|CTX) – userid of runmqdlq program or userid from the MD of the message on the DLQ
RETRY – number of times to retry each matching rule

More about Rule Table
1) A rules table must contain at least one rule.
2) Keywords can occur in any order.
3) A keyword can be included only once in any rule.
4) Keywords are not case-sensitive.
5) A keyword and its parameter value must be separated from other keywords by at least one blank space or comma.
6) There can be any number of blanks at the beginning or end of a rule, and between keywords, punctuation, and values.
7) Each rule must begin on a new line.
8) For reasons of portability, the significant length of a line must not be greater than 72 characters.

Sample Rule Table
***************************************************
* An example rules table for the runmqdlq command *
***************************************************
* Control data entry
* ------------------
* If parameters are not supplied on the runmqdlq command use
* SYSTEM.DEAD.LETTER.QUEUE as the input queue, use QM1_TEST as the
* queue manager and set retry interval to 20 seconds
inputq('SYSTEM.DEAD.LETTER.QUEUE') inputqm('QM1_TEST') retryint(20)

* Rules entries
* -----
* Include a rule with ACTION (RETRY) first to try to deliver the
* message to the intended destination. If a message is placed on the
* DLQ because its destination queue is full, attempt to forward the
* message to its destination queue. Make 5 attempts at approximately
* 20 second intervals (the default value for RETRYINT). Also include
* the "+" just to show how to wrap a command over to the next line.
REASON(MQRC_Q_FULL) ACTION(RETRY) RETRY(5)
* If a message is placed on the DLQ due to put inhibited, attempt to
* forward the message to its destination queue. Make 5 attempts at
* approximately 20 second intervals (the default value for RETRYINT).
REASON(MQRC_PUT_INHIBITED) ACTION(RETRY) RETRY(5)
* Include a rule to handle messages which do not match any of the
* patterns specified above. Send the messages to another queue named
* DEADQ where they can be handled later.
ACTION(FWD) FWDQ('DEADQ')

Runmqdlq examples
If you use the DLQ handler without redirecting stdin from a file (the rules table), the DLQ handler reads its input from the keyboard.
In WebSphere MQ for AIX, Solaris, HP-UX, and Linux, the DLQ handler does not start to process the named queue until it receives an end_of_file (Ctrl+D) character.
In WebSphere MQ for Windows it does not start to process the named queue until you press the following sequence of keys: Ctrl+Z, Enter, Ctrl+Z, Enter

C:\>runmqdlq SYSTEM.DEAD.LETTER.QUEUE QM1_TEST
WAIT(YES) RETRYINT(20)
REASON(MQRC_Q_FULL) ACTION(RETRY) RETRY(5)
REASON(MQRC_PUT_INHIBITED) ACTION(RETRY) RETRY(5)
REASON(*) ACTION(FWD) FWDQ('DEADQ')
^Z

2005-04-08 02.20.09 AMQ8708: Dead-letter queue handler started to process
INPUTQ(SYSTEM.DEAD.LETTER.QUEUE)



Friday, 5 October 2012

MQ Reason Codes


 2001

2009

2016

2025

2027

2029

2030

2031

2033

2035

2036

2037

2038

2039

2040

2101

2537

2538

2539

2540

2051

2052

2053

2058

2059

2092

2196

2195

2197

2198

2199

2189
MQRC_ALIAS_BASE_Q_TYPE_ERROR

MQRC_CONNECTION_BROKEN

MQRC_GET_INHIBITED

MQRC_MAX_CONNS_LIMIT_REACHED

MQRC_MISSING_REPLY_TO_Q

MQRC_MSG_TYPE_ERROR

MQRC_MSG_TOO_BIG_FOR_Q

MQRC_MSG_TOO_BIG_FOR_Q_MGR

MQRC_NO_MSG_AVAILABLE

MQRC_NOT_AUTHORIZED

MQRC_NOT_OPEN_FOR_BROWSE

MQRC_NOT_OPEN_FOR_INPUT

MQRC_NOT_OPEN_FOR_INQUIRE

MQRC_NOT_OPEN_FOR_OUTPUT

MQRC_NOT_OPEN_FOR_SET

MQRC_OBJECT_DAMAGED

MQRC_CHANNEL_NOT_AVAILABLE

MQRC_HOST_NOT_AVAILABLE

MQRC_CHANNEL_CONFIG_ERROR

MQRC_UNKNOWN_CHANNEL_NAME

MQRC_PUT_INHIBITED

MQRC_Q_DELETED

MQRC_Q_FULL

MQRC_Q_MGR_NAME_ERROR

MQRC_Q_MGR_NOT_AVAILABLE

MQRC_XMIT_Q_USAGE_ERROR

MQRC_UNKNOWN_XMIT_Q

MQRC_UNEXPECTED_ERROR

MQRC_UNKNOWN_DEF_XMIT_Q

MQRC_DEF_XMIT_Q_TYPE_ERROR

MQRC_DEF_XMIT_Q_USAGE_ERROR

MQRC_CLUSTER_RESOLUTION_ERROR

Saturday, 29 September 2012

Linux Basic Commands

$ -- Normal User Prompt
# -- System Admin Prompt

Commands

$ logname  (or) whoami  --------- To Check Present Working User

$ who ---------------------------- To Know Present Working Users
$ hostname --------To Know HostName(Machine Name) Of A Server
$ ifconfig ---------- To Find an IP 
$ lscpu ------------- To check CPU architecture
$ su [super user name] ---- Switch to Super User
$ clear---------- To Clear Screen
$ exit ------------To exit From user Session
$ man [cmd]----------- Help Facility 
$ date ----------- To Display date 
$ cal [month] [year] ----- To Display Calender
$ pwd ---------- To Know Present Working Directory
$ ls [flags]--------------To Display Directory Content
$ mkdir [dir name]---------- To Create New Directory
$ cd  [dir name] -------------- To Change Directory
$ mv [oldname] [newname) -------- To Rename Directory 
$ rmdir [Directory Name] ---------- To delete directory
$ mv [source path] [target path] ---- To Move directory with sub directories 
$ cp [source path] [target path] ---- To Copy directory with sub directories 
$ cat > [file name] ----------------- To Create  File
$ cp [source file] [target file] ------- To Copy A File
$ mv [Old File] [New File] --------- To Rename A File
$ rm [file name] --------------------- To Remove A File
$ locate [file name] ------------------- To Search A file In Whole File System
$ find [file name] [path] ---------------- To Search A file in Specified Path
$ gzip [file name] ---------------------- To Compress A File
$ gunzip [file name] ------------------- To Uncompressed A File
$ chmod [777] [file name] ------------- To Change File Permissions 
$ chown  [new owner name] [file name] --- To Change Owner
$ chgrp [new group name] [file name] ----- Change Group To A File
$ useradd -u [uid] -g [group name] -d [user home dir] -s [shell]- Creating New User
$ groupadd -g [group id] [group name] ------ To Create New Group
$ userdel [user name] ------ To Delete  User
$ shutdown [time] -------- To Shutdown System At Particular Time
$ shutdown -r now ------------- Shutdown and reboot immediately
$ shutdown -h halt -------------- Shutdown immediately and halt
$ df/df-k/df -g/df -h ---------- To Check Free Disk Space
$ du / du -s [dir name] ------- To Check Used Space 
$ vi [file name] -------------- To Open a File with VI Editor
$ head -n [no of lines] [file name] ---- To Display First N line in A File
$ tail -n [no of line] [file name] --------  To Display Last N lines In A File
  

Friday, 28 September 2012

Cluster Commands

How To Display Cluster Queue  Managers
DISPLAY CLUSQMGR(*)

How To Display Cluster Queues In Cluster Queue Manager
DISPLAY QCLUSTER(*)
How To Display Cluster Channels Status
DISPLAY CHSTATUS(*)
How To Know A Queue Manager Is Full Repository or Not  
DISPLAY CLUSQMGR(QMGR-NAME) QMTYPE

How To Suspend Queue Manager From Cluster
SUSPEND QMGR CLUSTER(CLUSTER-NAME)  
How To Know A Queue Manager Suspended or Active QMGR 
DISPLAY CLUSQMGR(QMGR-NAME) SUSPEND
How To Resume A Queue Manager To Cluster 
RESUME QMGR CLUSTER(CLUSTER-NAME) 
How To Refresh Cluster  
 REFRESH CLUSTER(CLUSTER-NAME) REPOS(YES/NO)

How To Reset Cluster
RESET CLUSTER(CLUSTER-NAME) QMID(QMGR-QMID) ACTION(FORCEREMOVE) QUEUES(YES/NO) 

Thursday, 27 September 2012

Channel And Listener Commands

Channel Commands
 How To Define channel Object
Sender Channel:
Define Channel(Channel-Name) Chltype(sdr) Conname('ip(port)') xmitq(Transmission queue name)

Receiver Channel:
Define Channel(channel name) Chltype(RCVR) Trptype(TCP)

 How To Display Channel Object
Display Channel(Channel-Name) 
 How To Display Channel Status
Display ChStatus(Channel-Name) 
 How To Alter Channel Object
Alter Channel(Channel-Name) 
Chltype(SDR/RCVR..) 
Maxmsgl(1024(Bytes))
 How To Start Channel
Start Channel(Channel-Name) 
 How To Stop Channel
Stop Channel(Channel-Name) status(Inactive/Stopped)
 How Ping Channel
Ping Channel(Channel-Name) 
 How To Reset Channel
Reset Channel(Channel-Name) Seqnum(1)
How To Delete Channel Object 
Delete Channel(Channel-Name)

Note: Channel Must Be In Down State to Delete.




Listener Commands:

How To Define Listener Object
Define Listener(Lstr-Name) Trptype(TCP/SPX/NETBIOS/LU 62) Port(1515) Control(qmgr/manual) 

How To Display Listener Object
Display LSTR(Lstr_Name) 

How To Alter Listener Object
Alter LSTR(Lstr-Name) Trptype(TCP/SPX/...) Control(qmgr/manual) 

How To Start Listener service
Start LSTR(Lstr-Name)
How To Display Listener Service Status
Display LSStatus(Lstr-Name)
How To Stop Listener Service 
Stop LSTR(Lstr-Name)

How To Delete Listener Object
Delete LSTR(Lstr-Name)


Queue Commands

Queue Commands 

  • Define QLocal(Queue-name)..
  • Define QLocal(Queue-Name) Usage(Xmitq)
  • Define QAlias(Queue-Name) Target(Target-Queue-Name)..
  • Define QRemote(Queue-Nmae) RName(Target-Queue_Name) RQMName(Target-QMGR-Name) Xmitq(Xmitq-Name)
  • Define QModel(Queue_name) Deftype(Tempdyn/PermDyn) ..
  • Display QLocal(Queue-Name)
  • Display Qstatus(Queue-Name)
  • Display QLocal(Queue-Name) Usage
  • Display QAlias(Queue-Name)
  • Display QRemote(Queue-Name) All
  • Display QModel(Queue-Name)
  • Alter QLocal(Queue-name) Maxdepth(10000) Maxmsgl(1024(bytes)) ..
  • Alter QRemote(Queue-Name) Rname(...) RQMName(....) Xmitq(...) ...
  • Alter QModel(Queue-Name) Deftype(TempDyn/PermDyn) ....
  • Alter QAlias(Queue_Name) Target(....) ...
  • Delete QLocal(Queue-Name)
  • Delete QAlias(Queue-Nmae)
  • Delete QRemote(Queue-Name)
  • Delete QModel(Queue-Name)
  • Clear QLocal(Queue-Name)

What Is NameList

NameList:
Use DEFINE NAMELIST to define a list of names. This is most commonly a list of cluster names or queue names.
Note:
  1. On UNIX systems, the command is valid only on AIX, HP-UX, Linux and Solaris.
How To Define NameList
  • Define NL(NameList_name) Names(cluster1,cluster2) ....
Notes:
  1. Valid only on z/OS when the queue manager is a member of a queue-sharing group.
  2. Valid only on z/OS.

Monday, 24 September 2012

What Is Cluster

Cluster:
"A cluster is a network of Queue Managers that are logically connected each other. Each cluster must have a unique name."

If you don't use clusters, your Queue Managers are independent and communicating using DQM (Distributed Queue Management).if one Queue Manager needs to send and receive messages from multiple Queue Managers  it must have defined 

  1. Remote Queues
  2. Transmission Queues
  3. Many sender definitions 
If you group Queue Managers in a cluster, the Queue Manager can make the queues that they host available to every other Queue Manager in the cluster.

Any Queue Manager can send and receive messages to and from other Queue Managers in the same cluster without defining remote queues,transmission queues and to many channels.

In every cluster one full repository is must. Two full repositories are strongly recommended by IBM.
Repository
A repository is a collection of information about the Queue Managers that are members of a cluster. Cluster has two types of repositories 
  1. Full Repository
  2. Partial Repository
Full Repository
A repository Queue Manager hosts a complete set of info about every Queue Manager in the cluster. This set of information is called the repository or some times called as full repository.
Partial Repository
The other queue managers each hold a partial repository, containing information about the subset of queues and queue managers with which they need to communicate. The queue managers build up their partial repositories by making inquiries when they first need to access another queue or queue manager, and by requesting that thereafter they be notified of any new information concerning that queue or queue manager.

Each queue manager stores its repository information in messages on a queue called SYSTEM.CLUSTER.REPOSITORY.QUEUE. The queue managers exchangerepository information in messages on a queue called SYSTEM.CLUSTER.COMMAND.QUEUE.

Default Cluster Queues

SYSTEM.CLUSTER.REPOSITORY.QUEUE

Each queue manager in a cluster has a local queue called SYSTEM.CLUSTER.REPOSITORY.QUEUE. This queue is used to store all the full repository information. This queue is not normally empty.
SYSTEM.CLUSTER.COMMAND.QUEUE
Each queue manager in a cluster has a local queue called SYSTEM.CLUSTER.COMMAND.QUEUE. This queue is used to carry messages to the full repository. The queue manager uses this queue to send any new or changed information about itself to the full repository queue manager and to send any requests for information about other queue managers. This queue is normally empty.
SYSTEM.CLUSTER.TRANSMIT.QUEUE
Each queue manager has a definition for a local queue called SYSTEM.CLUSTER.TRANSMIT.QUEUE. This is the transmission queue for all messages to all queues and queue managers that are within clusters.
SYSTEM.DEF.CLUSSDR
Each cluster has a default CLUSSDR channel definition called SYSTEM.DEF.CLUSSDR. This is used to supply default values for any attributes that you do not specify when you create a cluster-sender channel on a queue manager in the cluster.
SYSTEM.DEF.CLUSRCVR
Each cluster has a default CLUSRCVR channel definition called SYSTEM.DEF.CLUSRCVR. This is used to supply default values for any attributes that you do not specify when you create a cluster-receiver channel on a queue manager in the cluster.

Thursday, 20 September 2012

Types Of Logging

Logging
The type of logging to be used by the queue manager. You cannot change the type of logging to be used once the queue manager has been created. Refer to the description of the LogType attribute in for information about creating a queue manager with the type of logging you require.
CIRCULAR
Use circular logging if all you want is restart recovery, using the log to roll back transactions that were in progress when the system stopped.
Circular logging keeps all restart data in a ring of log files. Logging fills the first file in the ring, then moves on to the next, and so on, until all the files are full. It then goes back to the first file in the ring and starts again. This continues as long as the product is in use, and has the advantage that you never run out of log files.
LINEAR
Use linear logging if you want both restart recovery and media recovery (recreating lost or damaged data by replaying the contents of the log).
Linear logging keeps the log data in a continuous sequence of files. Space is not reused, so you can always retrieve any record logged in any log extent that has not been deleted
As disk space is finite, you might have to think about some form of archiving. It is an administrative task to manage your disk space for the log, reusing or extending the existing space as necessary.
The number of log files used with linear logging can be very large, depending on your message flow and the age of your queue manager. However, there are a number of files that are said to be active. Active files contain the log entries required to restart the queue manager. Collectively, active log files are known as the active log. The number of active log files is usually less than the number of primary log files as defined in the configuration files.

Tuesday, 18 September 2012

Types Of Logs

Logs
IBM MQ has two types of logs
  1. Transaction Logs
  2. Error Logs
Transaction Logs
Transactions like messages inbound, outbound, objects creation, deletion, permission etc.are going to be written to the transaction logs for every QueueManager.
  • Default Path For Log Files On Windows
C:\Program Files\IBM\WebSphere MQ\log\QMGR(QM1)\active\

  1. S0000000.log
  2. S0000001.log
  3. S0000002.log
  • Default Path For Log Files On Linux/Solaris/AIX/Unix
$ /var/mqm/log/QMGR(QM1)/active/

  1. S0000000.log
  2. S0000001.log
  3. S0000002.log

  • Types Of Transaction Logs
Primary Logs
LogPrimaryFiles=3|2-254 (Windows)|2-510 (UNIX systems)
The log files allocated when the queue manager is created.

The minimum number of primary log files you can have is 2 and the maximum is 254 on Windows, or 510 on UNIX systems. The default is 3.



The total number of primary and secondary log files must not exceed 255 on Windows, or 511 on UNIX systems, and must not be less than 3.
The value is examined when the queue manager is created or started. You can change it after the queue manager has been created. However, a change in the value is not effective until the queue manager is restarted, and the effect might not be immediate.
Secondary Logs

LogSecondaryFiles=2|1-253 (Windows)|1-509 (UNIX systems)
The log files allocated when the primary files are exhausted.
The minimum number of secondary log files is 1 and the maximum is 253 on Windows, or 509 on UNIX systems. The default number is 2.



The total number of primary and secondary log files must not exceed 255 on Windows, or 511 on UNIX systems, and must not be less than 3.
The value is examined when the queue manager is started. You can change this value, but changes do not become effective until the queue manager is restarted, and even then the effect might not be immediate.

Log File Size Detail Table 

OS        Min File Size                Default File Size               Max File Size

Win     128 KB (32 Pages)   16 MB (4096 Pages)    256 MB (65535 Pages)
Linux   256 KB (64 Pages)  16 MB  (4096 Pages)    2 GB (65535*8(pages))

Error Logs
The operations going on(running) on MQ series will be written to errorlogs. 
MQSeries have 2 types of error logs
  1. MQ Level Error Logs
The operations or errors which are occurring on MQSeries are considered as MQSeries level errors.

Default Path Of MQ Level Error logs on windows
C:\program files\IBM\Websphere mq\errors\ 
  1. AMQERRO1.log
  2. AMQERRO2.log
  3. AMQERRO3.log
Default Path Of MQ Level Error Logs On Linux,AIX

$/var/mqm/errors/
  1. AMQERRO1.log
  2. AMQERRO2.log
  3. AMQERRO3.log
Note: each file size is 256KB

QueueManager Level Error Logs
The operations and errors happening at QueueManager are written to the QueueManager error logs

Default Path Of QMGR Level Error logs on windows

C:\Program Files\IBM\WebSphere MQ\Qmgrs\QMGR(QM1)\errors\

Default Path Of QMGR Level Error Logs On Linux,AIX

$/var/mqm/Qmgrs/QMGR(QM1)/errors

MORE


Best Regards,
MADHU K
IBM MQ Certified Professional
HYDERABAD
+917893751171/+919964371404
mailme.mq@gmail.com
trainingontech.com
http://www.ibmmqadmin-madhu.blogspot.in