O'Reilly logo

Microsoft SQL Server 2012 Bible by Aaron Nelson, Jose Chinchilla, Patrick LeBlanc, Jorge Segarra, Adam Jorgensen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Role Switching

Role switching in database mirroring is a process to change the principal and mirror roles. Three types of role switching exist based on the database mirroring operating mode: automatic failover, manual failover, and forced failover.

Automatic failover is available only in synchronous mode with failover. In this mode, if the principal database becomes unavailable due to any failure and the mirror and witness servers are still connected and the mirroring state is SYNCHRONIZED, automatic failover occurs. Here is a high-level sequence of events that occur in an automatic failover scenario:

1. The principal database becomes unavailable due to some failure.
2. If the principal server is still available, the state of the principal database is changed to DISCONNECTED and all the clients are disconnected from the principal database.
3. The mirror and the witness server detect the failure.
Note
The default timeout for communication between the principal, mirror, and witness servers is 10 seconds. If the principal does not respond within the timeout period, it is considered to be down. If you use high-safety mode, you can change the timeout period using the ALTER DATABASE SET PARTNER TIMEOUT command. The default timeout of 10 seconds works well for most environments. If you do want to change the timeout period, do not set it below 10 seconds because this may cause false failures.
4. The mirror server recovers the mirror database.
5. The mirror server forms a quorum ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required