How can message queues be recovered from a crashed machine, so that transactional messages can be restored on a new machine?
1 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:
http://technet.microsoft.com/en-us/library/cc733512.aspx
http://blog.aggregatedintelligence.com/2012/03/msmqsecurity-descriptor-cannot-be-set.html
-
Make sure the new machine has the same computername as the original. Jun 21, 2012 at 20:36
-
@JohnBreakwell Interesting. I'm not sure I did that. Will have to check next time. Jun 21, 2012 at 21:10
-
MSMQ crashed on a POS system all the time. Deleting the content of the folder
C:\Windows\System32\msmq
did the thing. Apr 28, 2015 at 12:20