Wednesday, March 10, 2010

Exchange 2010 DAG backups using Windows Server Backup

I wrote a while back on Exchange backups for 2007 and 2010 using Windows Server backup. Then I wrote here about product support for Exchange backups.

That first link is a little dated as the screens are from Windows 2008 and Exchange 2007 SP2. The Windows 2008 R2 screens are slightly different.

Rehashing the differences only, the VSS Full options are in a slightly different place:


Under Advanced Settings, there is an exclusion tab (I leave mine blank, but I could exclude things like Exchange binaries, etc) but more importantly is the VSS Full backup option:



Beyond that, the next new bit of information is about backing up DAG copies. Microsoft states that the Windows Server Backup (WSB) does not support passive database copies.

"However, the built-in support for Windows Server Backup is for active copies only. You can't use Windows Server Backup to back up passive copies."

This leaves you with minimal options.. If I have in this example, 3 databases, and 3 servers, I need to either move all the databases to one server and back it all up, or I need to back have backup jobs on each server, only backing up the disk with an active database.

The problem with the latter option is that the databases might move as maintenance or issues occur, and then you would have a failed job on those databases.

So I opted to move all the databases to be active on one server, run a complete backup, and then re-disperse the databases.

Here's the batch script I created. A few things to know here.

1) Learn how to use wbadmin.exe
2) You will need to change the volumes to match your server. Running mountvol.exe from an elevated command prompt will list all volumes on your server for you. Do note, the -allCritical does not automatically choose drives without system files on it (aka, Exchange disks)
3) You will need to change the username/password seen in the script to match your environment. User rights should be Backup Operators, and Exchange Org Administrator.

rem - Launch Powershell with Exchange cmdlets and run ps1 script to move all databases to on server

PowerShell.exe -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; c:\installers\move-databasestoexch1.ps1"

rem - Launch a backup
rem - determined volume mount points using moutvol.exe

wbadmin start backup -backupTarget:\\bdc\Exchangebackups\exch1 -include:\\?\Volume{1be73a5a-052f-11df-82c2-806e6f6e6963}\,\\?\Volume{26934b04-09f5-11df-a2b7-002564f8c664}\,\\?\Volume{26934b0b-09f5-11df-a2b7-002564f8c664}\,\\?\Volume{26934b0e-09f5-11df-a2b7-002564f8c664}\,\\?\Volume{1be73a5b-052f-11df-82c2-806e6f6e6963}\ -user:user@domain.org -password:yescleartext -vssFull -quiet

rem - Launch Powershell with Exchange cmdlets and run ps1 script to move all databases back to separate servers.

PowerShell.exe -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; c:\installers\move-databasestopreferred.ps1"


Here's the move-databasestoexch1.ps1 script:

Move-ActiveMailboxDatabase DB1 -ActivateOnServer EXCH1 -MountDialOverride:None -Confirm:$false
Move-ActiveMailboxDatabase DB2 -ActivateOnServer EXCH1 -MountDialOverride:None -Confirm:$false
Move-ActiveMailboxDatabase DB3 -ActivateOnServer EXCH1 -MountDialOverride:None -Confirm:$false

And the move-databasetopreferred.ps1 script:
Move-ActiveMailboxDatabase DB1 -ActivateOnServer EXCH1 -MountDialOverride:None -Confirm:$false
Move-ActiveMailboxDatabase DB2 -ActivateOnServer EXCH2 -MountDialOverride:None -Confirm:$false
Move-ActiveMailboxDatabase DB3 -ActivateOnServer EXCH3 -MountDialOverride:None -Confirm:$false

I was able to schedule the backup using task scheduler and it works!

It certainly is not elegant. I would much prefer a backup product that looks for active mailbox databases and backs up accordingly. I would also enjoy not having a password in clear text in a batch file as a backup solution. But it works for now. I am planning on adding a "DAG support" column to my backup product matrix soon, and I will say "with scripting" for Windows Server Backup and link to this article.

Labels: , ,

1 Comments:

At November 19, 2011 8:10 PM , Blogger Gilberto Verástegui said...

Really good, as you say, not elegant but nice and effective procedure for small companies with small budgets lol

 

Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

<< Home