Restoring an Exchange Server 2013 Database

In a previous article I demonstrated how to restore Exchange Server 2013 databases using Windows Server Backup. In that scenario an entire database that had been lost needed to be recovered.

However in other recovery scenarios you may only want to recover one or several mailboxes, or even specific mailbox items, from a point in time without having to overwrite the entire database.

In Exchange Server 2013 we can do this with recovery databases, which operate basically the same as Exchange Server 2010 recovery databases. A recovery database allows us to mount a copy of a database on an Exchange server without having any impact on the live copy of that same database. In fact we can even use recovery databases to mount copies of databases from other servers within the same Exchange organization, thanks to database portability.

When a recovery database is mounted we can inspect it and restore items or mailboxes from it, but no clients can connect to it. So as the name suggests it can only be used for recovery purposes, not for active mailbox functionality.

Restoring an Exchange Server 2013 Database Using Windows Server Backup

Some backup applications have the capability to handle some or all of the process of creating a recovery database, restoring the database files, and extracting the desired mailboxes or items to a destination.

When using Windows Server Backup to perform a recovery you need to do pretty much all of the work yourself, so it is a good exercise for learning how to recovery Exchange 2013 databases.

In Windows Server Backup click Recover to start a new recovery.

exchange-2013-recovery-database-01

Choose the location where the backup is stored. In this example my backups are stored on the same server.

exchange-2013-recovery-database-02

Choose the backup date and time that you wish to restore.

exchange-2013-recovery-database-03

When recovering entire databases we would normally choose “Applications” and restore every database that was backed up on the server. However when working with recovery databases we can chooseFiles and folders and only restore the specific database and log files we need.

exchange-2013-recovery-database-04

Browse through the tree of available items and choose the database and log files you want to restore. I am restoring DB02 in this example. Note that restoring the database and logs will be two separate restore jobs if they are located in folders where you can’t select both at the same time.

exchange-2013-recovery-database-05

Choose to restore to Another location, and select a folder that has enough free space to hold the restored data.

exchange-2013-recovery-database-06

Confirm your selections and click Recover to begin the restore.

exchange-2013-recovery-database-07

You can close the progress window if you like and the job will continue running in the background.

exchange-2013-recovery-database-08

I’ve also run a second recovery job to restore the log files for DB02.

After you’ve completed your file restores the next step is making the database mountable.

Making the Restored Database Mountable

So far we’ve restored the database and transaction log files from a recent backup, but haven’t created the actual recovery database yet. If we created the recovery database right now, pointing it at the restored database and log files, and then tried to mount it, the database would fail to mount.

The reason for this is that the restored database is in a “dirty shutdown” state, which you can see by navigating to the restored database folder and running eseutil.exe.

I have abbreviated the output of the above command, but basically you are looking for the “State” shown in the command output.

So we need to get the database file to a “clean shutdown” state before it can be mounted.

In my example I have:

  • A database file named DB02.edb in F:RecoveryDB
  • Transaction logs with the filename prefix E01 in F:RecoveryLogs

So my eseutil “soft recovery” command line will be:

What that command means:

  • /r for “recovery” mode
  • E01 for the log file name  prefix
  • /l (lower-case L) to specify the path to the log files
  • /d to specify the path to the database file (but do not include the name of the file itself)

After the command has completed check the state of the database with eseutil /mh again.

If soft recovery does not bring the database to a clean shutdown state you may consider a hard recovery, which will make the database mountable but risks some data loss in the process.

exchange-2013-recovery-database-09

When the database is in a clean shutdown state you can create the recovery database.

Creating a Recovery Database in Exchange Server 2013

Creating a recovery database is performed using the New-MailboxDatabase cmdlet with the -Recovery switch. Notice that in this example I am using the same database and log file locations as my restored data.

For more information about the warning to restart the Information Store service read this article. For a recovery database that you are only mounting for a short period of time an Information Store service restart may not be necessary.

Mount the recovery database.

Working with Recovery Databases

With the recovery database mounted you can use Get-MailboxStatistics to confirm that it contains mailbox database.

After you have confirmed that data is available for restore you can begin your mailbox or item recovery.

Export a list of all Email addresses exchange

from Power shell

Get-Recipient | Select Name -ExpandProperty EmailAddresses | Select Name, SmtpAddress | Export-csv c:\temp\AllEmailAddress.csv


Get-Mailbox | Select UserPrincipalName,EmailAddresses | Export-Csv C:\Temp\Addresses.csv

Export E-mail Address List From Exchange 2010

If you need a list of your current user list and primary e-mail addresses for whatever reason, it’s an easy thing to carry out with Exchange 2010. No powershell required!

 

Step 1 – Open up the Exchange Management Console.

Step 2 – Go to the “Recipient Configuration” and click on “Mailbox” on the left hand section of the screen. Make sure the columns you want are displayed in the middle.

Step 3 – On the right hand section click “Export List”. It will bring up a save file dialog box. It will save it as a tab delimited text file.



Exchange Server 2013 setup fails creating Mailbox role

Exchange Server 2013 setup fails creating Mailbox role

 

There I was installing Exchange Server 2013 on a brand new Windows 2012 Server. All the pre-reqs went on fine, AD Schema extended, no problems, how simple could it be?

And yet, the setup itself fails!?!? I can’t even begin to understand how a vanilla setups on a clean fresh server could fail.

So, during the setup, it gets to :Step 7 of 14: Mailbox Role: Transport Service” and then fails with

Error:

The following error was generated when “$error.Clear();

if ( ($server -eq $null) -and ($RoleIsDatacenter -ne $true) )

{

Update-RmsSharedIdentity -ServerName $RoleNetBIOSName

}

” was run: “Database is mandatory on UserMailbox. Property Name: Database”.

Looks like Microsoft *still* haven’t been able to work out how to provide actual useful error messages.

At least it appears to be a known error, and there’s a KB article describing it. Although for Exchange 2010 I figured it should be close enough.
http://support.microsoft.com/kb/978776

So off to ADSIEDIT, delete the user as suggested. I can’t “recreate” the account because the powershell doesn’t work because Exchange isn’t installed yet! Next step is to rerun the  Mailbox role setup application… huh? What “application” would that be?

I tried just running the Setup again. It starts, tells me the previous setup failed and that it will try to continue. No choice if I want to either. Once it starts, it then seems to just stop at 0%. There’s no further activity I can detect. Any attempts to start the setup again result in the same, just stopping at 0%

SOLUTION:

So, technically this is partly my bad, however it is a similar problem that might be encountered if someone has an Exchange install fail part-way for whatever reason. In my case it was due to residual objects still being present in Active Directory from a previous Exchange 2010 install. The problem relates to the permissions on those old user objects where the new Exchange server doesn’t have the required permissions due to the old installation “owning” those objects.

  1. So, from here the fix was to Uninstall Exchange 2013 (or what little there actually was of it), reboot the server
  2. In AD Users and Computers, find and delete *all* those old Exchange mailbox type system accounts (Federatedemail, DiscoverySearchMailbox, HealthMailbox, Migration, SystemMailbox, etc.)
  3. Run the Exchange ADPrep again to recreate those accounts. This is instead of the step mentioned in the article to re-create the accounts as the ADPrep will take care of that
  4. Start Exchange setup again and it should complete correctly

totally remove exchange 2016

On the Remove Exchange Server page, you can remove Exchange from the computer.

When you remove Exchange from the computer, the following are removed:

  • All server roles.
  • All installation files.
  • The Exchange server object and all its child objects from Active Directory.
    importantImportant:
    If you used Setup.exe /NewProvisionedServer to provision the server, you must use Setup.exe /RemoveProvisionedServer after Exchange has been removed from the computer to remove the Exchange server object and all its child objects from Active Directory.

Removing Exchange from a computer doesn’t remove any Exchange-related databases or log files. You must remove those files manually.

Repairing a virtual disk in Workstation

Linux Host

To repair a virtual disk of a Workstation virtual machine in a Linux host, use the vmware-vdiskmanager utility that is installed by the Workstation installer in the /usr/bin folder on a Linux host.
To use the virtual disk repair utility on a Linux host:
  1. Open a terminal window in the Linux host.
  2. Run this command:

    /usr/bin/vmware-vdiskmanager -R <path of the vmdk(virtual disk)>

    Note: Where <path of the vmdk(virtual disk)> is the folder path to the virtual disk that appeared in the error.

Windows Host

To repair a virtual disk of a Workstation virtual machine in a Windows host, use the vmware-vdiskmanager utility that is installed by the Workstation installer in the installation folder on a Windows host.
To use the virtual disk repair utility on a Windows host:
  1. Open a command prompt. For more information, see Opening a command or shell prompt (1003892).
  2. Navigate to the directory where Workstation is installed. By default, this directory is located at:
    • Windows XP –C:\Program Files\VMware\VMware Workstation
    • Windows Vista/Windows 7/Windows 8 32bit –C:\Program Files\VMware\VMware Workstation
    • Windows Vista/Windows 7/Windows 8 64bit –C:\Program Files (x86)\VMware\VMware Workstation
    • Windows Server 2008 R2 –C:\Program Files (x86)\VMware\VMware Workstation
    • Windows Vista/Windows 7/Windows 8 64bit/Windows 10 – C:\Program Files (x86)\VMware\VMware Workstation
  3. Run the command:

    vmware-vdiskmanager -R “<path of the vmdk(virtual disk>”

    Note: Where < path of the vmdk(virtual disk> is the complete path to the virtual disk that requires repair as reported in the error.

    Example: vmware-vdiskmanager -R “D:\Virtual Machine\Windows 7\virtualdisk.vmdk”