How To: Exchange database Recoveryor Become an Exchange database Recovery expert!!!!!


SUMMARY

This article describes how to use the Microsoft Exchange Server Eseutil tool (Eseutil.exe)  

How to Recover a Corrupt Exchange Database

  1. Be sure there are no hardware issues and that the File System is intact (run chkdsk /r and repeat until it doesn’t return errors), restore from backup is preferable if possible.
  2. Add the Exchange bin to the “path” statement
    1. Start -> Right click my computer -> properties -> advanced Tab -> environment variables (scroll down if you have to)
    2. In the bottom pane double click “path”
    3. Go to the end of the line enter a semi-colon and enter the path to the exchange bin directory
  3. Verify that there is twice as much free space as the size of the database,
    i.e if the database is 10 gb you need to have at least 20 gb free
  4. Open command prompt
  5. Change to the directory where the database is (usually C:\program files\exchsrv\mdbdata, if you cant find the database search for *.edb)
  6. Type eseutil /mh <database name> (usually priv1.edb)
    1. Look for the shutdown state (may have to scroll up) , if its in clean shutdown then you should be able to mount the database, but chances are if your reading this its in a dirty shutdown and you need to continue on
  7. Type eseutil /k <database name> (usually priv1.edb) look for “Bad Checksums” if you have any, your repair possibility will be slim (just make a note of it)
  8. Type eseutil /ml e00 we are looking for any missing logs (if none missing go on to step 9)
    1. if there are any we have to move all subsequent logs. and the e00 log to another location, rename the last log to e00.log
    2. Example we have logs E00021-E00035 and E00033 is missing, remove E00, E00034 and E00035
  9. Re-name the .chk file to .oldchk
  10. Type eseutil /r E00
    1. Wait for that to complete, if it completes successfully move on to 11 otherwise run “P”
      1. P. eseutil /p <database name> this will force the database into a clean shutdown and will rip out any incomplete pages, this should only be done as a last resort
  11. Start information store service, verify that the store is mounted in Exchange System Manager (ESM), if its not mounted right click and mount
    1. Start -> All Programs -> Microsoft Exchange -> System Manager
    2. Expand Administrative Group -> Administrative group -> Servers -> {Server name} -> {Storage Group}
    3. Right Click Mailbox store -> mount
  12. Dismount the store in ESM
  13. Go back to the command window
    1. type isinteg –s <servername> -fix –test alltests
    2. When prompted select the store that you repaired
    3. If any fixes are reported re-run until none are reported (just like chkdsk)
  14. Type eseutil /d <database name> (usually priv1.edb)
  15. Remount the database and should now be able to send receive mail

Command Description
Eseutil is a Jet database repair utility
Switch Action
/D Defragments the database
/R Soft recovery of the database
/G Integrity Check
/K Checksum
/P Hard Repair
/ML Log File dump
/MH Database file dump
/Y Copy
/C Restore

Isinteg is a integrity checker much like the windows chkdsk for NTFS

ESM Exchange System Manager is the GUI Management tool for exchange
Exchange 2007 changed the name to EMC Exchange Management Console

REFERENCES

For more information about Exchange 2003, visit the following Microsoft Web site:
http://technet.microsoft.com/en-us/library/bb123872.aspx

Use the Eseutil Utility to Detect File Header Damage in Exchange 2003
http://support.microsoft.com/kb/825088

How to defragment with the Eseutil utility (Eseutil.exe)
http://support.microsoft.com/kb/192185

Description of the Isinteg utility
http://support.microsoft.com/kb/182081

Problems with Autodiscover, Out of Office, Free Busy, OWA and Outlook Anywhere


One of the most common issues I see has to do with certificates, so to start out we need to understand some things about certificates.

Certificates are used to encrypt traffic between exchange servers and clients.

There are 3 things that need to be true for a certificate to be valid.

  1. The name used to access the resource needs match the certificate exactly.
    Example: If I connect to say owa with mail.mydomain.com then the certificate needs to also have mail.mydomain.com on it in either the subject or the subject alternate name field. clip_image002
  2. The Certificate time must be valid
  3. The issuing Certificate Authority must be trusted by the client. (It needs to exist in the “Trusted Root Certificate Authorities)

clip_image004

Now that we have some VERY basic info about certificates.

The issues I see constantly are: Autodiscover, Out of Office, Free Busy and Outlook Anywhere miss-configuration.

Reasons:

  1. Not using a trusted certificate
    • Solution: use a 3rd party cert provider
  2. The certificate name does not match the DNS name\s
    • Solution: create a new cert request containing all the names used to access the server. Minimum of
      1. Autodiscover.domain.com
      2. <ExternalName>.domain.com
      3. <InternalName>.domain.local (if using for internal systems also)

Example of a correct cert request:

  •  
    • New-ExchangeCertificate -GenerateRequest -SubjectName “C=US, O=Org Name, CN=mail.domain.com” -domainname mail.domain.com, autodiscover.domain.com, servername, servername.domain.local -FriendlyName mail.domain.com -privatekeyexportable:$true -path c:\cert_myserver.txt

Example of Cert import

  •  
    • Import-ExchangeCertificate –Path “C:\CertificateFile.cer” | Enable-ExchangeCertificate -Services pop, smtp, iis, imap  (2007 Example)
    • Import-ExchangeCertificate -FileData ([Byte[]]$(Get-Content -Path c:\certificates\newcert.cer -Encoding Byte -ReadCount 0)) | Enable-ExchangeCertificate -Services SMTP   (2010 Example)
  1. External URLs not defined correctly
  2. Can’t resolve Fully qualified domain names (FQDN)

           Should look like this

         image

  1. SCP Record does not contain the correct value
    1. Test from outlook:
      1. Hold CTRL and Click the outlook Icon in the system tray image and select “Test Email Auto Configuration”image
      2. Uncheck guess smart and click Test
    2. check SCP value returned
      1. If you get info on the results tab then autodiscover is working
      2. If not look at the Log tab and look at the URL that is returned

              image

  1.  
    1. Test the URL (Type it into Internet explorer) if its not change SCP to a valid URL
      1. Run ADSIEDIT and view the “Service Binding Information” to verify the correct value

                     image

2. Set the SCP allong with the internal URL: Set-ClientAccessServer CASServerName -AutoDiscoverServiceInternalUri https://mail.domain.local/Autodiscover/Autodiscover.xml

Most Common Exchange issues


I had a co-worker ask me to put together the most common exchange issue I see, so I figure that would be a good thing to pass on in this blog

Over the next couple weeks I will post the details as well as the solutions, for now here is the list.

Blackberry Enterprise Server (BES 4.1) Install Issue


So trying to install BES 4.1 on a SBS premium (I know not the best situation but thats what the client wants).

Anyway we try to install and get the following error: Faulting application Setup.exe, version 4.1.4.19, faulting module ntdll.dll

Well so we start thinking ok maybe its Antivirus or something else using the DLL, maybe a permission issue….. NOPE, turns out that BES install doesnt like multiple IP address on 1 NIC, we simply removed the extra IP from the external interface and viola install works without a hitch!

Exchange 2003-2007 mail stuck in queue between servers


Had a situation where we were migrating from 2003 to 2007 and were unable to send mail between hosts, here are the things we tried and ultimately the solution

 Symptoms

  1. Cannot send mail between servers
  2. On 2003 mail stuck in queue – Unable to bind to the destination server in DNS
  3. On 2007 mail stuck in queue – unable to authenticate with remote server

Actions taken

  1. Checked the SMTP virtual server on 2003 for smart host and external DNS – removed the external DNS
  2. Deleted and re-created routing group connector
  3. Removed 3rd party mail filter software
  4. Verified AD replication
  5. Validated DNS records
  6. Disabled Firewalls
  7. Enabled verbose SMTP logging – this is where we were seeing that 2007 was doing a ehlo then a quit

Solution:  Found that SMTP on the 2003 was missing  the X verbs (x-EXPS, X-Link2state, xexch50,) this causes the 2007 to not see the 2003 as an exchange server and quits, the solution was to re-install exchange on the 2003 server to re-enable the verbs in SMTP