Monday, December 1, 2025

Active GEO Replication in Azure

What is Geo Replication in Azure ?

Geo replication in Azure specifically Active Geo Replication  is a feature that allows you to create a continously synchronized readable secondary database for your primary database.This secondary db can  be in same region or in different region.

Its primary purpose is to provide Business continuity and enable quick disaster recovery for individual databases in case of a regional disaster or large scale outage . It works by asynchronously replicating transaction logs from primary to all seondary db's.

Upto 4 secondary replicas can be created. 

To add the replicas - Azure portal-Primary database-Data management-Replica- Create replica- select seondary server name , By default configuration,dbname will be auto populated .

Also this can be done by Tsql, Powershell-single db,Powershell-Elastic pool,REST API-Single db.

By Tsql

On Master db on primary server

ALTER DATABASE [YourDatabaseName] ADD SECONDARY ON SERVER [SecondaryServerName] WITH (ALLOW_CONNECTIONS = ON)


To failover

AZURE PORTAL-Replicas-click 3 dots and do forced failover , the server on which failover is initiated becomes primary and original primary will be secondary.

Stop replication

Azure Portal-Replicas-click 3 dots and stop replication, this will remove the server from replicas but the server will be available as a resource .

DMV's to check 

Sys.Geo_replication_links--> Returns all replicas on the server

sys.dm_geo_replication_link_status--

Sys.dm_operation_status

sys.sp_wait_for_database_copy_sync