SQL Server HADR Important Points - (Legacy)
SQL Server HADR Important Points - (Legacy)
Here are some important points on Database Log Shipping in SQL Server, covering the essential setup, operation,
and best practices for this high-availability feature:
1. Purpose of Log Shipping
Log shipping is used for disaster recovery by maintaining a standby copy of a primary (source) database on one or
more secondary (destination) servers.
It’s a simple, cost-effective high-availability solution that’s relatively easy to set up and manage.
Role Reversal: After a failover, you can reconfigure log shipping to make the former secondary the primary, and the
former primary can become a new secondary if needed.
1. Mirroring Modes
High Safety Mode (Synchronous): Ensures that each transaction is committed on both the principal and mirror
before it’s completed. This provides zero data loss, but it can increase latency.
High Performance Mode (Asynchronous): Transactions are committed on the principal immediately without waiting
for the mirror, resulting in minimal latency but with potential data loss if a failover occurs.
High Safety Mode with Automatic Failover: Requires a third server configured as a witness to enable automatic
failover in High Safety mode. The witness allows SQL Server to detect when the principal server fails and
automatically switches roles with the mirror.
Set up alerts for events such as synchronization state changes and failures to ensure quick response times.
7. Impact on Performance
Mirroring, especially in synchronous mode, can impact performance due to the overhead of ensuring data
consistency between the principal and mirror.
Synchronous mirroring is suited for databases with lower transaction rates or for databases that can tolerate slight
delays.
Database mirroring remains a powerful feature for high availability, though it is increasingly being replaced by
Availability Groups in newer SQL Server implementations.
2. Replication Types
Transactional Replication: Ensures near real-time data synchronization with low latency, ideal for scenarios where
data changes frequently and consistency is critical.
Merge Replication: Allows bidirectional data exchange between databases, used where multiple nodes are allowed
to update data independently and then synchronize.
Snapshot Replication: Takes a full copy of the database at a point in time and sends it to the subscriber. This is useful
for infrequently changing data or when latency isn’t a priority.
3. Replication Components
Publisher: The primary server that owns the data, where changes originate.
Subscriber: The server that receives replicated data from the publisher.
Distributor: Manages the replication process, including storing metadata, tracking changes, and managing replication
agents.
Replication Agents: Includes the Snapshot Agent, Log Reader Agent, Distribution Agent, and Merge Agent, which
perform various tasks like generating snapshots, distributing changes, and merging updates.
4. Replication Models
One-Way (Unidirectional): Data flows from the publisher to one or more subscribers.
Peer-to-Peer: A transactional replication variant where all nodes can update data independently, with changes being
synchronized across nodes. Useful for load balancing and high availability.
Bi-Directional: Allows data changes on both publisher and subscriber but with limitations to avoid conflicts.
6. Conflict Resolution
Merge replication includes conflict resolution mechanisms since changes can be made on multiple nodes. SQL Server
automatically handles conflicts based on predefined rules.
Transactional replication does not require conflict resolution because only the publisher is allowed to modify data.
7. Security and Permissions
SQL Server replication requires proper permissions for agents to read and write data at the publisher, distributor,
and subscriber.
Configure Replication Security Settings carefully to avoid unauthorized access and ensure data integrity.
9. Replication Topologies
Central Publisher with Multiple Subscribers: Common for distributing data from a central server to multiple
locations.
Central Subscriber with Multiple Publishers: Used to consolidate data from multiple publishers to a central location.
Peer-to-Peer: All nodes act as both publisher and subscriber, suitable for high-availability setups.
Replication is not intended for automatic failover or high availability; instead, it is best suited for data distribution
and load balancing.
Certain objects, such as system tables and some types of triggers, cannot be replicated directly.
Replication in SQL Server provides a powerful way to distribute and synchronize data, but it requires careful
planning, configuration, and monitoring to ensure smooth operation and data integrity.
Important points on SQL Server Failover Cluster:
Here are essential points for understanding and configuring SQL Server Failover Cluster Instances (FCI), a high-
availability solution for SQL Server:
1. Overview of Failover Clustering
SQL Server Failover Clustering provides high availability at the instance level by allowing SQL Server instances to
automatically failover to another server (node) in the event of a failure.
FCI requires a Windows Server Failover Cluster (WSFC), with two or more nodes configured to operate as a single
system.
4. Quorum Configuration
The quorum is essential for cluster availability, ensuring that more than half of the nodes (or node plus witness) are
online for the cluster to operate.
Quorum types include Node Majority, Node and Disk Majority, Node and File Share Majority, and Disk Only. Proper
quorum configuration prevents “split-brain” scenarios.
SQL Server AlwaysOn Availability Groups are a powerful solution for high availability and disaster recovery, providing
granular control and flexibility for managing critical databases across nodes and locations.