Sobes.tech
Middle

Tell us about the Always On High Availability technology in MS SQL Server.

sobes.tech AI

Answer from AI

Always On High Availability in MS SQL Server is a set of technologies to ensure high availability and fault tolerance of databases. Main components:

  • Availability Groups (AG) — allow grouping databases for replication and automatic failover to a standby server in case of failure.
  • Failover Cluster Instances (FCI) — provide fault tolerance at the SQL Server instance level through Windows clustering.

Always On AG supports synchronous and asynchronous replication, allows multiple secondary replicas for read and backup purposes. In case of primary replica failure, automatic or manual failover occurs to a secondary, minimizing downtime.

Example of creating an Availability Group (simplified):

-- Creating an Availability Group
CREATE AVAILABILITY GROUP [AG1]
WITH (AUTOMATED_BACKUP_PREFERENCE = PRIMARY)
FOR DATABASE [MyDatabase]
REPLICA ON
  N'SQLNode1' WITH (
    ENDPOINT_URL = 'TCP://SQLNode1:5022',
    AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,
    FAILOVER_MODE = AUTOMATIC
  ),
  N'SQLNode2' WITH (
    ENDPOINT_URL = 'TCP://SQLNode2:5022',
    AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,
    FAILOVER_MODE = AUTOMATIC
  );

Thus, Always On ensures continuous application operation and data protection from hardware or software failures.