Preferred database server

In a database mirroring system, you can identify one of the two partner servers as the preferred server. If all the database servers are running, then the preferred server becomes the primary server and takes ownership of the database. If the server that is marked as preferred becomes unavailable, then the server that was acting as the mirror server becomes the primary server. When the preferred server restarts, it obtains any transaction log entries it does not already have from the current primary server. It then asks the current primary server to relinquish ownership of the database. The servers then change roles, with the preferred server becoming the primary server and the other server becoming the mirror server. Any connections to the database on the non-preferred server are lost when the database ownership changes.

You specify a preferred server by adding PREFERRED='YES' to the CREATE MIRROR SERVER statement that defines the partner server. For example:

CREATE MIRROR SERVER mirror_server1
AS PARTNER
connection_string='SERVER=mirror_server1;host=localhost:6871'
state_file='c:\\server1\\server1.state'
preferred='YES';
 See also