Exchange 2010 Backup and Restore

50
Introduction Ever since Exchange 2007 SP1 was released and Exchange admins and consultants started to deploy Exchange 2007 on Windows Server 2008 based servers, there has been a lot of frustration and complains about the inability to perform Exchange-aware backups and restores using Windows Server Backup. Small and medium organizations (SMORGs) are the ones who feel they have been left out in the cold over the decision to not provide a native backup solution for Exchange 2007 SP1 on Windows Server 2008. LORGs (large organizations) did not really care since they typically use a backup solutions such as Microsoft Data Protection Manager (DPM) or one provided by a 3rd party vendor. The Exchange Product group took the negative feedback on this topic very seriously and explained why they, unlike the case with Exchange 2007 RTM and previous versions of Exchange Server, decided not to include an Exchange-aware backup plug-in with Exchange 2007 SP1. Judging from threads and posts all over the Exchange communities, an explanation for why this decision was taken was not enough. A solution had to be found. Just look at all the comments on this blog post of the MS Exchange Team blog. At the TechEd IT Pro conference in North America back in June 2008, Scott Schnoll form the UE team within the Exchange Product group made a very interesting announcement. He informed the attendees of his Exchange 2007 SP1 Tips and Tricks session that Microsoft had decided to provide a VSS-based plug-in for Windows Server Backup in Windows Server 2008 that will enable customers to take Exchange-aware VSS backups on Windows Server 2008. Scott also announced this on his blog. That was back in June 2008. Fast forward to May 2009. After a lot of questions in the different Exchange communities around expected ship time of the new VSS plug-in, this blog post was posted over at Scott Schnoll’ s blog. The blog post explains that the VSS plug-in would be included with Exchange 2007 Service Pack 2. The Exchange Product group also posted this information on the MS Exchange Team blog, which in general talked about Exchange

Transcript of Exchange 2010 Backup and Restore

Page 1: Exchange 2010 Backup and Restore

Introduction

Ever since Exchange 2007 SP1 was released and Exchange admins and consultants started to deploy Exchange 2007 on Windows Server 2008 based servers, there has been a lot of frustration and complains about the inability to perform Exchange-aware backups and restores using Windows Server Backup. Small and medium organizations (SMORGs) are the ones who feel they have been left out in the cold over the decision to not provide a native backup solution for Exchange 2007 SP1 on Windows Server 2008. LORGs (large organizations) did not really care since they typically use a backup solutions such as Microsoft Data Protection Manager (DPM) or one provided by a 3rd party vendor.

The Exchange Product group took the negative feedback on this topic very seriously and explained why they, unlike the case with Exchange 2007 RTM and previous versions of Exchange Server, decided not to include an Exchange-aware backup plug-in with Exchange 2007 SP1. Judging from threads and posts all over the Exchange communities, an explanation for why this decision was taken was not enough. A solution had to be found. Just look at all the comments on this blog post of the MS Exchange Team blog.

At the TechEd IT Pro conference in North America back in June 2008, Scott Schnoll form the UE team within the Exchange Product group made a very interesting announcement. He informed the attendees of his Exchange 2007 SP1 Tips and Tricks session that Microsoft had decided to provide a VSS-based plug-in for Windows Server Backup in Windows Server 2008 that will enable customers to take Exchange-aware VSS backups on Windows Server 2008. Scott also announced this on his blog.

That was back in June 2008. Fast forward to May 2009. After a lot of questions in the different Exchange communities around expected ship time of the new VSS plug-in, this blog post was posted over at Scott Schnoll’ s blog. The blog post explains that the VSS plug-in would be included with Exchange 2007 Service Pack 2. The Exchange Product group also posted this information on the MS Exchange Team blog, which in general talked about Exchange 2007 SP2, but also mentioned that an Exchange-aware VSS plug would be included with this service pack.

Around the same time that Exchange 2007 SP2 was released, we published a two part article series in which I explain how you perform backups and restores using the volume snapshot (VSS) plug-in included with this service pack.

But what about Exchange 2010? Will a similar plug-in be available with this Exchange Server version, which is nearing RTM? The answer is yes. And in fact this is exactly what I am going to cover in this article. So sit back and grab a nice cup of fresh coffee and carry on reading.

Note:Some of the sections in this article may look very similar to those in the Exchange 2007 SP2 specific article. This is because the plug-in between these two Exchange server versions are close to identical.

Page 2: Exchange 2010 Backup and Restore

Test environment

For the purpose of this article I used two Exchange 2010 (standard edition) servers running on top of Windows Server 2008 R2. The reason why they run Windows 2008 R2 Enterprise edition is because the VSS plug-in also works with mailbox databases on the Exchange 2010 Mailboxes servers’ part of a Database Availability Group. Yes, you heard that right. You do not necessarily need to run out and buy Microsoft Data Protection Manager (DPM) or a similar backup solution in order to back up your DAG protected mailbox databases.

Note:Although the Exchange 2010 VSS plug-in is capable of backing up DAG protected mailbox databases, it is important to note that you only can perform the backup or restore via an active database. This means that if one of your mailbox databases should fail-over to another server, the next backup job on the server that originally held the active database copy would fail.

As shown in Figure 1, a total of three active mailbox databases exist on the server we will back up in this article. As you can see, each database have two passive copies.

Figure 1: Exchange 2010 Mailbox Databases

Page 3: Exchange 2010 Backup and Restore

In Figure 2, there are a total of three LUNs each storing both a mailbox database and the associated log stream.

Figure 2: Storage Group and Database LUNs

As you may notice, each LUN has been presented to Windows Server using drive letters. Note though that I could have used mount points if Exchange 2010 was installed on Windows Server 2008 R2 and not Windows Server 2008 SP2. Mount points are currently not supported by the Exchange VSS plug-in, when installed on Windows Server 2008 SP2. You can read more about this issue in the article where I uncover the Exchange 2007 SP2 version of the VSS plug-in.

Limitations

Limitations you should be aware of are listed below (except for the lack of support for LUNs presented via mount points, the list is the same):

The plug-in can only perform VSS-based backups. Streaming backups are not supported with this plug-in.

Backups occur at the volume level. This means that all data on a volume will be backed up. For instance, if you have more than one database (DB) stored on the same same LUN, all DBs will be backed up. You cannot select to only backup one DB stored on a LUN with multiple DBs.

The plug-in does not support remote VSS backups. The backup must be run locally on the respective Exchange 2010 Server.

You can only use mount points if Exchange 2010 is installed on Windows Server 2008 R2. If you have installed Exchange 2010 on Windows Server 2008 SP2, mount point are currently not supported.

The backup can be created either on a local drive or a remote network share. There’s no support for backups directly to a tape library. If you want to backup to tape, you must use the disk to disk to tape model. I will show you how to perform backups both to a local disk and remote network share in this first part of this multi-part article.

Page 4: Exchange 2010 Backup and Restore

You must take full VSS backups. If you do not log, truncation will not happen. I will show you this later on in this, the first part of my multi-part article.

Because the VSS plug-in does not support the Exchange Replication VSS Writer, you cannot perform DB backups of passive database copies on Exchange 2010 Mailbox server that are members of a DAG. So if you want to backup DBs on a Mailbox server member of a DAG, you must make sure you perform the backup from the server that holds the active database copies.

When doing a restore, you can choose to restore directly to the original location or to an alternate location. When restoring to the original location, the recovery process is fully automatic. This means you do not need to check “This database can be overwritten by a restore” or dismount the database(s) before performing the restore. I will show you how this is done in the second part of this multi-part series.

The VSS plug-in does not support Recovery Databases. That is you cannot restore directly to a recovery database. You must instead restore to an alternate location and then create the recovery database, then mounting the restored DB in the recovery database. I will show you how this is done in the second part of this multi-part series.

When performing a restore, you must restore all DBs located on the same LUN together. If you have multiple DBs on a given LUN, it is all or nothing. I will show you how this is done in the second part of this multi-part series.

Installing the Window Server 2008 Backup Features

Okay, so now that you have installed the Exchange 2010 Mailbox role on a server (and perhaps even added it as a member in a DAG), the first thing you want to do is to enable the Windows Server Backup features in Windows Server 2008. You can do this using ServerManagerCMD.exe or the Server Manager console. When using the Server Manager console, you just click “Add Features” and check “Windows Server Backup Features” as shown in Figure 4.

Note:If you are using Windows Server 2008 R2, you can use the new Add-Feature PowerShell cmdlet. ServerManagerCMD.exe has been deprecated in Windows Server 2008 R2.

Page 5: Exchange 2010 Backup and Restore

Figure 4: Installing Windows Server Backup Features

Click “Next” and then “Install”.

Page 6: Exchange 2010 Backup and Restore

Figure 5: Confirm Installations Selections

When the Windows Server Backup Feature has been installed, click “Close” and then exit the Server Manager console.

Page 7: Exchange 2010 Backup and Restore

Figure 6: Windows Server Backup Features installed successfully

Performing a backup

advertisement

Now that both the Exchange 2010 Mailbox role has been installed and the Windows Server Backup features have been enabled in Windows Server 2008 (R2), let us launch Windows Server Backup. You do this by clicking Start > Administrative tools and selecting “Windows Server Backup” as shown in Figure 7.

Page 8: Exchange 2010 Backup and Restore

Figure 7: Launching Windows Server Backup

In the Windows Server Backup console we can choose to create a backup schedule or just take a backup once. In this article we will do the latter, so click “Backup Once” in the Action pane as shown in Figure 8.

Page 9: Exchange 2010 Backup and Restore

Figure 8: Selecting “Backup Once”  in the Windows Server Backup Console

On the “Backup Options” page, click “Next”.

Page 10: Exchange 2010 Backup and Restore

Figure 9: Backup Options page

Since we do not want to back up the System volume in this backup job, choose “Custom” and then click “Next”.

Page 11: Exchange 2010 Backup and Restore

Figure 10: Selecting “Custom” on the backup configuration page

Now de-select “Enable system recovery” and then check LUNs holding the databases and log streams, you want to backup.

Click “Next”.

Note:If you have databases and logs located on separate LUNs, be sure to check both the DB and log LUNs.

Page 12: Exchange 2010 Backup and Restore

Figure 11: Selecting DB/Log LUNs

We now need to specify where you want to store the backup. As mentioned earlier in this article, we can either store it on a local disk or on a remote network share. For the sake of this article we will use a remote network share as shown in Figure 12.

When ready click “Next”.

Page 13: Exchange 2010 Backup and Restore

Figure 12: Selecting to back up to a remote network share

Now specify the path to the remote network share and click “Next”.

Page 14: Exchange 2010 Backup and Restore

Figure 13: Specifying the path to the remote network share

On the “Specify advanced option” page, select VSS Full Backup and click “Next”. If you choose “VSS copy backup”, the log files will not be truncated.

Page 15: Exchange 2010 Backup and Restore

Figure 14: Selecting VSS full backup

On the “Confirmation” page, click “Backup” in order to begin the backup.

Page 16: Exchange 2010 Backup and Restore

Figure 15: Confirmation page

Windows Server Backup will now to a consistency check of the databases.

Page 17: Exchange 2010 Backup and Restore

Figure 16: Running consistency check for Exchange

When the consistency check has completed, the backup of each LUN will begin.

Page 18: Exchange 2010 Backup and Restore

Figure 17: Backup in progress

When the backup has completed, click on “Close”. Well, actually, you can close the” Backup Once Wizard” windows while the backup is occurring without interrupting the backup job. In order to follow the progress of the backup, we will leave it open.

Page 19: Exchange 2010 Backup and Restore

Figure 18: Backup completed

As you can see in Figure 19 the databases (in the below figure MDB3) had plenty of log files that had not been committed before we ran the backup.

Page 20: Exchange 2010 Backup and Restore

Figure 19: Log stream before the backup was taken

Now that the backup has been completed, let us verify the log files have been truncated on the mailbox server holding the active databases copy and the servers holding the passive database copies.

Page 21: Exchange 2010 Backup and Restore

Figure 20: Log stream after the backup was taken

When the log files have been truncated on the mailbox server holding, it is up to the Microsoft Exchange Replication Service on the other servers to truncate them for the passive database copies.

By opening the property page of one of the databases, we can also see that the last full backup property was updated.

Page 22: Exchange 2010 Backup and Restore

Figure 21: Database property page with last full backup property updated

Note:If you want to check the “Last full backup” property via the Exchange Management Shell, you can do so using Get-MailboxDatabase –Identity “DB name” –Status | FL. Just remember to include the –Status parameter as this property field otherwise will be blank.

Last thing I wanted to show you before we move on to the next section was the backup image files. As you can see in Figure 22, backups are stored in VHD files with associated XML files.

Page 23: Exchange 2010 Backup and Restore

Figure 22: Backup image files

This concludes this first part of this multi part article uncovering the new Exchange-aware VSS plug-in included with Exchange 2010. In the next article, we will take a look at how you perform a restore both to the original location as well as an alternate location, in case you want to recover specific mailbox items for one or more mailboxes in a restored database.

Hope you enjoyed it so far, see you soon!

PART 2

Introduction

Page 24: Exchange 2010 Backup and Restore

In the first part of this two part article series, we specifically looked at how you perform backups using the new Exchange 2007 2010 VSS plug-in.

In this second part, we will take a look at how to perform a restore, both to the original location as well as an alternate location (in case you would like to recover specific mailbox items for one or more mailboxes in a restored database).

Restoring Exchange 2010 Databases to their original location

Now that we have been through the backup process, let us look at the options available when it comes to restoring Exchange data using the new Exchange VSS plug-in included with Exchange 2010.

As mentioned in the beginning of this article, there are two restore options; you can restore to the original location (and thereby overwrite the production databases), or, you can restore to an alternate location. Remember that if you choose to restore one or more databases protected by DAG, you must restore to the active database copy and not one of the passive database copies.

To begin a restore process, you should click on “Recover” in the Action pane as shown in Figure 1.

Figure 1: Selecting Recover in the Windows Server Backup Console

The Recovery Wizard is launched. On the “Getting started” page, make sure “This server (servername)” is selected and then click “Next”.

Page 25: Exchange 2010 Backup and Restore

Figure 2: Selecting this server on the “Getting started” page

Now specify from which date you want to restore Exchange data (Figure 3), and then click “Next”.

Page 26: Exchange 2010 Backup and Restore

Figure 3: Selecting backup date from which we want to restore

On the “Select recovery type” page, select “Applications” (since you want to restore application data) and click “Next”.

Page 27: Exchange 2010 Backup and Restore

Figure 4: Selecting the recovery type

On the “Select application” page, select Exchange and click “View Details”.

Note:If you are restoring the latest backup and, for some reason, you do not want to perform a roll-forward recovery of the databases, make sure you check this option.

Page 28: Exchange 2010 Backup and Restore

Figure 5: Selecting the Exchange application

In the “Details – Exchange” window, you can see the three databases that were backed up in this volume snapshot.

Page 29: Exchange 2010 Backup and Restore

Figure 6: Details window listing Exchange Databases

Click “OK” and then “Next”.

The “Specify recovery options” page is where you can specify whether you want to restore directly to the production databases or if you want to restore to an alternate location. In this first example we will restore to the original location, so select the first option and then click “Next”.

Page 30: Exchange 2010 Backup and Restore

Figure 7: Selecting to recover to original location

On the “Confirmation” page, click “Recover” in order to begin the restore process.

Page 31: Exchange 2010 Backup and Restore

Figure 8: Recovery Confirmation page

Depending on the number of databases that are being restored as well of the size of each database, the restore can take a while.

Page 32: Exchange 2010 Backup and Restore

Figure 9: Restoring Exchange Databases

As you can see in Figure 10, the databases are dismounted and mounted automatically during the restore process.

Figure 10: Windows Server Backup automatically dismounts and mounts databases as necessary

Also, any log files in the backup will be restored (Figure 11).

Page 33: Exchange 2010 Backup and Restore

Figure 11: Restore log files

When the restore process has completed, click Close to exit the “Recover Wizard”.

Restoring Exchange 2007 Databases to an alternate location

In this section we are going to perform another restore, but this time to an alternate location so that after we restore, you will be able to mount a database to a recovery database (RDB) and merge required Exchange data with the respective production database.

Note:Since we no longer have the concept of storage groups in Exchange 2010, recovery storage groups (RSGs) have been replaced by recovery database (RDBs).

So, first thing you need to do is to start another restore session by clicking “Recover” in the “Action” pane. In the “Recovery Wizard” follow the previous steps until you get to the “Specify recovery options” page. Then select “Recover to another location” and then specify to which LUN volume you want to restore the databases and associated log files then click “Next”.

Note:On the Exchange 2010 lab server on which I perform the restore, I have a dedicated restore LUN presented and mounted via drive X.

Page 34: Exchange 2010 Backup and Restore

Figure 12: Restoring to an alternate location

On the “Confirmation” page, click “Recover” in order to begin the restore process.

Page 35: Exchange 2010 Backup and Restore

Figure 13: Restore Confirmation page

The recovery process begins and can take a while depending on the amount of databases as well as the database sizes.

Page 36: Exchange 2010 Backup and Restore

Figure 14: Restoring Exchange Databases

When the recovery job has completed, click “Close” to exit the Recovery Wizard.

Page 37: Exchange 2010 Backup and Restore

Figure 15: Restore completed

We now have all databases and log files from the recovery job at the, in the recovery wizard, specified location as can be seen in Figure 16, 17.

Page 38: Exchange 2010 Backup and Restore

Figure 16: Listing folders restored to the restore LUN

Page 39: Exchange 2010 Backup and Restore

Figure 17: Showing one of the restored log and EDB files

Before we begin creating the recovery database (RDB) and mount the respective database (in this case MDB01), let’s check the state of the database. We can do this with the Eseutil utility run with the /MH switch.

Easiest thing is to open a command prompt window and change to the directory holding the database. From here simply run the following command:

Eseutil.exe /MH “Mailbox Database Name.edb”

Notice the state of the database? Yes it is in a dirty shutdown state, which means we cannot mount it in a recovery database (RDB) before bringing it to a clean shutdown state.

Page 40: Exchange 2010 Backup and Restore

Figure 18: Database in dirty shutdown state

To bring the database to a clean shutdown state, we need to run following command from the log/database file folder:

Eseutil /R E00 /I /d

Page 41: Exchange 2010 Backup and Restore

Figure 19: Bringing the database to a clean shutdown state

Now let’s run Eseutil with the /MH switch again. As you can see in Figure 20, the database is now in a clean shutdown state.

Page 42: Exchange 2010 Backup and Restore

Figure 20: Database in clean shutdown state

Now let’s open Outlook Web App (OWA) and delete some data. In this example, we will delete all messages in the Inbox of a user mailbox stored in the database we want to recover data from via a recovery database (RDB).

Page 43: Exchange 2010 Backup and Restore

Figure 21: Deleting messages in the Inbox via OWA

As you can see the messages have now been deleted from the mailbox.

Figure 22: Items deleted

It’s time to create the recovery database (RDB). Unlike Exchange 2007, this can only be done using an Exchange 2010 commandlet (more specifically the New-MailboxDatabase cmdlet), so let’s switch over to the Exchange Management Shell and type:

Page 44: Exchange 2010 Backup and Restore

 New-MailboxDatabase -Name “Recovery Database” -Server E2K10EX02 -EDBFilePath “X:\Restore\Mailbox\MDB01\MDB01.edb” -Logfolderpath X:\Restore\\Mailbox\MDB01\–Recovery

While the recovery database are being created, you will get a warning that the restored database must be in a clean shutdown state. Since we already made sure this is the case, we can continue.

Figure 23: Creating the recovery database

When the recovery database (RDB) has been created, it is also visible via the Exchange Manage Console as can be seen in Figure 24 below.

Figure 24: Viewing the recovery database via the EMC

We now need to mount the recovery database. We can do that via the EMC or EMS. In this article we will use the Mount-Database cmdlet in the EMS:

Mount-Database “Recovery Database”

Figure 25: Mount recovery database

Page 45: Exchange 2010 Backup and Restore

The typical scenario for restoring a database to an alternate location is in order to recover mailbox content for one or more users who accidentally deleted large amounts of data or mailbox users who need something restored that no longer exist in the mailbox dumpster (by default items that have been deleted more than 14 days in the past). In this case it’s the messages we deleted via OWA earlier on in this article.

In this article I want to recover all items that were deleted in a mailbox since this backup was taken.

To recover the mailbox from the restore database, let’s first verify that the user mailbox is listed when running the following command:

Get-MailboxStatistics –Database “Recovery Database”

Figure 26: Listing mailboxes in the recovery database

Run this command to restore content of the mailbox in the recovery database to the production mailbox:

Restore-Mailbox –Identity “Henrik Walther” –RecoveryDatabase “Recovery Database”

Click Yes to the confirmation message.

Figure 27: Warning when restoring mailbox content

Mailbox data will now be restored from the recovery database to the production database.

Page 46: Exchange 2010 Backup and Restore

Figure 28: Mailbox content being restored

When completed, you get statistics about the restore mailbox job. You can for instance see information about the source and target mailbox database etc.

Figure 29: mailbox content restored to production mailbox

Now let us try to open the mailbox again. Voila the messages we deleted before performing the above merge process are now back in the Inbox.

Page 47: Exchange 2010 Backup and Restore

Figure 30: Viewing restored mailbox data via OWA

We can also specify a folder to which the content should be recovered. Doing so means that all recovered items will be recovered to a folder in the mailbox (such as Recovered data). In this case, you would need to use this command: Restore-Mailbox –Identity “Henrik Walther” –RecoveryDatabase “Recovery Database” –RecoveryMailbox “Henrik Walther” –TargetFolder “Restored content”