次の方法で共有


Moving Queue Database to a Different Exchange Server

Recently, a customer asked me if there was a way to bulk move all of a pending queue from one server to another. The only documentation I could find on this had you exporting the queue to .eml files and replaying them by dropping them in the pickup folder. That is fine and dandy, but when you have 1.2 million messages backed up keeping new mail from flowing, it is not an ideal solution. So, challenge accept.

Now what can we do? Well, the good news is, you can move the queue database so new mail can flow, and then on a new or unused exchange server, dump the old queue to it and let it process the backlog. The following is the test I did in the lab to prove the concept. Full disclosure, this was done on an Exchange 2010 SP3 RU12 environment. It likely works on older rollups, but I find it is best to do these things on current supported versions. I will test later in 2013 and 2016 to see if there are any deviations, but for now, 2010 worked like a champ.

Setting up the test:

I have two Exchange 2010 servers in the lab: IG-E2K10-01 and IG-E2K10-02.

On the first server (IG-E2K10-01) I confirmed all of the queues were empty (test lab, so no mail flow currently.)

Pre-test

First thing I needed to do was create some mail volume. I used a script written by Chris at Flaming Keys (https://flamingkeys.com/2011/08/send-bulk-test-emails-with-powershell/) and modified it to suit my needs.

Send-BulkEmails-script

Once I kicked this off, I could see the queue begin to rise and messages were delivering to my mailbox, so I suspended the queue to allow it to receive all the messages without sending them on.

suspend-queue

At this point I waited for the messages to finish queuing.

MessagesQueuedOnServer1

The first 8 messages got out before I suspended but that left me with 92 messages queued up on IG-E2K10-01. Now we are ready to perform the test.

Steps:

Suspend all queues on the Exchange server you will be moving the messages off of running the following command.

get-queue "IG-E2K10-01\*" | Suspend-Queue

Suspend-AllQueuesOnServerOne

Stop the Microsoft Exchange Transport service on the server.

Stop-Transport-Server1

Once it is stopped, go to the queue folder, typically C:\Program Files\Microsoft\Exchange Server\V14\TransportRoles\data\Queue, and copy all of the files to a different folder. I usually create a folder called old under the queue folder and move them all into there.

moveQueueToNewFolder

At this point the Queue folder should only have the old folder in it, no other files. You can now restart the Microsoft Exchange Transport service so that a new queue database can be created and new messages can begin flowing.

Start-Transport-Server1

Now we can move over to the new unused server (IG-E2K10-02). You will want to make sure that the server is added to the send connector.

SendConnector

First, stop the Microsoft Exchange Transport Service on the new server.

Clear out the files in the queue folder on the new server, then copy the files over from the old folder on the old server to the queue folder on the new.

CopyFiles-FromServer1oldToServer2

Once the files are in place on the new server, start up the transport service.

You will now see that messages are in the suspended submission queue on the new server.

Post-MoveQueue-Server2

You can now resume the queues on the new box.

messagesDelivering

Messages have moved to the outbound queue and are now flowing from the new box and delivering to my mailbox.

MessagesReceived

Success!

So the concept is proven. You can move the queue database from one server to another and let it process them, thereby freeing up the original server to process new mail.

I hope you find this article useful. If so, please leave a comment.

 

Chris Allen, Support Escalation Engineer, Exchange OnPrem

CHALLEN@microsoft.com

Comments

  • Anonymous
    November 30, 2016
    Thanks Chris for sharing this valuable information.If you remember we worked together recently on one of the recovered Exchange 2013 server issue. It was nice working with you.
    • Anonymous
      December 01, 2016
      Hey Kapil,Yeah I just finished closing that case out. :) It was a pleasure working with you as well. Hope you have an excellent rest of the week.
  • Anonymous
    December 16, 2016
    Hi, how about exchange 2013, have you test it?
    • Anonymous
      January 04, 2017
      Yes, this has been tested in 2013 and has worked in my test scenarios.
  • Anonymous
    February 15, 2017
    Thanks very much for this article
    • Anonymous
      February 15, 2017
      it's also works for 2013 Exchange server