Home / Data Platform / Warehouses

Data PlatformHow-toAdvanced

Snowflake disaster recovery: replication, failover groups and client redirect

Replicate Snowflake databases and account objects to another region or cloud with failover groups, refresh them on a schedule, redirect clients with connection URLs, and run a failover drill.

Deepak Bhardwaj2 min read

Applies toSnowflake Business Critical edition or higher (failover); Standard and Enterprise (database replication only)

Building blocks

Object Purpose
Replication group Read-only copies in a target account (any edition)
Failover group Replication plus the ability to promote the target (Business Critical+)
Connection object An org-level URL that clients use; points to the primary and can be redirected (client redirect)

A failover group can include databases, shares, users, roles, grants, warehouses, integrations and network policies.

1. Enable replication for both accounts

As ORGADMIN:

SELECT SYSTEM$GLOBAL_ACCOUNT_SET_PARAMETER('myorg.prod_aws_mumbai',
  'ENABLE_ACCOUNT_DATABASE_REPLICATION', 'true');
SELECT SYSTEM$GLOBAL_ACCOUNT_SET_PARAMETER('myorg.dr_aws_hyderabad',
  'ENABLE_ACCOUNT_DATABASE_REPLICATION', 'true');

2. Create the failover group (primary)

CREATE FAILOVER GROUP fg_prod
  OBJECT_TYPES = DATABASES, USERS, ROLES, WAREHOUSES, INTEGRATIONS, NETWORK POLICIES
  ALLOWED_DATABASES = sales, finance
  ALLOWED_INTEGRATION_TYPES = SECURITY INTEGRATIONS, API INTEGRATIONS
  ALLOWED_ACCOUNTS = myorg.dr_aws_hyderabad
  REPLICATION_SCHEDULE = '10 MINUTE';

3. Create the secondary (DR account)

CREATE FAILOVER GROUP fg_prod
  AS REPLICA OF myorg.prod_aws_mumbai.fg_prod;

ALTER FAILOVER GROUP fg_prod REFRESH;   -- initial copy

The RPO is roughly your refresh interval plus the refresh duration. Monitor it:

SELECT * FROM TABLE(INFORMATION_SCHEMA.REPLICATION_GROUP_REFRESH_HISTORY('fg_prod'));

4. Client redirect

CREATE CONNECTION prod_conn;                                   -- on the primary
ALTER CONNECTION prod_conn ENABLE FAILOVER TO ACCOUNTS myorg.dr_aws_hyderabad;
CREATE CONNECTION prod_conn AS REPLICA OF myorg.prod_aws_mumbai.prod_conn;  -- on DR

Clients use myorg-prod_conn.snowflakecomputing.com. Make sure BI tools, dbt and drivers use the connection URL, not the account URL.

5. Failover

On the DR account:

ALTER FAILOVER GROUP fg_prod PRIMARY;
ALTER CONNECTION prod_conn PRIMARY;

The secondary becomes read-write and clients follow the connection URL.

What isn't replicated, or needs care

  • Some object types and features have limits (check the replication docs for external tables, stages with storage integrations, and pipes). Stages need the same cloud storage to be reachable from the DR region.
  • Snowpipe and tasks: tasks replicate in a suspended state on the secondary; resume what you need after failover.
  • Replication is charged for data transfer and compute; review the cost for large databases.

Tip

Drill twice a year: fail over, run a sample of dashboards and dbt jobs on the DR account, then fail back. The first drill always finds a hard-coded account URL somewhere.