How to Recreate Exchange Database from Scratch

Written by

An Exchange Server database plays a pivotal role in smooth functioning of the business as it stores critical data, such as user mailboxes, archives, public folders, etc. However, sometimes, due to power failure or server crash, the Exchange database becomes inconsistent or corrupted, impacting the email communication and other business services.

In such a situation, you need to recover or recreate the Exchange database to bring the services back.

In addition, there are several other situations where you need to recreate a database from scratch in an Exchange Server environment. These include:

  • A server is lost due to hardware or software fault and the Exchange Server is rebuilt using the recovery mode.
  • There is problem with a database and you need to move all the data from the problematic database to a new database.
  • You need to restore the database to another environment.

Below, we will explain how to recreate an Exchange database from scratch.

Process to Recreate Exchange Database from Scratch

Below, we will be explaining the process to create a new database and then restore all the data from backup using the native tools in Exchange Server.

Note: This process is applicable when the Exchange Server is recreated from scratch using the recover mode and a new mailbox database is created, after the server failure.

Step 1: Create a Recovery Database

First, you can create a Recovery Database using the New-MailboxDatabase PowerShell command in the Exchange Management Shell (EMS). A Recovery Database (RDB) is a type of mailbox database that allows to mount and restore/move data from the database restored from backup without disrupting the services or operation of the Exchange Server and without the need to fully restore the Exchange Server.

Step 2: Restore Database from Backup

Next, you need to restore the database folder from the backup into a temporary storage. You need to ensure that the database is in Clean Shutdown state. For this, use the ESEUtil command with the /mh parameter (see the below example).

EseUtil /mh "T:\RecoveredDatabase\database.edb"

If the status is Clean Shutdown, then it’s fine. But if the status is Dirty Shutdown, then the database will not mount. You need to repair the database to bring it back to healthy state. To fix minimal corruption, you can perform the smooth recovery process by using the below ESEUtil command.

EseUtil /r "E00" /l "T:\RecoveredDatabase\logs" /d "T:\RecoveredDatabase\database.edb"

This will start the soft recovery process. Then, check the database’s state. It should be in Healthy Shutdown state.

Step 3: Import Database into Exchange Server and Mount it

Now, you need to import the database into the Exchange Server. For this, use the below command with the -Recovery switch in the Exchange Management Shell (EMS).

New-MailboxDatabase -Recovery -Name RecoveryDBName -Server <ServerName> -EdbFilePath " T:\RecoveredDatabase\database.edb " -LogFolderPath " T:\RecoveredDatabase\logs"

The Exchange Server will add the restored database to the list of databases but it will not be mounted. To mount the database, you need to use the following command:

Mount-Database -Identity RecoveryDBName

This will mount the recovery database. Next, you need to use the New-MailboxRestoreRequest command to restore the mailboxes from the recovery database to the live database (see the below example).

New-MailboxRestoreRequest -SourceDatabase RecoveryDBName -SourceStoreMailbox <MailboxGUID> -TargetMailbox <TargetMailbox>

This command will start the recovery process of the single mailbox selected with the source Mailbox GUID to the Target Mailbox specified. To monitor the restore process, you can use the below command.

Get-MailboxRestoreRequest

Once all the mailboxes are restored, you can easily remove the recovery database from the Exchange Server setup.

Limitations of the Above Process

Though the above process can help you recreate an Exchange database, it has some limitations, such as:

  • The process is suitable for restoring a single mailbox at a time. If you run multiple commands to restore multiple mailboxes at once, then it would hinder the performance and availability of the commands.
  • It requires a lot of storage, depending on the restored database size.
  • It can only be done if the restored database can be mounted.
  • If you would restore from backup, data will be lost from when the backup is taken to when the server has failed.
  • It can only be done if the database is of the same server. It will not work if the database was restored from a different version of Exchange Server or setup.
  • The process is lengthy and requires scripting skills.
  • It can only be used for mailboxes.

To Conclude

As you have seen, the above process can help create a new Exchange database and recover mailboxes from the backup. If the server has failed and you are restoring the database or the full server from backup, anything which has changed from the backup to when the server has failed will be lost.

To avoid data loss and with minimal impact on the business, you can use an Exchange recovery tool, such as Stellar Repair for Exchange that can help recover all the data from corrupted database.

After the server has been rebuilt using the Recover Mode, you can use this Exchange repair tool to scan the corrupted database (EDB) file and restore all the data. After a quick or deep scan, it displays all the resources of the database on the interface, with the options to see full HTML preview and in-line search.

It can export user mailboxes, user archives, public folders, shared mailboxes, disabled mailboxes, and purged and deleted items, to PST files or directly to a live Exchange Server database or Microsoft 365 tenant. It offers features, like automatic mailbox matching from the source to the destination and priority exports for VIP users. This helps reduce the resources needed and the recovery time.

Brought to you by

What’s hot on Infosecurity Magazine?