As we know that DAG is used to provide high availability to mailbox servers in exchange 2013. DAG stands for Database availability group. In Exchange server 2013 we can have 16 mailbox servers as members in DAG. DAG member servers host passive copies of exchange database from other DAG members. In case of a server or database failure the passive copies of the database becomes active automatically resulting in high availability of exchange database.
Every exchange server has a component called active manager that runs inside Microsoft exchange replication service on all mailbox servers. On exchange servers that are not part of DAG there runs only one active manager role which is called SAM- Standalone Active Manager. On exchange servers that are part of DAG there would be 2 active manager roles .i.e SAM (Standalone Active Manager) and PAM (Primary Active Manager). PAM is the active manager role in a DAG that will decide which database copies will be active and passive. PAM is responsible for reacting to server failure. The DAG member that holds the PAM role owns the cluster.If the server that owns the cluster fails for some reason then the PAM role automatically moves to a surviving server which takes the ownership of cluster.
In Exchange Server 2013 Microsoft Exchange Replication Service monitors the health of databases hosted on the mailbox server. When this service notices any server failure it notifies the Active Manager. Active Manager then decides which database need to mounted and notifies the Client Access Server which connects the clients like Outlook to the mailbox Server.
Active Manager takes several steps to determine the best possible server and database in case of server failure. In Exchange Server 2010 this process is called BCS (Best Copy Selection) where as in Exchange Server 2013 the process is called BCSS (Best Copy and Server Selection) . This is basically an algorithm which determines the best server and copy to mount in case of a server failure.