How to Use Add-MailboxDatabaseCopy Command in Exchange Server?

                  How to Use Add-MailboxDatabaseCopy Command in Exchange Server?

Summary: The PowerShell command Add-MailboxDatabaseCopy in Exchange Server is used to create a passive copy of the active database on another server. In this post, we will discuss how to use the Add-MailboxDatabaseCopy command. We will also mention an Exchange recovery application that can help in recovery of Exchange database if an unforeseen issue arises.

In a Database Availability Group (DAG) setup in Exchange Server, you need to have an active copy of the database on a server and a passive copy on another server or servers. This copy will be seeded from the active database and will be in a constant sync with the active database, until the automatic/manual

failover. When this happens, the passive copy becomes the active database.

To add or create a passive copy of the active database, Exchange Server PowerShell has a command – Add-MailboxDatabaseCopy. Below, we will see how to use this command to create passive copies of the database.

How to Use Add-MailboxDatabaseCopy Command?

Before running this command, you need to ensure that the required roles/permissions are assigned to the user (you’re using to run the command). You can use the following command in the Exchange Management Shell (EMS) to get the roles needed to run the Add-MailboxDatabaseCopy command.

Once the permissions have been assigned to the user to create the copy, you can go ahead to use the command. However, before proceeding, there are some things that you need know.
  • The destination server must be in the same Database Availability Group (DAG).
  • You can have more than one group in your setup but the group must be healthy and have quorum.
  • You cannot create two copies of the same database on the same servers. There can only be one copy of the database on one server. You can have multiple copies of the same database on multiple servers.
  • The patch for the passive copy must be same as the active database with the log and database paths.
  • Since synchronization relies heavily on the transaction logs, it’s important that circular logging is not enabled on the database being added to the Database Availability Group (DAG). To verify this, you can run the following PowerShell command:
  • Using the Command

 The command must be executed from the source server. Below is the example of the command.

The above command will create a passive copy of DB1 on the server SRV02. The parameters mentioned are ReplayLagTime, TruncationLagTime, and ActivationPreference.

ReplayLagTime is the amount of time that the Microsoft Exchange Replication service will wait before replaying the log files that have been copied to the database. The default value is 0, which means that once the transaction logs are transferred, these are committed. The maximum value is 14 days and it’s set as dd.hh:mm:ss (dd = days, hh = hours, mm = minutes, and ss = seconds). This is usually used for a third copy, which would replay the logs after a set number of days so that if something happens, then you have time to retrieve.

TruncationLogTime is the amount of time that the Microsoft Exchange Replication service will have to wait until the truncation of the log file is started on the passive copy. Same as the ReplayLagTime, this has the default value of 0 and the maximum value is 14 days.

In case your server is geographically located and the bandwidth is not enough to seed the entire database over internet or site-to-site VPN, you can use the Seeding Postponed command (see the below example). It will not seed the database and you can manually take a copy of the database on site.


To Conclude

You create the passive copies of the database for resilience and protecting your data. You also use this so that you can failover to another server while doing maintenance work, such as Windows/Exchange Server Updates and hardware changes, fixes, or upgrades. However, you need to monitor and maintain the setup. If the replication fails and there is a failover, then there is a high risk of data loss.


In case you encounter any issues with your Exchange Server and database, you can take the help of applications, like Raminfotech Repair for Exchange. It can recover Exchange database, from any version and of any size. You can granularly export the user mailboxes, user archives, disabled mailboxes, shared mailboxes, and public folders to PST and other file formats. You can use the application to directly export to a live Exchange Server database or Exchange Online with features, such as automatic mailbox matching, parallel exports, and priority exports.

 

 

Post a Comment

0 Comments