Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 2.48 KB

force-service-in-a-database-mirroring-session-transact-sql.md

File metadata and controls

43 lines (30 loc) · 2.48 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic helpviewer_keywords
Force database mirroring service
If the principal server fails while the mirror server is available, make the database available by forcing the service to fail over to the mirrored database.
MikeRayMSFT
mikeray
03/04/2017
sql
database-mirroring
how-to
forced service [SQL Server]
database mirroring [SQL Server], forcing service

Force Service in a Database Mirroring Session (Transact-SQL)

[!INCLUDE SQL Server] In high-performance mode and high-safety mode without automatic failover, if the principal server fails while the mirror server is available, the database owner can make the database available by forcing service to fail over (with possible data loss) to the mirror database. This option is available only under all the following conditions:

  • The principal server is down.

  • WITNESS is set to OFF or is connected to the mirror server.

Caution

Forced service is strictly a disaster recovery method. Forcing service may involve some data loss. Therefore, force service only if you are willing to risk losing some data in order to restore service to the database immediately. If forcing service risks losing significant data, we recommend that you stop mirroring and manually resynchronize the databases. For more information about the risks of forcing service, see Database Mirroring Operating Modes.

Forcing service suspends the session and starts a new recovery fork. The effect of forcing service is similar to removing mirroring and recovering the former principal database. However, forcing service facilitates resynchronizing the databases (with possible data loss) when mirroring resumes.

To force service in a database mirroring session

  1. Connect to the mirror server.

  2. Issue the following statement:

    ALTER DATABASE <database_name> SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS

    where <database_name> is the mirrored database.

    The mirror server immediately transitions to principal server, and mirroring is suspended.

See Also

ALTER DATABASE (Transact-SQL)
Database Mirroring Operating Modes