In Microsoft Exchange Server, a mailbox database (existing as an EDB file) is the central repository that stores and manages the emails, attachments, calendars, and other items of the mailboxes. For some specific reasons, you may make the Exchange Server database available (mount) or unavailable (dismount). You can serve these tasks with the help of PowerShell cmdlets in the Exchange Management Shell (EMS) environment or through the Exchange Administration Center (EAC). Right here, we will focus on how to mount and dismount the Exchange database via PowerShell. We will also briefly discuss the role of Exchange server recovery software in carrying out hassle-free restoration of the Exchange database.
What happens when you mount and dismount Exchange mailbox databases?
Before understanding the reason behind these two tasks, you should know the results of performing them.
Database mounting
It refers to loading it in the Exchange Server memory, enabling it to go online and perform various tasks with ease, like:
- Sending/receiving emails
- Running maintenance tasks in the background
- Making the mailboxes accessible through Outlook, Outlook Web Access (OWA), etc.
Database dismounting
In the Exchange Server, dismounting a database means bringing it offline. It leads to the following consequences:
- Mailboxes become inaccessible
- Delivery of emails to the mailboxes of the dismounted database fails
- It becomes easier to copy or modify the EDB files
What is the need to dismount the mailbox database in Exchange Server?
Admins carry out the dismounting tasks for several reasons. For instance, you may need to perform database maintenance jobs, fix corrupted EDB files, or migrate data to a different server. Specifically, during the maintenance task, you may have to perform varied tasks:
- Move the database files to another location
- Run defragmentation offline by using Eseutil/D
- Run integrity checks by using Eseutil /G
- Perform the database restore by using a backup file
Once you complete your task, proceed to mount the database to bring it back to online status.
How to mount Exchange Mailbox databases using PowerShell?
When you wish to mount or dismount a database in Exchange Server 2019 and earlier versions, you must ensure to have the Mailbox Database Management role assigned to your account. The administrative role groups include this role by default. If you are not an Exchange administrator, ask your admin to assign the role. You can run the command below in the EMS environment for role assignment:
New-Management RoleAssignment -Role “Mailbox Database Management” -User Mohit
Once done, you can proceed to mount your Exchange mailbox database using the PowerShell cmdlets. Here are the requisite steps:
- Open the Exchange Management Shell (EMS) on your Exchange Server
- Check the status of the Exchange database by using the Get-MailboxDatabase cmdlet
Get-MailboxDatabase | Format-List Name, Mounted
- The command will show the name and status (mounted or dismounted) of all the Exchange databases.
- The Format-List parameter will display the result vertically
- If you see the database in the dismounted state, run the Mount-Database cmdlet to mount it.
Mount-Database -Identity “DatabaseName”. Make sure to mention the name of your specific database
- To confirm the successful mounting of the database, run the Get-MailboxDatabase command again: Get-MailboxDatabase | Format-List Name, Mounted
How to dismount Exchange Mailbox databases using PowerShell?
Follow the steps below to dismount your mailbox database from the Exchange Server through PowerShell commands:
- Open the EMS on your Exchange Server
- Check the status of your database by using the same command that you used during the mounting process.
Get-MailboxDatabase | Format-List Name, Mounted
- If the status shows mounted and you want to dismount the database, use the Dismount-Database cmdlet as shown below:
Dismount-Database -Identity “DatabaseName”
- Mention the name of your database that you wish to dismount.
- When done, again run the Get-MailboxDatabase to confirm the success of the operation:
Get-MailboxDatabase | Format-List Name, Mounted
Exchange database mounting: Issues and Resolutions
These mount and dismount methods can cause errors and may cause the loss of significant database items. For instance, insufficient disk space can cause mounting issues. Here are more errors that you may face, followed by their resolution.
1. MapiExceptionDatabaseError: Unable to mount database
This error happens because of lost or corrupted database files or when the files face permission issues. Here is the resolution:
- Run the following command to detect the corruption:
Eseutil/mh “Exchange Database File Location.”
- If the status shows Dirty Shutdown, use the command below:
Eseutil/p “Exchange Database File Location”
Provide the exact location of our Exchange database file
2. Database can’t be found
This error points to the inability of the server to find the database file. The reason behind it could be an unregistered database or a wrong file path.
Resolution
- Ensure the presence of log files and the database containing them at the correct location
- Check the proper setup of the file directory
- Register the database if not registered to avoid the mounting hassles.
3. Database files have encountered a failure:
This error occurs when you repeatedly fail to mount the database or when it becomes corrupt.
Resolution:
- Repair the database using Eseutil commands, as in the case of MapiExceptionDatabaseError
- Can check even logs to get a particular message that cites the reason behind the failed state of the database
4. Incorrect Permission
This error surfaces during database mounting because of wrong permissions.
Resolution: Assign database management roles to the users. For example, use the following command to assign the user a specific membership of the Organization Management group
Add-RoleGroupMember -Identity “Organization Management” -Member “username”
5. Data Availability Group (DAG) Replication issues:
The replication issues in the DAG disallow the users from mounting the database.
Resolution: You can scan the DAG health through the command: Get-MailboxDatabaseCopyStatus
How can Exchange server recovery software fix database mounting issues?
An Exchange database may exhibit mounting errors due to several errors. These may include corrupted or damaged database files, a dirty shutdown state, insufficient storage space, or transaction log issues. To mount the database and fix the issues in such circumstances, you can use Exchange server recovery software. Here are some of the common features in these Exchange recovery tools to benefit your cause
- Set you free from the database mounting issues by repairing the corruption
- Extract data from a severely damaged database without mounting it
- Repair and recover mailboxes from damaged EDB files
- Restore the mailboxes and export them directly to Live Exchange Server
- Perform auto-mapping of mailboxes at the source and destination
Among the multiple options available online to avoid mount dismount exchange database issues, Stellar Repair for Exchange can be a suitable option.
Conclusion
You may need to mount or dismount the Exchange Server database for various reasons. For instance, you would have to defragment the database, move it to a different location, perform a database restore through a backup file, etc. In any such circumstances, both Exchange Administration Center (EAC) and Exchange Management Shell (EMS) can help your cause.
However, you must have the appropriate role assigned to your role group to execute these tasks. Once you have the role assigned, you may know the status of the Exchange database by using the Get-MailboxDatabase cmdlet. Depending on the state and your requirement, you may mount the database through the Mount-Database cmdlet or dismount the database through the Dismount-Database cmdlet in the EMS environment.
Ironically, both these tasks can cause several errors, such as MapiExceptionDatabaseError, DAG Replication issues, wrong assignment of permission roles, and so on. Prompt resolution of these errors is crucial. A better idea to avoid these issues arising when using mount dismount exchange database PowerShell cmdlets would be to rely on Exchange server recovery software.
These tools can recover data from a corrupted database easily and export it to Live Exchange Server or another safe location. Of the many applications available for this purpose, using Stellar Repair for Exchange would be a feasible choice.