Table of Content
    Exchange Server Recovery

    How to ‘Shrink’ Exchange Database?


    Table of Content

      Summary: When the database becomes large, you need to shrink it to prevent data corruption and performance issues. In this post, we will discuss the detailed process to reduce the size of Exchange Server database. We will also mention an Exchange repair tool that can come in handy if the database gets corrupted due to large size or any other issue.

      Exchange Server works with databases and transaction logs. The database (EDB) stores user mailboxes and other data. Gradually, with time, the database grows large, impacting the performance of server. Also, when any data is removed and deleted, the size of the database is not automatically reduced. So, you need to shrink or reduce the size of database manually. Below, we’ll see how to shrink or reduce the database size and re-gain the storage space.

      Things to Consider Before Shrinking the Database

      Before proceeding to shrink the database, consider the following things.

      • You cannot manually shrink the databases or transaction logs because it may lead to failures and possible corruption and data loss. You must always follow the right path to prevent such issues.
      • Before you go straight to the shrinking process, you must first understand where the storage is being consumed. You can easily add more storage to the volume where the databases are hosted, but this will not resolve the problem. Optimizing storage and database sizes, according to the business, will ensure the desired performance.
      • Suppose, you are opening 1 TB file with one line of data and the rest is white space. Memory-wise, the file will take a long time to save, scan, or backup. This will impact a lot of things, like performance, backup, and infrastructure budget.
      • You can go through the check-up process first. You can perform the process of spring cleaning to see if there are mailboxes of leavers or mailboxes which are not needed anymore and are stale.
      • Transaction logs for the databases will continue to increase if the backup is not taken at least daily. These cannot just be deleted as this will affect the database integrity. Transaction logs are not just logs. They hold temporary data and act as a buffer between the database and the users, until a backup is initiated and the transaction logs are committed to the database. If the backup is not compatible with the version of Exchange Server installed or not application-aware, the backup will be useless and the transaction logs will continue to consume more storage. Do not attempt to manually delete or purge the transaction logs.

      Process to Shrink the Database

      Now, you need to see if the mailbox databases really need to be shrunk. There is a process to check this and shrink the database.

      To see if the database has any white space and how much storage space you can reclaim when you shrink the database, follow these steps:

      • Open the Exchange Management Shell (EMS) and type the following PowerShell command.

      Get-MailboxDatabase -Status | Select Name, DatabaseSize, AvailableNewMailboxSpace

      reclaim exchange storage when you shrink the database
      • The command will display all the databases with their respective size, along with the available space. If you reduce the database size, you can reclaim the space given under the AvailableNewMailboxSpace.
      • To reduce the database size, you need to perform the process in a maintenance window. You cannot shrink the database if it’s mounted. You need to also to pause antivirus scans and scheduled backup jobs to ensure that nothing is locking the database files.
      • It is strongly suggested that before proceeding with this process take a full backup. If something happens, you can fall back with no impact.
      • To dismount the database, you can use the Exchange Admin Center (EAC) or run the below command in PowerShell.

      Dismount-Database <database name>

      To dismount the database, you can use the Exchange Admin Center

      After this is done, you can now proceed to reduce the database size.

      • Before proceeding, you must consider that you have a temporary drive or enough storage.

      Eseutil /d <source edb file> /t <temporary edb file>

      • Depending on the size of the mailbox database, it may take some time for the process to complete.
      Check you have a temporary drive or enough storage
      • When the process is complete, the database can be mounted so that the users will be able to access it. To mount the database, you can use the below command.

      Mount-Database <database name>

      mount exchange database

      To Conclude

      If the database increases in size, it is not a nice situation as it may result in logs and database damage or corruption. To reclaim some space, you can shrink or reduce the size of the database. You can also consider adding another disk and moving the archive mailboxes or mailboxes which are not used to that disk. If the databases or transaction logs are damaged after a failure or lack of storage, the best option to recover all the data with minimal effort is to use an Exchange Database Recovery software such as Stellar Repair for Exchange. This application can help you recover mailboxes and other data from corrupt databases of any version and any size. It allows you to granularly export recovered user mailboxes, user archives, disabled mailboxes, shared mailboxes, and public folders to PST and other file formats. You can also export recovered user mailboxes directly to a live Exchange Server database.

      Was this article helpful?

      No NO

      About The Author

      Shelly Bhardwaj linkdin

      I am a Product Consultant and is associated with Stellar Data Recovery from last 8 years. I write about the latest technology tips and provide custom solutions related to Exchange Server, Office 365, MS Outlook, and many other Email Clients & different flavors of OS Servers. Read More

      Leave a comment

      Your email address will not be published. Required fields are marked *

      Image Captcha
      Refresh Image Captcha

      Enter Captcha Here :

      Related Posts

      WHY STELLAR® IS GLOBAL LEADER

      Why Choose Stellar?

      • 0M+

        Customers

      • 0+

        Years of Excellence

      • 0+

        R&D Engineers

      • 0+

        Countries

      • 0+

        PARTNERS

      • 0+

        Awards Received