Bagikan melalui


Minimize Downtime for Mirrored Databases When Upgrading Server Instances

When upgrading server instances from SQL Server 2005 or SQL Server 2008 to SQL Server 2012, you can reduce downtime for each mirrored database to only a single manual failover by performing a sequential upgrade, known as a rolling upgrade. A rolling upgrade is a multi-stage process that in its simplest form involves upgrading the server instance that is currently acting as the mirror server in a mirroring session, then manually failing over the mirrored database, upgrading the former principal server, and resuming mirroring. In practice, the exact process will depend on the operating mode and the number and layout of mirroring session running on the server instances that you are upgrading.

Note

For information about performing a rolling upgrade to install a service pack or hotfix, see Install a Service Pack on a System with Minimal Downtime for Mirrored Databases.

Recommended Preparation (Best Practices)

Before starting a rolling upgrade, we recommend that you:

  1. Perform a practice manual failover on at least one of your mirroring sessions:

    Note

    For information about how manual failover works, see Role Switching During a Database Mirroring Session (SQL Server).

  2. Protect your data:

    1. Perform a full database backup on every principal database:

      Create a Full Database Backup (SQL Server).

    2. Run the DBCC CHECKDB command on every principal database.

Stages of a Rolling Upgrade

The specific steps of a rolling upgrade depend on the operating mode of the mirroring configuration. However, the basic stages are the same.

Note

For information about the operating modes, see Database Mirroring Operating Modes.

The following illustration is a flowchart that shows the basic stages of a rolling upgrade for each operating mode. The corresponding procedures are described after the illustration.

Flowchart showing steps of a rolling upgrade

Important

A server instance might be performing different mirroring roles (principal server, mirror server, or witness) in concurrent mirroring sessions. In this case, you will have to adapt the basic rolling upgrade process accordingly. For more information, see Role Switching During a Database Mirroring Session (SQL Server).

To change a session from high-performance mode to high-safety mode

To remove a witness from a session

To perform the rolling upgrade

  1. To minimize downtime, we recommend the following: Start the rolling upgrade by updating any mirroring partner that is currently the mirror server in all its mirroring sessions. You might have to update multiple server instances at this point.

    Note

    A witness can be upgraded at any point in the rolling upgrade process. For example, if a server instance is a mirror server in Session 1 and is a witness in Session 2, you can upgrade the server instance now.

    The server instance to upgrade first depends on the current configuration of your mirroring sessions, as follows:

    • If any server instance is already the mirror server in all its mirroring sessions, upgrade the server instance to the new version.

    • If all your server instances are currently the principal server in any mirroring sessions, select one server instance to upgrade first. Then, manually fail over each of its principal databases and upgrade that server instance.

    After being upgraded, a server instance automatically rejoins each of its mirroring sessions.

  2. For each mirroring session whose mirror server instance has just been upgraded, wait for the session to synchronize. Then, connect to the principal server instance, and manually fail over the session. On failover, the upgraded server instance becomes the principal server for that session, and the former principal server becomes the mirror server.

    The goal of this step is for another server instance to become the mirror server in every mirroring session in which it is a partner.

    Restrictions after you failover to an upgraded server instance.

    After failing over from a SQL Server 2005 or SQL Server 2008 server instance to a SQL Server 2012 server instance, the database session is suspended. It cannot be resumed until the other partner has been upgraded. However, the principal server is still accepting connections and allowing data access and modifications on the principal database.

    Note

    Establishing a new mirroring session requires that the server instances all be running the same version of SQL Server.

  3. After you fail over, we recommend that you run the DBCC CHECKDB command on the principal database.

  4. Upgrade each server instance that is now the mirror server in all mirroring sessions in which it is a partner. You might have to update multiple servers at this point.

    Important

    In a complex mirroring configuration, some server instance might still be the original principal server in one or more mirroring sessions. Repeat steps 2–4 for those server instances until all instances involved are upgraded.

  5. Resume the mirroring session.

    Note

    Automatic failover will not work until the witness has been upgraded and added back into the mirroring session.

  6. Upgrade any remaining server instance that is the witness in all its mirroring sessions. After an upgraded witness rejoins a mirroring session, automatic failover becomes possible again. You might have to update multiple servers at this point.

To return a session to high-performance mode

  • Optionally, return to high-performance mode by using one of the following methods:

    • In SQL Server Management Studio: Change the Operating mode option to High performance (asynchronous) by using the Mirroring Page of the Database Properties dialog box.

    • In Transact-SQL: Use ALTER DATABASE to set transaction safety to OFF.

To add a witness back into a mirroring session

See Also

Tasks

View the State of a Mirrored Database (SQL Server Management Studio)

Install a Service Pack on a System with Minimal Downtime for Mirrored Databases

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

Start Database Mirroring Monitor (SQL Server Management Studio)

Reference

ALTER DATABASE Database Mirroring (Transact-SQL)

BACKUP (Transact-SQL)

Concepts

Database Mirroring (SQL Server)

Role Switching During a Database Mirroring Session (SQL Server)

Database Mirroring Operating Modes