locked
Merging 2 Mailboxes from Seperate DBs RRS feed

  • Question

  • Today I did something incredibly stupid and am hoping there's a way I can recover what little may have been lost.

    I set up a couple new Databases today, and moved the corresponding mailboxes to their new databases.  Only I didn't move them.  I used the Set-Mailbox -Database (which is what tells it where to point rather than moving it's store right?!).

    I tried it on a few accounts first, logged in for them and all was as should be so did for rest of users (about 40 or so total).  And then I had a call to say they've lost all old emails and contacts!  Immediately reissued the cmdlet so that it put the -database attribute back to their usual DB (and will do a proper MoveRequest next time!) but in the process will have lost any new emails that came to them whilst they were on that DB.

    Is there a way of merging the 2 DBs together or shall I just forget about that?  Was only a few hours but would like to make sure that nothing important gets lost (users wouldn't have logged on this afternoon so they're unlikely to realise anythings been amiss but I'd rather sort than ignore and hope nobody notices).  I'd imagine there is a way of recovering those that went to the wrong DB from the transaction logs but would rather get the input of the experts before I go messing down there.

    I've had a few engineers talk to me about PowerShell and how powerful it is and not to use it lightly and now I can appreciate why!  Could of ended up a lot worse but luckily my mistake proved to be a relatively small one and will make me a little more prudent in the future!

    Any advice with recovering any emails sent whilst they were pointing to the new DB I configured would be great.  I'm wondering if the MoveRequest will merge them for me but will wait and see what people think.

    Friday, February 17, 2012 9:54 PM

Answers

  • Hi

    The restore command doesn't delete the mail out of the soft deleted mailbox, that will stay there until you purge the mailbox or the database retention period ends.  The easiest way to run this is to create a CSV with a collumn for source mailbox and one for target mailbox then run these commands:

    $csv=Import-Csv myfile.csv
    foreach ($line in $csv) {New-MailboxRestoreRequest -SourceDatabase WrongDatabase -SourceStoreMailbox $line.source -TargetMailbox $line.target}
    Cheers, Steve
    • Marked as answer by Mr Killian Monday, February 20, 2012 10:59 AM
    Monday, February 20, 2012 10:34 AM

All replies

  • So sounds like in shor you have a copy of a database that has some delta email in it that you want to merge back into the production database correct?  if so true then

    A:  Job 1 is to make a backup copy of thedb that has the delta data so that you are NOT working with your only copy and then use one of the following methods

    • use Microsoft RDB process to recovery the delta data into the production server http://technet.microsoft.com/en-us/library/dd876954.aspx
    • OR use a 3rd party product like Lucid8's DigiScope http://www.lucid8.com/product/digiscope.asp which will allow you to open ANY offline Exchange database so that you can Browse, Search, Export Mailboxes Folders and Individual Items to PST, MSG and XML or in your case you can Recover the data via the GUI directly from the offline Exchange Database into the Production Exchange Server. Note: for future reference DigiScope can even Recover data cross version, i.e. Offline Exchange 2003 to say Production 2007 or 2010

    NOTE:  Forgot to mention you can download DigiScope and obtain a 30 day DEMO license which will allow you to

    A: Execute all features agasint the sample demo daabases provided

    B: Open the offline copy of any other Offline database and you can then Browse, Search and do a sample randomized export of the data.  To export orrecover all your data you will need a license, jhowever there are cost effective project based licenses available

    If you have any questions contact sales at 435.456.8473 or support at 425.456.8464 and we will be happy to assist


    Troy Werelius
    www.Lucid8.com
    Search, Recover, & Extract Mailboxes, Folders, & Email Items from Offline EDB's and Live Exchange Servers with Lucid8's DigiScope


    Friday, February 17, 2012 10:12 PM
  • Hi

    The mailboxes may be in a state of "soft deleted" in the other database.  If that is the case you can use the New-MailboxRestoreRequest command to merge the data back to the active mailbox: http://technet.microsoft.com/en-us/library/ff829875.aspx

    To find out what state they are in, or if any mail exists your can run:

    Get-MailboxStatistics -Database WrongDatabaseName | Select DisplayName,DisconnectReason,ItemCount
    Cheers, Steve


    Friday, February 17, 2012 10:14 PM
  • Hi Killian

    Any update on this thread?

    Cheers

    Zi feng


    Zi Feng

    TechNet Community Support

    Monday, February 20, 2012 7:43 AM
    Moderator
  • I'm going to be taking a look this morning and will post back results.
    Monday, February 20, 2012 8:11 AM
  • Hi Steve,

    I've ran this cmdlet for one particular mailbox as a test and whilst it seemed to run fine, should it still show the item count in the 'soft deleted' mailbox?

    For example, I ran this for J.Bloggs;

    New-MailBoxRestoreRequest -sourcedatabase "WrongDatabaseName" -sourcemailbox "Joe Bloggs" -targetMailbox "j.bloggs"

    Says new Restore request processing but half an hour later it still shows his unread count in the old mailbox, would it copy across and delete or does it just duplicate the messages into the target mailbox?

    Finally; if this is working ok, is there anyway to do it on mass?  I'm not sure how I could pipe something through to this to populate the sourcemailbox and targetmailbox as these would differ for each mailbox.

    Thanks so far for the help, much appreciated.

    Monday, February 20, 2012 10:02 AM
  • Hi

    The restore command doesn't delete the mail out of the soft deleted mailbox, that will stay there until you purge the mailbox or the database retention period ends.  The easiest way to run this is to create a CSV with a collumn for source mailbox and one for target mailbox then run these commands:

    $csv=Import-Csv myfile.csv
    foreach ($line in $csv) {New-MailboxRestoreRequest -SourceDatabase WrongDatabase -SourceStoreMailbox $line.source -TargetMailbox $line.target}
    Cheers, Steve
    • Marked as answer by Mr Killian Monday, February 20, 2012 10:59 AM
    Monday, February 20, 2012 10:34 AM
  • Thanks Steve. 

    CSV worked great.

    K

    Monday, February 20, 2012 11:00 AM
  • No problem.  Glad you got your mail back.

    Cheers, Steve

    Monday, February 20, 2012 11:03 AM