Snowflake

Snowflake Database Replication: DR Design Guide

2026-03-26
更新: 2026-03-27
NicheeLab Editorial Team

Database Replication is a Snowflake feature that replicates databases to accounts in different regions or cloud providers. Combined with Failover Group, it lets you build a robust architecture for disaster recovery (DR) and business continuity (BCP). Available on Business Critical Edition or higher.

Primary / Secondary Architecture

Snowflake replication operates on a Primary-Secondary model. The Primary database (or Failover Group) is the writable source of truth, and the Secondary is a read-only replica. The Secondary periodically receives incremental snapshots from the Primary to stay in sync.

┌──────────────────────────────┐     Replication          ┌──────────────────────────────┐
│  Source Account (US-EAST-1)  │ ──────────────────────→ │  Target Account (EU-WEST-1)  │
│                              │   Incremental snapshot   │                              │
│  [Primary]                   │                         │  [Secondary / Read-only]       │
│   ├─ DB: analytics           │                         │   ├─ DB: analytics (replica)   │
│   ├─ DB: raw_data            │                         │   ├─ DB: raw_data (replica)    │
│   ├─ Roles / Users           │                         │   ├─ Roles / Users (replica)   │
│   └─ Network Policies        │                         │   └─ Network Policies (replica)│
└──────────────────────────────┘                         └──────────────────────────────┘
        ↑ Normal ops run on Primary                           ↑ Promote to Primary on DR event

Replication Types

TypeScopeFailoverEdition Requirement
Database ReplicationIndividual databasesNot supported (manual switch)Standard or higher
Replication GroupMultiple DBs + sharesNot supportedBusiness Critical or higher
Failover GroupMultiple DBs + roles + warehouses + network policies, etc.Supported (automatic/manual)Business Critical or higher

Creating a Failover Group

-- Create a Failover Group in the source account
CREATE FAILOVER GROUP prod_dr_group
  OBJECT_TYPES = DATABASES, ROLES, USERS, WAREHOUSES, NETWORK POLICIES, INTEGRATIONS
  ALLOWED_DATABASES = analytics, raw_data
  ALLOWED_INTEGRATION_TYPES = SECURITY INTEGRATIONS
  ALLOWED_ACCOUNTS = myorg.target_account
  REPLICATION_SCHEDULE = '10 MINUTE';

-- Create the Secondary Failover Group in the target account
CREATE FAILOVER GROUP prod_dr_group
  AS REPLICA OF myorg.source_account.prod_dr_group;

-- Manually trigger replication (for testing)
ALTER FAILOVER GROUP prod_dr_group REFRESH;

Failover Procedure

On a DR event, promote the Failover Group on the target account side to Primary. After promotion, the Failover Group on the original source account is demoted to Secondary.

-- Promote to Primary on the target account (DR activation)
ALTER FAILOVER GROUP prod_dr_group PRIMARY;

-- Failback: re-promote on the original source account
-- (Run this after data written on the target account has replicated back)
ALTER FAILOVER GROUP prod_dr_group PRIMARY;

RPO / RTO Design

MetricDefinitionHow to control in SnowflakeTypical value
RPO (Recovery Point Objective)Maximum acceptable data loss windowREPLICATION_SCHEDULE interval10 min - 1 hour
RTO (Recovery Time Objective)Maximum acceptable downtime until recoveryExecution time of ALTER FAILOVER GROUP ... PRIMARYMinutes to tens of minutes

RPO is determined by the REPLICATION_SCHEDULE interval. If you set it to 10 minutes, you may lose up to the last 10 minutes of data in the worst case. RTO depends on how long the failover command takes, which is driven by metadata volume (number of tables, views, etc.) rather than database size.

Client Redirect (Connection Failover)

Manually changing application connection targets after failover is operationally expensive, so Snowflake provides the Client Redirect (Connection Failover) feature. By using an Organization-level URL as the connection URL, clients are automatically redirected to the new Primary account on failover.

-- Organization URL format (supports Client Redirect)
-- https://<org_name>-<connection_name>.snowflakecomputing.com

-- Create the Connection object
CREATE CONNECTION prod_connection
  AS REPLICA OF myorg.source_account.prod_connection;

-- Switch the Primary connection
ALTER CONNECTION prod_connection PRIMARY;

Replication Monitoring

-- Check replication lag (run on the Secondary account)
SELECT SYSTEM$REPLICATION_LAG('analytics');

-- Refresh history and duration
SELECT
  replication_group_name,
  phase_name,
  start_time,
  end_time,
  DATEDIFF('SECOND', start_time, end_time) AS duration_sec,
  primary_snapshot_timestamp
FROM SNOWFLAKE.ACCOUNT_USAGE.REPLICATION_GROUP_REFRESH_HISTORY
WHERE start_time >= DATEADD(DAY, -7, CURRENT_TIMESTAMP())
ORDER BY start_time DESC;

-- Monitor credit consumption for replication
SELECT
  start_time::DATE AS usage_date,
  database_name,
  SUM(credits_used) AS total_credits,
  SUM(bytes_transferred) / POWER(1024, 3) AS gb_transferred
FROM SNOWFLAKE.ACCOUNT_USAGE.REPLICATION_USAGE_HISTORY
WHERE start_time >= DATEADD(MONTH, -1, CURRENT_TIMESTAMP())
GROUP BY 1, 2
ORDER BY usage_date DESC;

Edition Requirements Summary

FeatureStandardEnterpriseBusiness Critical
Database Replication (read-only)YesYesYes
Failover GroupNoNoYes
Client RedirectNoNoYes
Cross-cloud replicationNoNoYes

DR Design Best Practices

  • Include roles and network policies in the Failover Group: If you replicate only databases but lose your RBAC configuration, you cannot access the data. Include ROLES/USERS/NETWORK POLICIES in OBJECT_TYPES.
  • Run regular DR drills: Execute the failover → failback procedure quarterly and record the measured RTO.
  • Align REPLICATION_SCHEDULE with your RPO requirement: For an RPO of 10 minutes, set REPLICATION_SCHEDULE = '10 MINUTE' and configure lag-monitoring alerts.
  • Adopt Client Redirect to eliminate application-side changes: Use the Organization URL to remove the need to reconfigure applications during failover.
  • Estimate cross-region transfer costs: Transfers between different cloud regions are billed per GB, so estimate the cost of the initial full snapshot in advance.

Check Your Understanding

Architecture / DR

問題 1

A company on Business Critical Edition wants to build a DR site in EU-WEST-1 for its production environment in US-EAST-1 (AWS). The requirements are: RPO within 10 minutes, no application connection-string changes during failover, and replication that includes roles and network policies. Which configuration is most appropriate?

  1. Replicate each database individually with Database Replication, and manually change the application's connection string on failover.
  2. Failover Group (OBJECT_TYPES = DATABASES, ROLES, USERS, NETWORK POLICIES) + Client Redirect (Organization URL) + REPLICATION_SCHEDULE = '10 MINUTE'.
  3. Use Snowpipe to copy all table data to a stage in EU-WEST-1, and use a Task to load it on a schedule.
  4. Set Time Travel's DATA_RETENTION_TIME_IN_DAYS to 90 days to maximize data protection.

正解: B

B is the only option that meets all three requirements. Including ROLES/USERS/NETWORK POLICIES in the Failover Group's OBJECT_TYPES replicates account-level objects too. Client Redirect (Organization URL) removes the need to change the application's connection target on failover. REPLICATION_SCHEDULE = '10 MINUTE' delivers a 10-minute RPO. A lacks Client Redirect and requires manual connection-string changes. C is data copying, not replication, and cannot replicate roles or policies. D is Time Travel, which is unrelated to replication.

Frequently Asked Questions

What is the difference between Database Replication and Failover Group?

Database Replication replicates individual databases to another region or account and is available on Business Critical Edition or higher. Failover Group bundles multiple databases, shares, users/roles, warehouses, and other objects into a single group that can fail over together — it also requires Business Critical or higher. For DR design, using a Failover Group lets you fail over not only databases but also account-level objects such as roles and network policies in one shot.

How are replication costs incurred?

Replication costs have two main components: (1) Data transfer cost — charges for moving data from the source region to the target region (free within the same cloud and region), and (2) Compute cost — Serverless Credits consumed when creating incremental replication snapshots. The initial full snapshot is the most expensive; after that, only deltas are transferred, so costs drop over time. You can monitor credit usage via the REPLICATION_USAGE_HISTORY view.

How can I check replication lag?

Run SELECT SYSTEM$REPLICATION_LAG() against the secondary database to get the lag time relative to the primary. You can also check refresh history and duration via the SNOWFLAKE.ACCOUNT_USAGE.REPLICATION_GROUP_REFRESH_HISTORY view to continuously monitor the gap against your RPO target. The Snowsight replication dashboard also visualizes lag trends as a graph.

Check what you learned with practice questions

Practice with certification-focused question sets

無料で問題を解いてみる
Author

NicheeLab Editorial Team

NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.


Related articles
Snowflake

Snowflake Certifications: All 11 Exams Explained (2026)

Every SnowPro certification — Associate, Core, Specialty, Ad...

Snowflake

Snowflake Exam Difficulty Ranking: All 11 Certs Compared (2026)

All 11 SnowPro exams ranked by difficulty with study-time es...

Snowflake

Snowflake Study Guide: Fastest Pass Route by Exam (2026)

How to pass SnowPro certifications efficiently — official ma...

Snowflake

SnowPro Core (COF-C03): Complete Exam Guide (2026)

Pass the SnowPro Core exam — six domains, scope, sample ques...

Snowflake

SnowPro Associate Platform (SOL-C01): Complete Guide (2026)

The entry-level SnowPro Associate exam — scope, weighting, s...

Browse all Snowflake articles (103)
© 2026 NicheeLab All rights reserved.