Module 20 · Lesson 9 of 11Detailed study · about 32 min

Snowflake Replication Groups and Failover Groups: Cross-Region Setup and Monitoring

Set up authorized source and secondary accounts, select objects to replicate, and verify the data point and cost of a successful refresh.

Before you beginDefine the required recovery point and recovery time

Choose a read-only replica or a promotable group

A replica holds a copy in another account in your organization. The secondary remains read-only as it receives refreshes from the primary. That makes it useful for regional reads or continuity. A failover group also supports promoting a secondary when you want to resume writes there.

Database and share replication are available across editions, subject to object limitations. Replication of most account objects such as roles, users or warehouses and failover groups requires Business Critical Edition or higher. Some objects have special rules. For example, custom event tables are skipped, and inbound shares cannot be replicated as shares. Read the matrix and plan for objects or external services that need separate configuration.

Accounts can be in separate supported regions on the same cloud or on different cloud providers. Same-region copies cannot protect against a region outage. Confirm the organization, supported regions, data residency and actual features with both account owners before copying any data.

Select a group by what the target must do
RequirementChoiceWhat to verify
Read replicated sales data in another regionReplication groupSupported databases, role grants and secondary read access.
Promote the copy after an outageFailover groupBusiness Critical or higher in both accounts, correct privileges, and tested promotion.
Move customer connections tooClient Redirect or pre-tested client configurationThe client reaches the new writable account and has the correct access.
Replication moves changes from a primary to a secondary The scheduled refresh keeps the copy up to date. Promoting a failover group changes which account can write.
  1. MAPLE_EAST primaryCapture to Refresh job
  2. Refresh jobApply to MAPLE_WEST secondary
MAPLE_EAST primary
Writable approved sales data.
Refresh job
A source snapshot is transferred and applied.
MAPLE_WEST secondary
Read-only copy verified against the business marker.

Prepare two approved test accounts and the test database

An organization administrator enables replication for both accounts in the same organization. With the authorized account role, use SHOW REPLICATION ACCOUNTS to confirm eligible accounts. The walkthrough calls them MAPLEORG.MAPLE_EAST and MAPLEORG.MAPLE_WEST. Replace them with your test identifiers. Ensure the source owns the capstone database and the secondary has no conflicting database name. Confirm Snowflake edition and permissions on each account.

For failover, each account administrator can delegate CREATE FAILOVER GROUP to an existing custom role. The primary group creator also needs MONITOR on the database to include it. The group owner can delegate REPLICATE on both sides for refresh and FAILOVER on both sides for promotion. These privileges are established in each account. For a replication group, use the analogous CREATE REPLICATION GROUP account privilege and REPLICATE on the groups. Ensure the recovery-side application account and role can read the copy, and prepare an approved warehouse and identity in that account before testing.

SQL · configuration template
-- In each enabled test account, with the approved administrator:
SHOW REPLICATION ACCOUNTS;
GRANT CREATE FAILOVER GROUP ON ACCOUNT TO ROLE MAPLE_DR_ADMIN;
-- In the source account, with the database owner or grant authority:
GRANT MONITOR ON DATABASE LS_M20_OPS_LAB TO ROLE MAPLE_DR_ADMIN;

Create the primary, then refresh its secondary

Run the first statement in the source account and the second in the target, each with its authorized creation role. OBJECT_TYPES selects what the group may contain, ALLOWED_DATABASES names the database, and ALLOWED_ACCOUNTS names the eligible replica. The 10-minute schedule requests regular updates. It cannot guarantee a 10-minute data gap. A scheduled primary triggers the initial refresh on secondary creation. Check that job before running a manual refresh.

Run the final command in the secondary only after verifying that no refresh is already in progress. Use its group owner or properly delegated role. Start with a database-only group. Choose and test how roles and other dependencies will be made available in the target. Later you can choose a documented replication strategy for supported account objects, using dedicated test accounts to avoid overwriting live configuration.

SQL · configuration template
-- Primary account: MAPLEORG.MAPLE_EAST.
CREATE FAILOVER GROUP MAPLE_SALES_FG
  OBJECT_TYPES = DATABASES
  ALLOWED_DATABASES = LS_M20_OPS_LAB
  ALLOWED_ACCOUNTS = MAPLEORG.MAPLE_WEST
  REPLICATION_SCHEDULE = '10 MINUTE';

-- Secondary account: MAPLEORG.MAPLE_WEST.
CREATE FAILOVER GROUP MAPLE_SALES_FG
  AS REPLICA OF MAPLEORG.MAPLE_EAST.MAPLE_SALES_FG;

-- Secondary, optional after the initial refresh finishes.
ALTER FAILOVER GROUP MAPLE_SALES_FG REFRESH;

Use a replication-only group for secondary reads

If you only need a read replica, use this as an alternative. Do not add the same database to both groups for this exercise. If the database already belongs to a group, use another scratch database or follow Snowflake’s migration procedure. Refresh the replica in the destination. This strategy leaves the replica read-only while it is linked.

SQL · configuration template
-- Primary account:
CREATE REPLICATION GROUP MAPLE_SALES_RG
  OBJECT_TYPES = DATABASES
  ALLOWED_DATABASES = LS_M20_OPS_LAB
  ALLOWED_ACCOUNTS = MAPLEORG.MAPLE_WEST;

-- Secondary account:
CREATE REPLICATION GROUP MAPLE_SALES_RG
  AS REPLICA OF MAPLEORG.MAPLE_EAST.MAPLE_SALES_RG;
ALTER REPLICATION GROUP MAPLE_SALES_RG REFRESH;

Verify the snapshot, data and refresh cost

Use SHOW FAILOVER GROUPS to verify group identity and primary status. In the secondary, use the authorized role and a usable database to inspect recent refresh jobs. Use a separate local database for the Information Schema function if the replica is missing. Follow the latest JOB_UUID and check the final state and error. Compute the recoverable gap from the latest successful snapshot and compare a verified business marker. A failed refresh can leave an older usable snapshot.

From the secondary account and with appropriate access to Account Usage, check recent replication compute and bytes transferred. Allow up to three hours for usage history, and estimate the storage impact separately. High change volume, large initial copies and frequent refreshes can raise cost or make refreshes take longer. If a required object is missing, first check group membership, edition support, permissions and feature limitations. A newer replication mode or an RPO feature has its own eligibility and tradeoffs, so verify it separately before changing the recovery plan.

Representative target evidence before promotion
HistoryPrimary snapshotCompleted atOutcome
Refresh job r-10208:53 UTC08:57 UTCCOMPLETED
Verify sales targetB102 is published08:59 UTC4 orders, total 250
SQL · configuration template
SHOW FAILOVER GROUPS;

SELECT job_uuid, phase_name, primary_snapshot_timestamp, start_time, end_time, error
FROM TABLE(INFORMATION_SCHEMA.REPLICATION_GROUP_REFRESH_HISTORY('MAPLE_SALES_FG'))
ORDER BY start_time DESC, end_time DESC NULLS FIRST;

SELECT replication_group_name, start_time, credits_used, bytes_transferred
FROM SNOWFLAKE.ACCOUNT_USAGE.REPLICATION_GROUP_USAGE_HISTORY
WHERE replication_group_name = 'MAPLE_SALES_FG'
  AND start_time >= DATEADD('day', -1, CURRENT_TIMESTAMP())
ORDER BY start_time DESC;

Interview practice

Explain the decision and the evidence you would use to test it.

Beginner · Is replication the same as failover?

Replication updates the copy. Failover changes which linked account can write to the protected objects and is a planned decision when needed.

SQL · How would you prove the replica is current enough?

I find the latest completed refresh, note its primary snapshot time and verify a durable business marker. I compare it with the intended cutoff, not just the end time of the refresh.

Production · What would you check besides database tables?

I inventory client authentication, roles, warehouses, network access, notification integrations and external services. I check what can be replicated, provision what cannot and exercise the application path.

Words used in this lesson
Primary
The group that owns the writable source objects.
Secondary
A linked, read-only copy as of its last successful refresh.
Refresh
The operation that applies source changes to a secondary group.
Failover
Promoting a prepared secondary group so it can serve as the writable primary.

Try the SQL or command

Read → predict → run in your learning environment → compare. You can also learn by reading without an account.

Use the SQL and expected outputs in the sections above.

New to SQL? Where to run it and how to read it

A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
  3. Read the entire example, including comments beginning with --. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor.
  4. Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
SELECT / FROM
Choose the values to return / identify their input.
VALUES / COLUMN1
VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
AS / WITH
AS gives a result a readable name. WITH names a temporary query step within one statement.
NULL / ::
NULL means missing or unknown. The :: notation converts a value to a named data type.
Session
One connection and its settings. Keep related transaction steps in the same session.
Database.schema.table
A full address for stored data. It is separate from the warehouse that processes queries.

Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →

Help with common practice errors
  • No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
  • Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
  • Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
  • Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.

Before running this lesson

Maple Market is fictional. Output tables are representative. Live commands require an authorized test account and the roles, compute and edition listed in each lesson.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

Which group should you choose if the secondary must become writable through group promotion?

Try it yourself

The refresh finishes within two minutes, but the snapshot is 30 minutes old. Which timestamp represents recoverable data?

Compare your reasoning

Use the verified source snapshot timestamp, supported by an application marker. Fast completion does not make the snapshot newer.

Connect this lesson to the learning path

Official sources and curriculum

Module 20 · See module scope

By Rohit Ray · Independent educational lesson · Explore this visual lab