MSMQ Disaster Recovery – How to recover message queues from a crashed machine

disaster-recoverymsmq

How can message queues be recovered from a crashed machine, so that transactional messages can be restored on a new machine?

Best Answer

Stop the MSMQ Service on both source and destination machines:

net stop MSMQ

Delete the following folder on the destination machine and replace with the corresponding folder contents from the source machine:

C:\Windows\System32\msmq

Grant access to copied folder on the destination MSMQ service:

icacls.exe "C:\Windows\System32\msmq" /grant "NT SERVICE\MSMQ":(F)

Configure MSMQ to ignore checkpoint files:

Browse to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Parameters, and then click Parameters. On the Edit menu, point to New, and then click DWORD (32-bit) Value. In the Name field, enter "LogDataCreated," and then ensure that the value is set to 0.

Open the queue properties in the following location. Files are text and can be opened with notepad.

C:\Windows\System32\msmq\storage\lqs

Change the ‘Security’ field to match one from a working queue. An example is given below:

Security=0100078... etc

Restart the MSMQ Service on the destination machine:

net start MSMQ

Troubleshooting:

  • Failure to write destination files: Navigate the destination subfolders, so that Explorer will prompt to allow access.
  • Some messages may be duplicated, as the checkpoint files have been deleted.
  • If the list of messages can be viewed but not the message contents themselves, the ‘security’ field must be changed in the queue properties.

References:

Interpreting file names in the Storage directory in Microsoft Message Queue Server and in Microsoft Message Queuing

http://technet.microsoft.com/en-us/library/cc733512.aspx

http://blog.aggregatedintelligence.com/2012/03/msmqsecurity-descriptor-cannot-be-set.html