Reduce Exchange 2016 Mailbox Database size using Eseutil.
In this post I will walk through the steps of reducing the Exchange Mailbox Database size, However the method of reducing the Mailbox Database size varies from different administrators. If you can afford to have downtime on a Mailbox Database then these steps would work for you. Some Exchange Administrators and in most cases myself ,will simply just create another new Mailbox Database and Move Mailboxes from one Database to another and then delete the old one.
For the purpose of this post , I will be using a build in tool from Microsoft called Eseutil.
Eseutil is a command line utility that works with Extensible Storage Engine (ESE), database (.edb) files, streaming (.stm) files, and log (.log) files associated with an Information Store, in a given Storage Group. The tool can be run on one database at a time from the command line and can be used to perform a range of database tasks from repair, offline defragmentation, and integrity checks in Exchange Server .
The most common Eseutil switches are listed in the table below.
Eseutil Mode
Switch
Description
Defragmentation
/D
Eseutil defragments the database files. This mode reduces the gross size on disk of the database (.edb) and streaming files (.stm) by discarding most empty pages and ad hoc indexes.
For more information, see these topics:
Eseutil /D Defragmentation Mode
How to Run Eseutil /D (Defragmentation)
Repair
/P
Eseutil repairs corrupt database pages in an offline database but discards any that can’t be fixed. In repair mode, the Eseutil utility fixes individual tables but does not adjust the relationships between tables. ISInteg should be used to check logical relationships between tables.
For more information, see these topics:
Eseutil /P Repair Mode
How to Run Eseutil /P (Repair) in Different Scenarios
Restore
/C
Eseutil displays the Restore.env file and controls hard recovery after restoration from online backup.
For more information, see these topics:
Eseutil /C Restore Mode
How to Run Eseutil /C (Restore) in Different Scenarios
Recovery
/R
Eseutil replays transaction log files or rolls them forward to restore a database to internal consistency or to bring an older copy of a database up to date.
For more information, see these topics:
Eseutil /R Recovery Mode
How to Run Eseutil /R in Recovery Mode
Integrity
/G
Eseutil verifies the page level and Extensible Storage Engine (ESE) level logical integrity of the database but does not verify database integrity at the Information Store level.
For more information, see these topics:
Eseutil /G Integrity Mode
How to Run Eseutil /G in Integrity Mode
File Dump
/M
Eseutil displays headers of database files, transaction log files, and checkpoint files. The mode also displays database space allocation and metadata.
For more information, see these topics:
Eseutil /M File Dump Mode
How to Run Eseutil /M in File Dump Mode
Checksum
/K
Eseutil verifies checksums on all pages in the database and streaming files.
For more information, see these topics:
Eseutil /K Checksum Mode
How to Run Eseutil /K in Checksum Mode
Copy File
/Y
Eseutil performs a fast copy of very large files.
For more information, see these topics:
Eseutil /Y Copy File Mode
How to Run Eseutil /Y in Copy File Mode
To get started I will check the current available whitespace for the Mailbox Database DB1 and then Dismount the Database.
1
Get-MailboxDatabase DB1 -Status | Format-List Name, DatabaseSize, AvailableNewMailboxSpace
Next Dismount the Database
1
Dismount-Database DB1 -confirm:$false
After the Mailbox Database has been Dismounted navigate to the install directory where Exchange has been installed.
1
C:\Program Files\Microsoft\Exchange Server\V15\Bin>eseutil.exe
Open eseutil to view the available switches.
Next I will run the Defrag on Dismounted Database called “DB1”
C:\Program Files\Microsoft\Exchange Server\V15\Bin>eseutil.exe /d D:\DB\DB1.edb
Lets go ahead and Mount the Defragmented Database
1
Mount-Database DB1
Next lets view the available whitespace after the Defragmentation of the Database.
1
Get-MailboxDatabase DB1 -Status | Format-List Name, DatabaseSize, AvailableNewMailboxSpace
The amount of time it takes to run the Defragmentation of a Mailbox Database depends on the size of the Database and the Hardware its running from.
This has been copied for my own reference as it is super handy and exactly what I need to reference in the future. Taken from https://www.thatlazyadmin.com/2017/07/25/reduce-exchange-2016-mailbox-database-size-using-eseutil/
(Thanks for the perfect details. Needed my own copy as I can’t afford to miss this in the future)
Other Useful References is this for the database specifics: https://www.datanumen.com/blogs/depth-understanding-system-mailboxes-exchange-server/