Home Database Disaster Recovery: Replication, Failover & DR Guide
Advanced 4 min · July 17, 2026
Business Continuity: Replication, Failover, and Disaster Recovery

Disaster Recovery: Replication, Failover & DR Guide

Learn Snowflake business continuity with replication, failover, and disaster recovery.

N
Naren Founder & Principal Engineer

20+ years shipping high-throughput database systems. Everything here is grounded in real deployments.

Follow
Production
production tested
July 17, 2026
last updated
2,439
articles · all by Naren
Before you start⏱ 20-25 min read
  • Basic understanding of Snowflake architecture (warehouses, databases, accounts).
  • Access to at least two Snowflake accounts (primary and secondary) on Business Critical Edition or higher.
  • Familiarity with SQL commands for account and database administration.
  • Knowledge of your organization's RPO and RTO requirements.
 ● Production Incident 🔎 Debug Guide ⚙ Triage Commands
Quick Answer
  • Snowflake provides replication at the database level across regions/clouds.
  • Failover can be manual or automatic using client redirect.
  • Disaster recovery requires careful planning of RPO and RTO.
  • Use Snowflake's replication features to minimize downtime.
  • Test failover regularly to ensure readiness.
✦ Definition~90s read
What is Business Continuity?

Snowflake disaster recovery is the practice of using replication and failover to maintain data availability and business continuity during outages.

Think of Snowflake as a library with multiple branches.
Plain-English First

Think of Snowflake as a library with multiple branches. If one branch burns down, you can still borrow books from another branch because copies exist. Replication is like making photocopies of all books and sending them to other branches. Failover is like automatically redirecting patrons to the nearest open branch. Disaster recovery is the plan to get the damaged branch rebuilt and restocked.

Imagine your company's entire data warehouse—customer orders, financial records, real-time analytics—is hosted on Snowflake. One day, a regional cloud provider outage takes down your primary Snowflake account. Without a disaster recovery plan, your business grinds to a halt. This is where Snowflake's business continuity features come in.

Snowflake offers robust replication and failover capabilities to ensure your data remains available even during catastrophic failures. Whether you need cross-region replication for geographic redundancy or cross-cloud replication to avoid vendor lock-in, Snowflake provides the tools to design a resilient architecture.

In this tutorial, you'll learn how to set up database replication, perform failover and failback, and implement a comprehensive disaster recovery strategy. We'll cover real-world production incidents, debugging guides, and best practices to keep your data safe and accessible. By the end, you'll be able to configure Snowflake for high availability and confidently handle outages.

Understanding Snowflake's Business Continuity Model

Snowflake's architecture separates storage and compute, allowing for unique disaster recovery capabilities. Business continuity in Snowflake revolves around three key concepts: replication, failover, and failback.

Replication is the process of copying databases from a primary account to one or more secondary accounts. These secondary accounts can be in different regions or even different cloud providers. Replication is asynchronous, meaning there is some lag between when data is written to the primary and when it appears on the secondary. This lag determines your Recovery Point Objective (RPO).

Failover is the act of switching from the primary account to a secondary account during a disaster. Snowflake supports manual failover (where you explicitly promote a secondary to primary) and automatic failover via client redirect (where the Snowflake service automatically redirects connections to a healthy account).

Failback is the process of returning to the original primary after the disaster is resolved. This involves reversing the replication direction and ensuring data consistency.

Snowflake also offers a feature called 'Business Critical Edition' which includes enhanced replication and failover options. The following sections will guide you through setting up these features.

check_replication.sqlSQL
1
2
3
4
5
6
7
-- Check current replication status
SHOW REPLICATION DATABASES;

-- View replication lag
SELECT DATABASE_NAME, REPLICATION_LAG_SECONDS
FROM SNOWFLAKE.ACCOUNT_USAGE.REPLICATION_USAGE_HISTORY
ORDER BY START_TIME DESC;
Output
+-----------------+------------------------+
| DATABASE_NAME | REPLICATION_LAG_SECONDS |
+-----------------+------------------------+
| SALES_DB | 45 |
| ANALYTICS_DB | 12 |
+-----------------+------------------------+
🔥Replication Lag and RPO
📊 Production Insight
In production, always use at least two secondary accounts in different regions to avoid a single point of failure.
🎯 Key Takeaway
Replication is asynchronous; plan your RPO based on acceptable lag.

Setting Up Database Replication

To set up replication, you need at least two Snowflake accounts: a primary and a secondary. Both accounts must be on the same edition (e.g., Business Critical) and have the same cloud platform (or different if cross-cloud).

Step 1: Enable replication on the primary account. Step 2: Create a replication link between accounts. Step 3: Enable replication for specific databases.

Here's how to do it using SQL commands. First, on the primary account, run:

ALTER ACCOUNT SET ENABLE_REPLICATION = TRUE;

Then, on the primary, create a replication link to the secondary account:

CREATE REPLICATION LINK my_link AS REPLICATION OF ACCOUNT TO ACCOUNT <secondary_account_locator>;

ALTER DATABASE sales_db ENABLE REPLICATION TO ACCOUNTS <secondary_account_locator>;

On the secondary account, you must create the database as a replica:

CREATE DATABASE sales_db AS REPLICA OF <primary_account_locator>.sales_db;

Once created, replication starts automatically. You can monitor progress using SHOW REPLICATION DATABASES.

setup_replication.sqlSQL
1
2
3
4
5
6
7
8
9
10
11
12
13
-- On primary account
ALTER ACCOUNT SET ENABLE_REPLICATION = TRUE;

CREATE REPLICATION LINK my_link
  AS REPLICATION OF ACCOUNT
  TO ACCOUNT 'XY12345';

ALTER DATABASE sales_db ENABLE REPLICATION
  TO ACCOUNTS 'XY12345';

-- On secondary account
CREATE DATABASE sales_db AS REPLICA OF
  'AB12345'.sales_db;
Output
Statement executed successfully.
💡Account Locator
📊 Production Insight
For large databases, initial replication can take hours. Plan this during a maintenance window.
🎯 Key Takeaway
Replication is per-database; you must enable it for each database you want to protect.

Performing Manual Failover and Failback

When a disaster strikes, you need to promote a secondary account to primary. This is a manual process unless you've configured automatic failover.

Manual Failover Steps: 1. Verify that the secondary account is healthy and has the latest data. 2. On the secondary account, promote it to primary:

ALTER ACCOUNT SET PRIMARY = TRUE;

This command makes the secondary account the new primary. All databases that were replicas become primary databases.

  1. Update your application connection strings to point to the new primary account URL.

Failback Steps: After the original primary is restored, you need to reverse replication and fail back.

  1. On the new primary (original secondary), enable replication back to the original primary:

ALTER DATABASE sales_db ENABLE REPLICATION TO ACCOUNTS <original_primary_locator>;

  1. On the original primary, create the database as a replica:

CREATE DATABASE sales_db AS REPLICA OF <new_primary_locator>.sales_db;

  1. Once replication is caught up, promote the original primary back:

ALTER ACCOUNT SET PRIMARY = TRUE;

  1. Update connection strings again.
failover.sqlSQL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
-- On secondary account during disaster
ALTER ACCOUNT SET PRIMARY = TRUE;

-- Check new primary status
SELECT SYSTEM$GLOBAL_ACCOUNT_CURRENT_REGION();

-- On original primary after recovery (failback)
ALTER DATABASE sales_db ENABLE REPLICATION
  TO ACCOUNTS 'XY12345';

CREATE DATABASE sales_db AS REPLICA OF
  'AB12345'.sales_db;

-- Promote original primary back
ALTER ACCOUNT SET PRIMARY = TRUE;
Output
Statement executed successfully.
⚠ Data Loss During Failover
📊 Production Insight
In production, use a custom DNS CNAME that points to the active account. Update the CNAME during failover to avoid code changes.
🎯 Key Takeaway
Manual failover requires updating connection strings; automate this with DNS or load balancers.

Configuring Automatic Failover with Client Redirect

Snowflake offers automatic failover through client redirect. When enabled, the Snowflake service monitors the health of your primary account. If it detects an outage, it automatically redirects new connections to a secondary account.

To enable automatic failover: 1. Ensure replication is set up as described earlier. 2. On the primary account, configure failover objects:

ALTER ACCOUNT SET FAILOVER_OBJECT = '<secondary_account_locator>';

  1. On the secondary account, set it to accept failover:

ALTER ACCOUNT SET ACCEPT_FAILOVER = TRUE;

  1. Optionally, set a failover group to include multiple databases:

CREATE FAILOVER GROUP my_group OBJECT_TYPES = DATABASES ALLOWED_DATABASES = (sales_db, analytics_db);

Now, when the primary account becomes unavailable, Snowflake will automatically redirect new connections to the secondary. Existing connections may be dropped and need to reconnect.

You can test automatic failover by simulating an outage (e.g., disabling the primary account temporarily).

auto_failover.sqlSQL
1
2
3
4
5
6
7
8
9
10
11
12
13
-- On primary account
ALTER ACCOUNT SET FAILOVER_OBJECT = 'XY12345';

-- On secondary account
ALTER ACCOUNT SET ACCEPT_FAILOVER = TRUE;

-- Create failover group (optional)
CREATE FAILOVER GROUP my_group
  OBJECT_TYPES = DATABASES
  ALLOWED_DATABASES = (sales_db, analytics_db);

-- Check failover status
SHOW PARAMETERS LIKE 'FAILOVER_MODE';
Output
+----------------+---------+--------+
| key | value | default|
+----------------+---------+--------+
| FAILOVER_MODE | AUTO | MANUAL |
+----------------+---------+--------+
🔥Client Redirect vs. Manual
📊 Production Insight
Always test automatic failover in a non-production environment first. Monitor failover events in SNOWFLAKE.ACCOUNT_USAGE.FAILOVER_EVENTS.
🎯 Key Takeaway
Automatic failover reduces downtime but requires careful testing.

Monitoring Replication and Failover Health

Continuous monitoring is essential to ensure your disaster recovery plan works. Snowflake provides several views and functions to track replication and failover status.

Key monitoring tools
  • SHOW REPLICATION DATABASES: Shows replication status and lag.
  • SNOWFLAKE.ACCOUNT_USAGE.REPLICATION_USAGE_HISTORY: Historical replication lag data.
  • SNOWFLAKE.ACCOUNT_USAGE.FAILOVER_EVENTS: Logs of failover events.
  • SYSTEM$LAST_REPLICATION_TIMESTAMP: Returns the timestamp of the last replicated transaction for a database.

Set up alerts for replication lag exceeding your RPO. For example, use Snowflake's task and notification integration to send an email when lag > 5 minutes.

CREATE OR REPLACE TASK check_replication_lag WAREHOUSE = my_wh SCHEDULE = '5 MINUTE' AS CALL SYSTEM$SEND_EMAIL( 'my_int', 'admin@example.com', 'Replication Lag Alert', 'Lag is high: ' || (SELECT MAX(REPLICATION_LAG_SECONDS) FROM SNOWFLAKE.ACCOUNT_USAGE.REPLICATION_USAGE_HISTORY) );

monitor_replication.sqlSQL
1
2
3
4
5
6
7
8
9
10
11
-- Check current lag for all databases
SELECT DATABASE_NAME, REPLICATION_LAG_SECONDS
FROM SNOWFLAKE.ACCOUNT_USAGE.REPLICATION_USAGE_HISTORY
WHERE START_TIME > DATEADD('hour', -1, CURRENT_TIMESTAMP());

-- Get last replication timestamp for a database
SELECT SYSTEM$LAST_REPLICATION_TIMESTAMP('sales_db');

-- View failover events
SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.FAILOVER_EVENTS
ORDER BY EVENT_TIMESTAMP DESC;
Output
+-----------------+------------------------+
| DATABASE_NAME | REPLICATION_LAG_SECONDS |
+-----------------+------------------------+
| SALES_DB | 3 |
| ANALYTICS_DB | 1 |
+-----------------+------------------------+
💡Alerting Best Practice
📊 Production Insight
Set up a dashboard in Snowsight or your BI tool to visualize replication health across all databases.
🎯 Key Takeaway
Monitor replication lag and failover events to ensure your DR plan is working.

Cross-Cloud Replication and Multi-Region Strategies

Snowflake supports replication across different cloud providers (AWS, Azure, GCP) and regions. This is crucial for avoiding vendor lock-in and meeting compliance requirements.

Cross-cloud replication works similarly to cross-region replication, but requires that both accounts are on Business Critical Edition (or higher). The setup steps are identical, but you must ensure network connectivity between clouds (Snowflake handles this).

Multi-region strategies: For maximum resilience, replicate to at least two secondary accounts in different geographic regions. For example, primary on AWS us-east-1, secondary on AWS eu-west-1, and another secondary on Azure eastus.

Considerations
  • Cross-cloud replication may have higher latency and cost.
  • Data sovereignty laws may require data to stay within certain regions.
  • Failover across clouds may require additional configuration for external objects (e.g., stages, integrations).

-- On primary (AWS) ALTER DATABASE sales_db ENABLE REPLICATION TO ACCOUNTS 'AZ12345'; -- Azure account

-- On secondary (Azure) CREATE DATABASE sales_db AS REPLICA OF 'AWS12345'.sales_db;

cross_cloud_replication.sqlSQL
1
2
3
4
5
6
7
8
9
10
-- Enable replication to an Azure account from AWS
ALTER DATABASE sales_db ENABLE REPLICATION
  TO ACCOUNTS 'AZ12345';

-- On Azure account, create replica
CREATE DATABASE sales_db AS REPLICA OF
  'AWS12345'.sales_db;

-- Verify replication
SHOW REPLICATION DATABASES;
Output
+-----------------+----------------+----------------+
| DATABASE_NAME | PRIMARY_ACCOUNT| SECONDARY_ACCOUNT|
+-----------------+----------------+----------------+
| SALES_DB | AWS12345 | AZ12345 |
+-----------------+----------------+----------------+
🔥Cross-Cloud Limitations
📊 Production Insight
Use cross-cloud replication for critical data that must survive a full cloud provider outage.
🎯 Key Takeaway
Cross-cloud replication provides ultimate resilience but adds complexity.

Best Practices for Disaster Recovery Testing

A disaster recovery plan is only as good as its last test. Regular testing ensures that your team knows the procedures and that the configuration works.

Best practices: 1. Schedule quarterly failover drills in a non-production environment. 2. Automate testing using Snowflake's SQL API or Terraform. 3. Validate data consistency after failover by comparing row counts or checksums. 4. Document the runbook with exact commands and contact information. 5. Include application teams in testing to ensure connection strings and authentication work.

-- Simulate failover ALTER ACCOUNT SET PRIMARY = TRUE; -- Run queries on new primary SELECT COUNT(*) FROM sales_db.orders; -- Failback ALTER ACCOUNT SET PRIMARY = FALSE; -- Not a real command; use proper failback steps

Use a separate test account to avoid impacting production.

test_failover.sqlSQL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- Test failover on secondary account (non-production)
ALTER ACCOUNT SET PRIMARY = TRUE;

-- Verify data
SELECT COUNT(*) FROM sales_db.orders;

-- Check replication lag
SHOW REPLICATION DATABASES;

-- Failback (reverse replication)
-- (Assume original primary is restored)
ALTER DATABASE sales_db ENABLE REPLICATION TO ACCOUNTS 'PRIMARY_LOCATOR';
CREATE DATABASE sales_db AS REPLICA OF 'SECONDARY_LOCATOR'.sales_db;
ALTER ACCOUNT SET PRIMARY = TRUE;
Output
+----------+
| COUNT(*) |
+----------+
| 100000 |
+----------+
⚠ Test in Isolation
📊 Production Insight
Include failover testing in your change management process. After each major schema change, verify replication still works.
🎯 Key Takeaway
Regular testing is critical; automate it to ensure consistency.
● Production incidentPOST-MORTEMseverity: high

The Cross-Region Outage That Almost Froze a Fintech

Symptom
Users could not run queries; all dashboards showed errors. The Snowflake web UI was inaccessible.
Assumption
The developer assumed Snowflake's built-in redundancy would automatically failover to another region.
Root cause
The Snowflake account was single-region with no replication enabled. The outage affected the entire region.
Fix
Enabled database replication to a secondary region and configured client redirect for automatic failover. Restored service from the secondary account.
Key lesson
  • Always configure cross-region replication for critical data.
  • Test failover procedures regularly, not just during incidents.
  • Understand that Snowflake does not automatically failover; you must set it up.
  • Monitor replication lag to ensure RPO targets are met.
  • Document and practice the failover runbook.
Production debug guideSymptom to Action4 entries
Symptom · 01
Queries fail with 'Account is in failover mode'
Fix
Check if the account is in failover state using SHOW PARAMETERS LIKE 'FAILOVER_MODE'. If yes, verify secondary account is active and redirect clients.
Symptom · 02
Replication lag is high (minutes/hours)
Fix
Run SHOW REPLICATION DATABASES to check lag. Investigate network issues or resource constraints. Consider increasing warehouse size for replication.
Symptom · 03
Failover fails with 'No valid secondary account'
Fix
Verify that replication is enabled and the secondary account is properly linked. Use ALTER ACCOUNT SET FAILOVER_OBJECT = ... to configure.
Symptom · 04
Data inconsistency after failback
Fix
Ensure all transactions are replicated before failback. Use SYSTEM$LAST_REPLICATION_TIMESTAMP to verify. Re-run replication if needed.
★ Quick Debug Cheat SheetImmediate actions for common Snowflake DR issues.
Account unreachable
Immediate action
Check Snowflake status page. Initiate failover to secondary account.
Commands
ALTER ACCOUNT SET FAILOVER_MODE = 'MANUAL';
ALTER ACCOUNT <secondary> SET PRIMARY;
Fix now
Update connection strings to point to secondary account URL.
Replication lag > 5 minutes+
Immediate action
Scale up replication warehouse. Check for blocking queries.
Commands
ALTER WAREHOUSE replication_wh SET WAREHOUSE_SIZE = 'XLARGE';
SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.REPLICATION_USAGE_HISTORY;
Fix now
Kill long-running queries that may block replication.
Failover fails+
Immediate action
Verify secondary account is in ACTIVE state.
Commands
SHOW ACCOUNTS;
SELECT SYSTEM$GLOBAL_ACCOUNT_CURRENT_REGION();
Fix now
Contact Snowflake support if secondary account is not active.
FeatureManual FailoverAutomatic Failover (Client Redirect)
Configuration complexityLowMedium
DowntimeMinutes (manual intervention)Seconds to minutes (automatic)
Connection string updateRequired (manual or DNS)Handled by Snowflake (redirect)
TestingSimpleRequires careful simulation
CostNo extra costNo extra cost
⚙ Quick Reference
7 commands from this guide
FileCommand / CodePurpose
check_replication.sqlSHOW REPLICATION DATABASES;Understanding Snowflake's Business Continuity Model
setup_replication.sqlALTER ACCOUNT SET ENABLE_REPLICATION = TRUE;Setting Up Database Replication
failover.sqlALTER ACCOUNT SET PRIMARY = TRUE;Performing Manual Failover and Failback
auto_failover.sqlALTER ACCOUNT SET FAILOVER_OBJECT = 'XY12345';Configuring Automatic Failover with Client Redirect
monitor_replication.sqlSELECT DATABASE_NAME, REPLICATION_LAG_SECONDSMonitoring Replication and Failover Health
cross_cloud_replication.sqlALTER DATABASE sales_db ENABLE REPLICATIONCross-Cloud Replication and Multi-Region Strategies
test_failover.sqlALTER ACCOUNT SET PRIMARY = TRUE;Best Practices for Disaster Recovery Testing

Key takeaways

1
Snowflake replication is asynchronous; monitor lag to meet your RPO.
2
Automatic failover reduces downtime but requires proper configuration and testing.
3
Cross-cloud replication provides resilience against cloud provider outages.
4
Regular testing of failover procedures is essential for a reliable DR plan.
5
Use monitoring and alerts to detect replication issues early.

Common mistakes to avoid

4 patterns
×

Not enabling replication for all critical databases.

×

Assuming automatic failover works without configuration.

×

Failing to update connection strings after failover.

×

Not testing failover regularly.

INTERVIEW PREP · PRACTICE MODE

Interview Questions on This Topic

Q01SENIOR
Explain how Snowflake replication works and what determines RPO.
Q02SENIOR
Describe the steps to perform a manual failover in Snowflake.
Q03SENIOR
What are the considerations for cross-cloud replication?
Q04SENIOR
How can you automate failover testing in Snowflake?
Q01 of 04SENIOR

Explain how Snowflake replication works and what determines RPO.

ANSWER
Snowflake replication is asynchronous, copying data from primary to secondary accounts. RPO is determined by replication lag, which is the time between a transaction on the primary and its appearance on the secondary. Lag can be seconds to minutes depending on network and load.
FAQ · 5 QUESTIONS

Frequently Asked Questions

01
What is the difference between replication and failover in Snowflake?
02
Can I replicate databases across different cloud providers?
03
How do I monitor replication lag?
04
What happens to existing connections during automatic failover?
05
Is there any data loss during failover?
N
Naren Founder & Principal Engineer

20+ years shipping high-throughput database systems. Everything here is grounded in real deployments.

Follow
Verified
production tested
July 17, 2026
last updated
2,439
articles · all by Naren
🔥

That's Snowflake. Mark it forged?

4 min read · try the examples if you haven't

Previous
External Tables, Iceberg, and Multi-Cloud Data Access
22 / 33 · Snowflake
Next
Migrating to Snowflake: From Redshift, BigQuery, and Legacy Warehouses