How to recover an exchange server with or without backups
Posted: Mon Jul 08, 2013 1:00 pm
First off, This guide has actually been used by me recently. certainly does work and saved my life somewhat . Also this is used in reference to Exchange server 2007, it can be used with later version of Exchange server, however you may need to adjust to match your system.
The statement 'with or without backups' needs a little clarification. When I say without backups, what I mean is as long as you can recover the data drive from the failed exchange server, specifically the folders that contain your exchange server mailboxes (your storage groups).
1. install a New OS onto the New hardware that will replace your failing or upgraded exchange server. Make sure that the partitions you can create are enough to match the current drive letters you have on your exchange server. You do not need to match hardware (not an issue obviosuly if you are using virtualisation)
2. using your previous install note or ADSIedit.msc make sure you have created the folder path on the same drive that you previously installed exchange. With ADSIedit you can find the exchange object that contains your install path under Configuration section of the AD tree, navigate to the following
CN=ExServerName,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=ExOrg Name,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=DomainName,CN=Com
Right click on the exchange servername and click properties. The value you are tring to find is:
msExchInstallPath
3. If your path is not the default path (%programfiles%\Microsoft\Exchange Server\V14 for 2007) you will need to make a note of it for using the recoverserver switch with the exchange server
4. Make sure your replacement server has the same hostname and IP of the failed exchange server.
5. You will need to reset the account against the AD object for your exchange server hostname. This is to allow the DC to accept your domain join request without complaining (joining a new server to a domain which already has a computer with the same hostname, always confuses AD)
6. On your DC start the Microsoft Management Console (MMC) AD Users and Computers snap-in, locate the Exchange system, right-click it, and select Reset.
7. Join your new server to the domain.
8. Make sure the server is fully up to date with windows update and download the latest microsoft exchange server (at the time of writing this was SP3 for 2007)
9. Best to make sure mail does not flow into the server as soon it has installed, so either block port 25, or make sure the transport service does not start after recovery.
10. using powershell make sure you have the following components installed:
ServerManagerCmd -i Web-Server
ServerManagerCmd -i Web-ISAPI-Ext
ServerManagerCmd -i Web-Metabase
ServerManagerCmd -i Web-Lgcy-Mgmt-Console
ServerManagerCmd -i Web-Basic-Auth
ServerManagerCmd -i Web-Digest-Auth
ServerManagerCmd -i Web-Windows-Auth
ServerManagerCmd -i Web-Dyn-Compression
Depending on what features you have, you may need to install more modules. However for most instannces, the above is fine.
11. Extract the Exchange software and navigate to it via a DOS prompt (either via admin mode, or make sure UAC is turned off). Run the following
Setup /m:RecoverServer /TargetDir "path of msExchInstallPath grabbed from point 2"
This command has a variety of switches that may be of use. best to look up the command and find out if there are addtional switches to use. I believe there is a 'do not start the transport role' switch which could be useful. You will NOT be able to do this on a EDGE server, however on a HUB server you should see something like this.
This if successful takes all it's information from the exchange server objects in AD. It should also find all the mailbox, email addresses, groups, settings and distribution lists. What it will not have however. Is the data..
12. Recover the data. This is where it could become tricky. If you have up to date backups, then install the backup software and recover the databases needed as per your own instructions.
13. If you do not have any backups, but do have the actual data, make sure partition that holds old data is mounted as a new drive on the new server (for Example, if you have a C and a D drive. mount it as F). You can then copy the storage groups over from F to D (presuming D is your exchange server path). This could take an extremely long time, especially if you have 100's of GB of transaction log files, Exchange will typically need these log files and will not mount without them.
If the old data drive is usable then for at least a stop gap. You can use the exchange shell and adjust where exchange thinks it's files are from D to F. You cannot do this in the console as the system always requires there to be a existing DB to move (which you currently do not have). To do this open the shell and type the following (matched to your own environment)
move-DatabasePath -Id <dbname> -ConfigurationOnly -EDBFilePath <new-full-path-to-edb>
This should be a temporary solution to get mail flowing again. You will probably have to do this for both frist and second storage groups.
Once you have run this command (Without errors. You will then be able to mount the DB via the shell or the console. On the console. Go to Server Configuration > Mailbox (Database Management) > First storage Group > right click 'mount database'. repeat for second storage group. Your users should no be able to connect to exchange and see their mailboxes. Once you are happy that mailboxes are all there. re-enable the Transport service or unblock port 25. Voila!
That said this is a temporary solution. moving the DB files to the correct drives should be priority (And making sure backups are working).You will want to use the same command again after you move the data to it's final location. using this command WITHOUT the -ConfigurationOnly switch will result in the DB files being physically moved to the new location, this method does work (obviously the DB will be taken offline and mail flow will stop), but does not give any status updates whatsoever. So you have no idea how long it will take. Your better option would be to use robocopy or ESAUTIL /y command to move the files.
I hope that this was clear.
http://technet.microsoft.com/en-us/library/bb123496%28v=exchg.80%29.aspx - technet reference
The statement 'with or without backups' needs a little clarification. When I say without backups, what I mean is as long as you can recover the data drive from the failed exchange server, specifically the folders that contain your exchange server mailboxes (your storage groups).
1. install a New OS onto the New hardware that will replace your failing or upgraded exchange server. Make sure that the partitions you can create are enough to match the current drive letters you have on your exchange server. You do not need to match hardware (not an issue obviosuly if you are using virtualisation)
2. using your previous install note or ADSIedit.msc make sure you have created the folder path on the same drive that you previously installed exchange. With ADSIedit you can find the exchange object that contains your install path under Configuration section of the AD tree, navigate to the following
CN=ExServerName,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=ExOrg Name,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=DomainName,CN=Com
Right click on the exchange servername and click properties. The value you are tring to find is:
msExchInstallPath
3. If your path is not the default path (%programfiles%\Microsoft\Exchange Server\V14 for 2007) you will need to make a note of it for using the recoverserver switch with the exchange server
4. Make sure your replacement server has the same hostname and IP of the failed exchange server.
5. You will need to reset the account against the AD object for your exchange server hostname. This is to allow the DC to accept your domain join request without complaining (joining a new server to a domain which already has a computer with the same hostname, always confuses AD)
6. On your DC start the Microsoft Management Console (MMC) AD Users and Computers snap-in, locate the Exchange system, right-click it, and select Reset.
7. Join your new server to the domain.
8. Make sure the server is fully up to date with windows update and download the latest microsoft exchange server (at the time of writing this was SP3 for 2007)
9. Best to make sure mail does not flow into the server as soon it has installed, so either block port 25, or make sure the transport service does not start after recovery.
10. using powershell make sure you have the following components installed:
ServerManagerCmd -i Web-Server
ServerManagerCmd -i Web-ISAPI-Ext
ServerManagerCmd -i Web-Metabase
ServerManagerCmd -i Web-Lgcy-Mgmt-Console
ServerManagerCmd -i Web-Basic-Auth
ServerManagerCmd -i Web-Digest-Auth
ServerManagerCmd -i Web-Windows-Auth
ServerManagerCmd -i Web-Dyn-Compression
Depending on what features you have, you may need to install more modules. However for most instannces, the above is fine.
11. Extract the Exchange software and navigate to it via a DOS prompt (either via admin mode, or make sure UAC is turned off). Run the following
Setup /m:RecoverServer /TargetDir "path of msExchInstallPath grabbed from point 2"
This command has a variety of switches that may be of use. best to look up the command and find out if there are addtional switches to use. I believe there is a 'do not start the transport role' switch which could be useful. You will NOT be able to do this on a EDGE server, however on a HUB server you should see something like this.
This if successful takes all it's information from the exchange server objects in AD. It should also find all the mailbox, email addresses, groups, settings and distribution lists. What it will not have however. Is the data..
12. Recover the data. This is where it could become tricky. If you have up to date backups, then install the backup software and recover the databases needed as per your own instructions.
13. If you do not have any backups, but do have the actual data, make sure partition that holds old data is mounted as a new drive on the new server (for Example, if you have a C and a D drive. mount it as F). You can then copy the storage groups over from F to D (presuming D is your exchange server path). This could take an extremely long time, especially if you have 100's of GB of transaction log files, Exchange will typically need these log files and will not mount without them.
If the old data drive is usable then for at least a stop gap. You can use the exchange shell and adjust where exchange thinks it's files are from D to F. You cannot do this in the console as the system always requires there to be a existing DB to move (which you currently do not have). To do this open the shell and type the following (matched to your own environment)
move-DatabasePath -Id <dbname> -ConfigurationOnly -EDBFilePath <new-full-path-to-edb>
This should be a temporary solution to get mail flowing again. You will probably have to do this for both frist and second storage groups.
Once you have run this command (Without errors. You will then be able to mount the DB via the shell or the console. On the console. Go to Server Configuration > Mailbox (Database Management) > First storage Group > right click 'mount database'. repeat for second storage group. Your users should no be able to connect to exchange and see their mailboxes. Once you are happy that mailboxes are all there. re-enable the Transport service or unblock port 25. Voila!
That said this is a temporary solution. moving the DB files to the correct drives should be priority (And making sure backups are working).You will want to use the same command again after you move the data to it's final location. using this command WITHOUT the -ConfigurationOnly switch will result in the DB files being physically moved to the new location, this method does work (obviously the DB will be taken offline and mail flow will stop), but does not give any status updates whatsoever. So you have no idea how long it will take. Your better option would be to use robocopy or ESAUTIL /y command to move the files.
I hope that this was clear.
http://technet.microsoft.com/en-us/library/bb123496%28v=exchg.80%29.aspx - technet reference