Monday, January 11, 2010

Soft recovery of Exchange 2003 database

A step by step walk-through of procedure to be followed when exchange database fail to mount in Exchange System Manager. Please note that I have personally tried these steps with MS premier support executive on call, however I take no guarantee that

1. Ensure that Exchange System Attendant and Exchange Information Store service are started.
2. Now try to mount the database and if database is not mounting and giving an error then check the shutdown state of the database.
3. To check whether database are in clean shutdown or dirty shutdown. Run the below command from the “Exchsrv\bin” directory:

Eseutil /mh “Path of the database” as indicated below and check the state of the database for e.g. :

Eseutil /mh “K:\EXCHANGE20-SG01-DB\EXCHANGE20-SG01-MBX01.edb”




4. Check if the database is in dirty shutdown state. If yes then also check for the “Log required” field as shown above and make sure you have those log files for soft recovery.

5. To check how many logs files have been committed to the database RUN Eseutil /mk “path of the checkpoint file”

Eseutil /mk “L:\EXCHANGE20-SG01-LOGS\E00.chk”

The result of the above command and the logs required as per /mh may not match of the chk file is corrupt. The more reliable output is from /mh

6. To make sure that all the log files are consistent, run
Eseutil /ml “Path of the log files\log prefix” as indicated below.
Eseutil /ml “L:\EXCHANGE20-SG01-LOGS\E00”

Below command will help you check the health of all the log files in the location. Be careful that this command will take VERY long time to complete if you have too many files in the log folder.

A better option is to move the committed log files to a backup folder and then run the above command on the remaining log files to check the consistency of uncommitted log files.





7. You may not see the last log file required in the log folder because that log file may be E00.log. You can find the actual log file name of e00.log “Eseutil /ml “Path of Log File\e00.log”

8. Make sure that you have all the logs files in sequence and are in consistent state which have not yet been committed and if any log file is missing or corrupted then soft recovery will not be successful.

9. To run the soft recovery run the command “Eseutil /r Enn /L “Path of the log files” /d “path of database file”.

E.g. Eseutil /r E00 /l “L:\EXCHANGE20-SG01-LOGS” /d “K:\EXCHANGE20-SG01-DB\EXCHANGE20-SG01-MBX01.edb”






If the above command fails, you can include the switch “/s” for giving the location of the “.chk” file.

Another switch /i can be appended to the above command to ignore the other databases that run off the same set of log files if they are mounted.

7. If the above command does not work then you can cut and paste all the committed log files and Enn.chk from the log drive in another location as backup and try mounting the database. Exchange will create a new chk file and will try to do a soft recovery itself.

If all the above steps do not succeed it is time to call Microsoft and log a SEV 1 case with them.

------------ End of Document ------------------------
Tags: Exchange Server
Published Date: 20100111

Thursday, January 7, 2010

How to delete an email from a mailbox using Exchange Shell

There have been times when a user has sent an email to a big DL and wants it to be recalled. We all know that Exchange recall feature is not much effective. However in Exchange 2007 you can scan all mailboxes and delete the email from them. The best way is to narrow your search as much as possible.

However remember that you need an account which has full access to the mailbox from which you want to delete the email. The BES service account generally has that permissions. You will have to "Run As" the EMS with this account.

Below are two examples of such command.

Get-Mailbox -Server SERVER_NAME -resultsize unlimited | Where-Object {$_.OrganizationalUnit -like "Mydomain.corp/OU/OU/OU*"} | Export-Mailbox -SubjectKeywords "Some keywords from the subject line" -DeleteContent -StartDate 10/08/2009 -IncludeFolders "\Inbox"

The above command finds all mailboxes from a particular server and which are in a particular OU. It then users the Export-Mailbox command to delete the mails as per the specified criteria.

StartDate is use to delete the emails that are after the specified date. You can also use EndDate to specify the range.

Include Folders further narrows the search and reduces the scan time considerably.

Get-Mailbox -Server SERVER_NAME -resultsize unlimited | Export-Mailbox -SenderKeywords "Sender's SMTP address" -DeleteContent -StartDate 10/08/2009 -IncludeFolders "\Inbox"

You can also delete emails from a specific sender using the above command.

Please be careful to test this command before running in production environment as you may end up deleting emails from users mailbox that they need if any wrong criteria is chosen.

------------ End of Document ------------------------
Tags: PowerShell, Exchange Server
Published Date: 20100107