Backtrack:  
 
by lunarg on August 22nd 2014, at 12:44

In case you need to manually truncate the database logs of your Exchange server, you can follow the steps below. You'll need sufficient permissions and access to the Exchange Management Shell.

Caution!
Be cautious when you perform this action, as making mistakes here could cause database corruption and loss of data. Don't do this during production hours because this will temporarily make some (or all) mailboxes unavailable! As always, it's a good idea to have a working backup before attempting this.
  1. Open the Exchange Management Shell.
  2. If you don't know the physical path of your database, locate it first:
  3. Get-MailboxDatabase | Select Name,EdbFilePath,LogFolderPath

You'll notice the database name, which you need to mount/dismount the database, and the physical location of the database, specified by the value of EdbFilePath. The value LogFolderPath reveals the location of the Exchange database logs, which you will be truncating in a short while.

  1. Dismount the database. Note that this will bring all mailboxes stored in that particular database offline!
  2. Dismount-Database "Mailbox Database Name"
  3. Next, check the state of the database:
  4. eseutil /MH "drive:\path-to\database.edb"

The output of the command will tell you whether the database has been shut down cleanly. Fairly at the top, look for a field that says State:. If it says Clean Shutdown, then you can go ahead with the next step.

If it doesn't say Clean Shutdown, the database is still in use, or shut down dirty, and you can't truncate the Exchange logs!!

  1. Move all *.log files, located in the directory specified by the LogFolderPath (see the 2nd step of this article). You could delete them, but I recommend moving them to another location first to be on the safe side. You can easily delete them afterworths when everything is up and running again.
  2. Re-mount the database:
  3. Mount-Database "Mailbox Database Name"
  4. Test whether the database was succesfully mounted:
  5. Get-MailboxDatabase -Status "Mailbox Database Name" | Select Name,Mounted

The value of Mounted should be True.

  1. You can also test the MAPI connectivity to make sure your clients can access their mailboxes:
  2. Test-MAPIConnectivity -Database "Mailbox Database Name"

If the value of Result is Success and there are no errors, the database is succesfully mounted again, and clients can access it.

If you have more than one database, you can repeat the steps to perform manual truncate of all of them.