Exchange 2010: Restore database (the sledgehammer method!)

Foreword: The method described in the following article should only be used in exceptional cases. I had to carry out the steps listed below when the Exchange database entry in the Active Directory was damaged and could not be restored. However, a lot of cleanup work is necessary after this action. But it can't hurt to have these steps in mind if the Active Directory suddenly crashes. That is why I am describing them here. Please read the whole article first, BEFORE it is implemented.

The situation: First a few words about the error situation, the Exchange databases were initially still online, but the database containers in the Active Directory configuration partition apparently had errors. The Exchange server was then booted as scheduled after the update installation, which meant that the databases could no longer be started. The Exchange servers were members of a DAG, but in this case the switch to the passive copy of the database did not work either. According to ESEUTIl, the databases were in the clean shutdown state, but the error message when mounting the database corresponded to the message that is displayed when the databases are in the dirty shutdown state. Unfortunately, I failed to take screenshots of the error messages, so I will only describe the procedure.

Background: A lot of configuration data for the Exchange databases is stored within the Active Directory, the configuration of the databases can be displayed and also edited with ADSI Editor, here is a screenshot of a mailbox database from an Active Directory perspective:

Exchange

Normally, you don't need to do this manually via the ADSI editor. In my case, however, it was necessary. As already mentioned, it was not possible to clarify exactly what the problem was (permissions? replication?). All attempts to bring the databases back online failed, so the only way to get the databases back online as quickly as possible was to use the sledgehammer method.

The procedure: First I deleted the database container via ADSI Editor. Exchange does not allow the deletion of databases as long as there are still mailboxes in the database, so this step had to be done via ADSI Editor. So I deleted the entry "CN=MBDB01".

2

The Exchange Server no longer recognizes this database and its configuration.

Now ESEUTIL is used to check whether the database is in the clean shutdown state. described here. After "ESEUTIL /MH" indicates that the database is in the clean shutdown state, all files except for the .EDB file are deleted.

4

5

A new empty mailbox database is now created:

New-MailboxDatabase -Name NEUEDB -Server SMAIL01 -EdbFilePath d:\NeueDB\NeueDB.edb -LogFolderPath d:\NeueDB

The database is now mounted once so that the database files are created, after which provisioning is immediately canceled again:

Mount-Database -Identity NEUEDB
Dismount-Database -Identity NEUEDB

3

Next, all files in the "D:\NeueDB" directory are deleted

6

Then the original mailbox database is copied to d:\NeueDB and renamed to NeueDB.EDB. In my case, I only copied the EDB file from D:\TMP (see screenshot above) to d:\NEUEDB and renamed it to NEUEDB.EDB.

image

Now specify that the "NEUEDB" database may be overwritten when restoring:

Set-MailboxDatabase -Identity NEUEDB -AllowFileRestore $true

7

The "NEUEDB" database can now be mounted

Mount-Database -Identity NEUEDB

So far so good, but the mailboxes still refer to the old database:

image

Before the users can log in again, the correct database (now NEUEDB) must be configured for the mailboxes; this is done with the following commands:

get-mailboxdatabase | clean-mailboxdatabase
get-mailboxstatistics –database NEUEDB | set-mailbox –database NEUEDB
get-mailboxdatabase | clean-mailboxdatabase

All mailboxes that were originally in the MBDB01 database have now been moved to the new NEUEDB database. Users can log in again.

Note: As already mentioned, this method still involves clean-up work. System mailboxes may have to be recreated. Mailbox restrictions may also need to be adjusted. This article only shows another way to make a database available again. In my case, a defective Active Directory was to blame, but in my experience this is relatively rare. Before using this method, take a look at the alternatives first:

https://www.frankysweb.de/?cat=12

11 thoughts on “Exchange 2010: Datenbank wiederherstellen (die Holzhammer Methode!)”

  1. Franky es sei mal gesagt… Du bist der Beste… ich lese immer wieder gerne Deine Artikel und komme sogar mit!!!

    D.h. du bringst schwierige Themen einfach rüber… sei mal gesagt… an einem Sonntag – DANKE!

    Reply
  2. Hallo Frank,

    ich habe einen Exch2016 bei dem einiges schief gealufen ist. Mit dem artikel konnte ich den Server wieder einigermaßen heile machen – danke dafür schon mal.
    Leider gibt es clean-mailboxdatabase in 2016 wohl nicht mehr…

    Jetzt sagen mir alle Mailboxen: „Database ist für UserMailbos verbindlich“

    Was mache ich denn da noch falsch?

    OWA funktioniert – das ist schon mal gut…

    Reply
  3. Hallo Franky,

    erstmal besten Dank für deine Methode. Die hat mir heute so einiges erspart!!!

    Allerdings gibt es noch ein Problem: Unsere User können sich weder über Outlook noch OWA oder AS am Postfach anmelden.

    Ein verschieben der Mailboxen ist auch nicht möglich.

    Hast du dazu vielleicht einen Tipp?

    Vielen Dank!
    Lars

    Reply
  4. Hallo Frank

    Leider habe ich auch einen übel zerschossenen Exchange (auf einem SBS2011) Mit Deiner Methode konnte ich endlich wieder die Datenbank mounten. Leider min ich mit dem cmdlets nicht so bewandert und kämpfe mit dem letzten Part:
    get-mailboxdatabase | clean-mailboxdatabase
    get-mailboxstatistics –database NEUEDB | set-mailbox –database NEUEDB
    get-mailboxdatabase | clean-mailboxdatabase

    Was bedeuten | ? Das heisst quasi „enter“ und dann einen neuen Befehl?
    Falls ja…
    get-mailboxdatabase -> klappte
    clean-mailboxdatabase -> Möchte Parameter für Identity? neue edb?
    get-mailboxstatistics –database NEUEDB -> klappte
    set-mailbox –database NEUEDB -> Möchte Parameter für Identity? neue edb wird auf dem System nicht gefunden. Was muss das für ein Wert sein?
    Hier scheitere ich leider :-(

    Gruss aus der Schweiz
    Thomas

    Reply
    • Hi,

      leider zerlegt WordPress die langen Befehele, die Befehle müssen so aussehen:

      get-mailboxdatabase | clean-mailboxdatabase

      get-mailboxstatistics –database NEUEDB | set-mailbox –database NEUEDB

      get-mailboxdatabase | clean-mailboxdatabase

      Gruß, Frank

      Reply

Leave a Comment