Configuring High Availability

This section introduces several Microsoft SQL Server 2005 high-availability solutions that improve the availability of servers or databases. A high-availability solution masks the effects of a hardware or software failure and maintains the availability of applications so that the perceived downtime for users is minimized.

SQL Server 2005 provides several options for creating high availability for a server or database. High-availability options include the following:

  • Failover clustering
    Failover clustering provides high-availability support for an entire instance of SQL Server. A failover cluster is a combination of one or more nodes, or servers, with two or more shared disks. Applications such as SQL Server and Notification Services are each installed into a Microsoft Cluster Service (MSCS) cluster group, known as a resource group. At any time, each resource group is owned by only one node in the cluster. The application service has a virtual name that is independent of the node names, and is referred to as the failover cluster instance name. An application can connect to the failover cluster instance by referencing the failover cluster instance name. The application does not have to know which node hosts the failover cluster instance.
    A SQL Server failover cluster instance appears on the network as a single computer, but has functionality that provides failover from one node to another if the current node becomes unavailable. For example, during a non-disk hardware failure, operating system failure, or planned operating system upgrade, you can configure an instance of SQL Server on one node of a failover cluster to fail over to any other node in the disk group.
    A failover cluster does not protect against disk failure. You can use failover clustering to reduce system downtime and provide higher application availability. Failover clustering is supported in SQL Server 2005 Enterprise Edition, Developer Edition and, with some restrictions, Standard Edition. For more information about failover clustering, see Failover Clustering and Installing a Failover Cluster.

  • Database mirroring
    Database mirroring is primarily a software solution to increase database availability by supporting almost instantaneous failover. Database mirroring can be used to maintain a single standby database, or mirror database, for a corresponding production database that is referred to as the principal database.
    The mirror database is created by restoring a database backup of the principal database with no recovery. This makes the mirror database is inaccessible to clients. However, it is possible to use it indirectly for reporting purposes by creating a database snapshot on the mirror database. The database snapshot provides clients with read-only access to the data in the database as it existed when the snapshot was created.
    Each database mirroring configuration involves a principal server that contains the principal database, and a mirror server that contains the mirror database. The mirror server continuously brings the mirror database up to date with the principal database.
    Database mirroring runs with either synchronous operation in high-safety mode, or asynchronous operation in high-performance mode. In high-performance mode, the transactions commit without waiting for the mirror server to write the log to disk, which maximizes performance. In high-safety mode, a committed transaction is committed on both partners, but at the risk of increased transaction latency.
    In its simplest configuration, database mirroring involves only the principal and mirror servers. In this configuration, if the principal server is lost, the mirror server can be used as a warm standby server, with possible data loss. High-safety mode supports an alternative configuration, high-safety mode with automatic failover. This configuration involves a third server instance, known as a witness, which enables the mirror server to act as a hot standby server. Failover from the principal database to the mirror database typically takes a few seconds.
    Database mirroring partners and witnesses are supported by SQL Server 2005 Standard Edition SP1 and later versions, and by SQL Server 2005 Enterprise Edition SP1 and later versions. But the partners must use the same edition, and asynchronous database mirroring (high-performance mode) is supported only by SQL Server 2005 Enterprise Edition SP1 and later versions. Witnesses are also supported by SQL Server 2005 Workgroup Edition SP1 and later versions and by SQL Server 2005 Express Edition SP1 and later versions. For more information about database mirroring, see Database Mirroring.

  • Log shipping
    Like database mirroring, log shipping operates at the database level. Log shipping can be used to maintain one or more warm standby databases, referred to as secondary databases, for a corresponding production database that is referred to as the primary database. Each secondary database is created by restoring a database backup of the primary database with no recovery, or with standby. Restoring with standby permits the resulting secondary database to be used for limited reporting purposes.
    A log shipping configuration includes a single primary server that contains the primary database, one or more secondary servers that each have a secondary database, and a monitor server. Each secondary server updates its secondary database at regular intervals from log backups of the primary database. Log shipping involves a user-modifiable delay between when the primary server creates a log backup of the primary database and when the secondary server restores the log backup. Before a failover can occur, a secondary database must be brought fully up-to-date by manually applying any unrestored log backups.
    Log shipping provides the flexibility of supporting multiple standby databases. If you require multiple standby databases, you can use log shipping alone or as a supplement to database mirroring. When these solutions are used together, the current principal database of the database mirroring configuration is also the current primary database of the log shipping configuration.
    Log shipping is supported in SQL Server 2005 Enterprise Edition, Standard Edition, and Workgroup Edition. For more information about log shipping, see Log Shipping.

  • Replication
    Replication uses a publish-subscribe model, allowing a primary server, referred to as the Publisher, to distribute data to one or more secondary servers, or Subscribers. Replication allows real-time availability and scalability across these servers. It supports filtering to provide a subset of data at Subscribers, and also allows partitioned updates. Subscribers are online and available for reporting or other functions, without query recovery. SQL Server offers three types of replication: snapshot, transactional, and merge. Transactional replication provides the lowest latency and is most commonly used for high availability. For more information, see Improving Scalability and Availability.
    Replication is supported in all editions of SQL Server 2005. Replication publishing is not available with SQL Server 2005 Express Edition or SQL Server Compact Edition. For a complete list of replication features that are supported by each edition, see Features Supported by the Editions of SQL Server 2005.

    Important

    A well designed and implemented backup and restore strategy is essential to any high-availability solution. For more information, see Backing Up and Restoring Databases in SQL Server, and Backing Up and Restoring Replicated Databases.

Selecting a High-Availability Solution

The following list presents considerations for selecting a high-availability solution:

  • Failover clustering and database mirroring both provide the following:

    • Automatic detection and failover

    • Manual failover

    • Transparent client redirect
      Failover clustering has the following constraints:

    • Operates at the server instance scope

    • Requires signed hardware

    • Has no reporting on standby

    • Utilizes a single copy of the database

    • Does not protect against disk failure
      Database mirroring offers the following benefits:

    • Operates at the database scope.

    • Uses a single, duplicate copy of the database

      Note

      If you require additional copies, you can use log shipping on the database in addition to database mirroring.

    • Uses standard servers

    • Provides limited reporting on the mirror server by using database snapshots.

    • When operating synchronously, provides for zero work loss through delayed commit on the principal database.
      Database mirroring offers a substantive increase in availability over the level previously possible with SQL Server and offers an easy-to-manage alternative to failover clustering.

    Note

    For information about how to use database mirroring with a failover cluster, see Database Mirroring and Failover Clustering. For information about how to use Notification Services with failover clustering, see Using Failover Clustering with Notification Services. For information about how to use Notification Services with database mirroring, see Using Log Shipping or Database Mirroring with Notification Services.

  • Log shipping
    Log shipping can be a supplement or an alternative to database mirroring. Although similar in concept, asynchronous database mirroring and log shipping have key differences. Log shipping offers the following distinct capabilities:

    • Supports multiple secondary databases on multiple server instances for a single primary database.

    • Allows a user-specified delay between when the primary server backs up the log of the primary database and when the secondary servers must restore the log backup. A longer delay can be useful, for example, if data is accidentally changed on the primary database. If the accidental change is noticed quickly, a delay can let you retrieve still unchanged data from a secondary database before the change is reflected there.
      Compared to the shortest time that is required by log shipping to reflect a change to a secondary database, asynchronous database mirroring has the potential advantage of a shorter time between when a given change is made in the primary database and when that change is reflected to the mirror database.
      An advantage of database mirroring over log shipping is that high-safety mode is a no data loss configuration that is supported as a simple failover strategy.

      Note

      For information about how to use log shipping with database mirroring, see Database Mirroring and Log Shipping. For information about how to use log shipping with Notification Services, see Using Log Shipping or Database Mirroring with Notification Services.

  • Replication
    Replication offers the following benefits:

    • Allows filtering within the database to provide a subset of data at the secondary databases because it operates at the database scope
    • Allows more than one redundant copy of the database
    • Allows real-time availability and scalability across multiple databases, supporting partitioned updates
    • Allows complete availability of the secondary databases for reporting or other functions, without query recovery.

    Note

    For information about how to use database mirroring with replication, see Replication and Database Mirroring.

In This Section

Topic Description

Failover Clustering

Contains information about sharing a combination of one or more nodes (servers) with two or more hard disks.

Database Mirroring

Contains information about how database mirroring works and how to configure and manage a database mirroring session.

Log Shipping

Contains information about how log shipping works and how to configure and manage a log shipping configuration.

See Also

Other Resources

Hardware and Software Requirements for Installing SQL Server 2005
Features Supported by the Editions of SQL Server 2005
SQL Server Replication

Help and Information

Getting SQL Server 2005 Assistance