SQL Server High Availability Options

Finding the right high availability option can be tricky.  The decision really depends on these items:

  • Needs
  • Budget
  • Scope
  • SQL Server version
  • Level of automation
  • Team level support
  • etc.

At a high level, there are five main high availability options including a new feature set to be release with SQL Server 2012:

  • Replication
  • Mirroring
  • Log Shipping
  • Clustering
  • AlwaysON

SQL Server Replication Overview

At a high level, replication involves a publisher and subscriber, where the publisher is the primary server and the subscriber is the target server. Replication’s main purpose is to copy and distribute data from one database to another. There are four types of replication that we will outline:

  • Snapshot replication
  • Transactional replication
  • Merge replication
  • Peer to Peer replication

Snapshot: Snapshot replication occurs when a snapshot is taken of the entire database and that snapshot is copied over to the subscriber. This is best used for data that has minimal changes and is used as an initial data set in some circumstances to start subsequent replication processes.

Transactional: Transactional replication begins with a snapshot of the primary database that is applied to the subscriber. Once the snapshot is in place all transactions that occur on the publisher will be propagated to the subscriber. This option provides the lowest latency.

Merge: Merge replication begins with a snapshot of the primary database that is applied to the subscriber. Changes made at the publisher and subscriber are tracked while offline. Once the publisher and subscriber are back online simultaneously, the subscriber synchronizes with the publisher and vice versa. This option could be best for employees with laptops that leave the office and need to sync their data when they are back in the office.

Peer to Peer: Peer to Peer replication can help scale out an application.  This is because as transactions occur they are executed on all of the nodes involved in replication in order to keep the data in sync in near real time.

Pros and Cons for SQL Server Replication
Pros
Cons
Can replicate to multiple servers
Manual failover
Can access all databases being replicated
Snapshot can be time consuming if you have a VLDB
Replication can occur in both directions
Data can get out of sync and will need to re-sync

 


SQL Server Database Mirroring Overview

Database Mirroring involves a principal server that includes the principal database and a mirror server that includes the mirrored database. The mirror database is restored from the principal with no recovery leaving the database inaccessible to the end users. Once mirroring is enabled, all new transactions from the principal will be copied to the mirror. The use of a witness server is also an option when using the high safety with automatic failover option. The witness server will enable the mirror server to act as a hot standby server. Failover with this option usually only takes seconds to complete. If the principal server was to go down the mirror server would automatically become the principal.

Click here to view the rest of this post.

SQL Server Log Shipping

Backup Database on Primary Server:

SQL Freelancer SQL Server Log ShippingRestore Database on Secondary Server: (RESTORE WITH STANDBY)

SQL Freelancer SQL Server Log Shipping(Picture of Object Explorer once restore is complete)

SQL Freelancer SQL Server Log ShippingCreate a shared folder on the primary server (SQL Server Agent service account must have read/write permissions):

SQL Freelancer SQL Server Log ShippingCreate a shared folder on the secondary server (SQL Server Agent service account must have read/write permissions):

SQL Freelancer SQL Server Log ShippingEnable Log Shipping at the Publisher:

SQL Freelancer SQL Server Log ShippingClick “Enable this as a primary database in a log shipping configuration”, then click Backup Settings:

SQL Freelancer SQL Server Log Shipping

  1. Enter Network Share on Primary Server
  2. Enter Local Folder path on Primary Server
  3. Enter the number of Minutes, Hours, or Days to keep the deleted files and to Alert if no backup occurs
  4. Name the SQL Agent Job and determine a schedule to backup the log files

SQL Freelancer SQL Server Log Shipping

Click OK

Click Add to add a secondary server:

SQL Freelancer SQL Server Log ShippingClick Connect to connect to the secondary server:

SQL Freelancer SQL Server Log Shipping

Select No, since we initialized the database in the beginning by restoring in Standby Mode, otherwise you can choose one of the other options. Hit OK.

Go to next tab, Copy Files.

  1. Enter Local Folder Path on Secondary server
  2. Enter the number of Minutes, Hours, or Days to delete copied files
  3. Name the SQL Agent Job and determine a schedule to copy the log files

SQL Freelancer SQL Server Log ShippingGo to next tab, Restore Transaction Log.

    1. Since we put the database in Standby/Read Only mode select Standby Mode
    2. If you would like to delay restoring the transaction log you can enter a value in the “Delay restoring backups at least” otherwise leave at 0 minutes.
      Enter the number of Minutes, Hours, or Days to Alert if no restore occurs
    3. Name the SQL Agent Job and determine a schedule to restore the log files

SQL Freelancer SQL Server Log Shipping

Hit OK

**OPTIONAL** To create a monitor server click “Use monitor server instance” and then click Settings

SQL Freelancer SQL Server Log Shipping

    1. Click Connect to connect to a monitor server instance
    2. Select the login method you would like to use to connect to the monitor server.
    3. Enter the number of Minutes, Hours, or Days to delete log file data
    4. Name the SQL Agent Job and determine a schedule to for the alert task

SQL Freelancer SQL Server Log ShippingHit OK twice.

SQL Freelancer SQL Server Log Shipping