Snowflake combines two ideas that other data warehouses keep separate. The first is data protection:
- the ability to recover a table that was dropped,
- restore rows that were overwritten by a bad merge,
- copy a 50 TB database into a sandbox in three seconds,
- and bring an account back online in a different region after a cloud provider outage.
The second is collaboration:
- the ability to expose any object that is protected by RBAC to another Snowflake account without copying files,
- replicating pipelines,
- or building API contracts.
Both ideas rest on the same architectural fact introduced in Chapter 1: the Database Storage layer holds immutable micro-partitions, and the Cloud Services layer holds the metadata that names those partitions. Protection and sharing are operations on metadata; nothing is rewritten in object storage when a table is restored through UNDROP, a database is cloned, or a share is granted to a consumer account.
How it works
This section walks through the protection toolkit (Continuous Data Protection, abbreviated CDP) and the secure sharing surface that the same metadata supports. Replication and failover were introduced in Chapter 2 as part of governance and business continuity; here the focus moves to how replication, sharing, cloning, Time Travel, and Fail-safe interlock to keep data safe, recoverable, and shareable across accounts and regions.
The decision pattern is consistent across all five features: pick the feature that matches:
- the recovery window,
- the actor authorized to perform the recovery,
- and the geography of the destination account.
Data replication and failover
Replication groups copy database objects between Snowflake accounts.
Failover groups copy database objects plus the account-level metadata (users, roles, warehouses, resource monitors, network policies, integrations) required to redirect client traffic to a secondary account during an outage.
Both group types operate on a list of named objects and use Snowflake's own internal transport, not customer-managed pipelines.
A replication group is owned by an account role and lists the databases, shares, and account objects to be copied to one or more target accounts in other regions or other clouds.
Replication is asynchronous and snapshot-based: at each refresh, the source generates a consistent snapshot of every object in the group and the target applies the changes.
The replication frequency is configurable in minutes; the Recovery Point Objective (RPO) is therefore the refresh interval plus any in-flight transactions.
In practice
A failover group adds the ability to promote a target account to primary.
When the source region becomes unavailable, an account administrator on the secondary runs ALTER FAILOVER GROUP ... PRIMARY to swap roles.
Clients that connect through the organization-level connection URL are redirected through client redirect, which resolves the connection URL to the active primary at login time.
Without client redirect, applications must update their JDBC, ODBC, or Python connector connection strings to the new account identifier.
-- Provider side: create a failover group containing databases, shares, and key account objects
CREATE FAILOVER GROUP fg_analytics
OBJECT_TYPES = DATABASES, SHARES, ROLES, USERS, WAREHOUSES, RESOURCE_MONITORS
ALLOWED_DATABASES = sales_db, marketing_db
ALLOWED_SHARES = sales_share
ALLOWED_ACCOUNTS = ('acme_org.acme_dr_account')
REPLICATION_SCHEDULE = '15 MINUTE';
-- Secondary side: link the failover group, then refresh
CREATE FAILOVER GROUP fg_analytics
AS REPLICA OF acme_org.acme_prod_account.fg_analytics;
ALTER FAILOVER GROUP fg_analytics REFRESH;
-- During a DR drill or real outage: promote the secondary to primary
ALTER FAILOVER GROUP fg_analytics PRIMARY;
Replication is supported on every Snowflake Edition for databases and account objects, but failover (the ability to promote a secondary to primary) and client redirect require Business Critical Edition or higher.
Tri-Secret Secure customer-managed keys do not replicate; the secondary account holds its own external key reference.
Apache Iceberg tables that use an external catalog replicate the table metadata but not the underlying Parquet files, which must already be readable from the secondary region's external volume. Sharing interacts with replication in a specific way. A share is itself a replicable object.
When a share is added to a failover group and the secondary is promoted, consumer accounts that read from that share continue to see the same logical share name, provided the consumers have been added to the replicated share or have mounted the share through a listing with auto-fulfillment.
Without replicated shares, a failover would break every downstream consumer until shares were recreated on the new primary, with consumer accounts re-added one by one.
💡 Exam Trap: Replication groups copy databases and account objects; failover groups do everything a replication group does and also permit promotion of a secondary to primary. Replication is available on Standard Edition; failover and client redirect require Business Critical Edition or higher. The exam will pair an account on Enterprise with a failover requirement and expect you to identify the missing edition.
📊 Limit: REPLICATION_SCHEDULE on a failover or replication group is expressed in CRON or interval form. The minimum supported interval is 1 minute, and intervals shorter than the actual snapshot duration cause overlapping refreshes that the scheduler skips automatically.
⚠️ Anti-Pattern: Do not put high-volume transient or temporary tables in a replication group. Transient tables replicate normally but consume secondary storage without any Fail-safe benefit, and the refresh time grows with the change volume. Move high-churn staging tables to a separate database that is excluded from the replication group.
Secure data sharing features
Secure Data Sharing exposes a subset of a provider's databases, schemas, tables, secure views, secure materialized views, secure UDFs, and Apache Iceberg tables to one or more consumer accounts without copying data. The mechanism is metadata-only:
- a share is a named container of grants,
- the provider grants object-level USAGE and SELECT to the share,
- the share is then bound to one or more consumer accounts.
Consumers mount the share as a read-only database in their own account and query it with their own warehouses.
Because the underlying storage stays in the provider account, three economic and operational properties follow.
- First, the consumer never pays for storage on shared data, and the provider never pays for the consumer's compute.
- Second, any insert, update, delete, or DDL on the source object becomes visible to all consumers on the next query, because the share is a metadata pointer rather than a copy.
- Third, the provider can revoke a share or remove an account from a share at any moment, immediately cutting access without leaving copies behind in the consumer's account.
Sharing requires that the provider and consumer accounts live in the same Snowflake region (same cloud and same region code). Cross-region or cross-cloud sharing requires either database replication (so a replica of the database exists in the target region and is shared locally there) or Marketplace listings with auto-fulfillment, which Snowflake handles transparently by replicating the share's backing data into the target region on first request.
Two object types are mandatory for sensitive shares: secure views and secure UDFs.
A standard view exposes its query text and underlying base table names through internal optimizer plans, which a sophisticated consumer can extract through carefully crafted queries that trigger planning errors. A secure view hides the definition and the base table identity. The same logic applies to secure UDFs.
Tables can be shared directly without a secure wrapper, but for any column subsetting, row filtering, or computed projection logic, the share must reference a secure view or a secure materialized view.
-- Provider creates a share, grants metadata to it, and binds it to a consumer account
USE ROLE accountadmin;
CREATE SHARE clinical_share COMMENT = 'De-identified patient analytics';
GRANT USAGE ON DATABASE clinical_db TO SHARE clinical_share;
GRANT USAGE ON SCHEMA clinical_db.public TO SHARE clinical_share;
GRANT SELECT ON VIEW clinical_db.public.v_patient_summary_secure TO SHARE clinical_share;
ALTER SHARE clinical_share ADD ACCOUNTS = ('partner_org.research_lab');
-- Consumer mounts the share as a read-only database
USE ROLE accountadmin;
CREATE DATABASE clinical_from_provider FROM SHARE provider_org.acme_prod.clinical_share;
GRANT IMPORTED PRIVILEGES ON DATABASE clinical_from_provider TO ROLE analyst;
Object support inside a share is a tested topic. Permanent tables, dynamic tables, external tables, Apache Iceberg tables, secure views, secure materialized views, and secure UDFs can all be shared.
Stages, streams, tasks, pipes, sequences, file formats, stored procedures (non-secure), and standard UDFs cannot be shared. Masking policies and row access policies are not added directly to a share; they remain on the underlying object and are evaluated against the consumer's session context (consumer's role, consumer's user) when the consumer queries the shared view or table.
💡 Exam Trap: A share is a metadata container, not a database. The consumer creates a database FROM SHARE; the share itself never appears in INFORMATION_SCHEMA on the consumer side. Granting a share to a role on the provider side has no effect. Shares are only meaningful when bound to accounts through ALTER SHARE ADD ACCOUNTS.
💡 Exam Trap: Standard views inside a share expose the view definition through metadata. For any logic that filters rows, masks columns, or hides base table identity, the share must reference a secure view or a secure materialized view. The exam will offer a standard view in a share and ask why the consumer can infer base table names.
🎯 Scenario: A provider in the AWS us-east-1 region adds an account from Azure West Europe to a share. The ALTER SHARE statement returns successfully, but the consumer cannot create the database from the share. Why? Direct sharing requires the same region and cloud. The provider must either replicate the database to Azure West Europe and create a share there, or publish a Marketplace listing with auto-fulfillment enabled for the target region.
Cloning
Cloning, formally CLONE in DDL and zero-copy cloning in marketing terms, creates an instant logical copy of a database, schema, or table by pointing new metadata at the same micro-partitions. No bytes are copied.
The clone is fully writable; subsequent inserts, updates, and deletes in the clone allocate new micro-partitions that belong only to the clone, while the source retains its own partition set.
The provider pays storage only for divergent partitions, which makes cloning the default mechanism for development and test environments, schema migration rehearsals, and recovery-as-clone workflows.
A clone can be taken at the current time or at any point inside the source object's Time Travel window.
The AT and BEFORE clauses target a timestamp, a query ID, or a relative offset.
This pattern is the standard answer to "give me yesterday's production database to debug a regression," because the resulting clone is a fully independent writable copy that does not affect the source.
-- Clone the production database to a snapshot from one day ago
CREATE DATABASE sales_debug
CLONE sales_prod
AT (OFFSET => -60 * 60 * 24);
-- Clone a single schema right before a specific query that corrupted data
CREATE SCHEMA sales_prod.fix_attempt
CLONE sales_prod.public
BEFORE (STATEMENT => '01abcdef-0000-1234-5678-0000abcdef00');
-- Clone a single table at a specific timestamp inside the retention window
CREATE TABLE sales_prod.public.orders_snapshot
CLONE sales_prod.public.orders
AT (TIMESTAMP => '2099-01-15 09:00:00.000'::TIMESTAMP_NTZ);
Key points
Several object categories do not clone the way one might expect.
- Internal stages, external stages, pipes, and load history are excluded from a database clone.
- Privileges on the source object are not copied to the clone; the cloning role becomes the owner of the new object and must re-grant access to other roles.
- Tags and policies attached through tag-based masking carry over by reference, so a cloned table remains subject to the same masking policy unless the clone is explicitly altered.
- Streams pointing at a source table do not follow into the clone; the clone is a new object and any stream on the clone must be created separately.
- Tasks inside a cloned database are cloned in a suspended state and must be resumed explicitly.
A clone inherits Time Travel and Fail-safe behavior independently of the source. The clone's data retention starts from the clone creation moment for partitions that diverge from the source. Shared partitions still rely on the source's continued existence for storage accounting, but Snowflake's metadata treats them as logically shared, so dropping the source does not destroy the clone; the clone retains its own pointer set to the underlying partitions until they are no longer referenced by any object.
Cloning is also the safest pattern for high-risk schema migrations and rebuild operations. Cloning the target database, applying the migration script to the clone, validating downstream queries against the clone, then swapping references through a view layer keeps the source production database untouched. If the migration fails, the clone is dropped and no data was ever at risk.
💡 Exam Trap: Cloning is zero-copy, but it is not free. Storage cost equals shared partitions (counted once) plus diverged partitions. A clone of a 100 TB table that gets fully rewritten through an UPDATE becomes a 200 TB billable footprint over time. Exam scenarios will use heavy UPDATE patterns to highlight this growth.
📊 Limit: Cloning is supported for databases, schemas, and tables (permanent, transient, and temporary). External tables with mutable file paths and catalog-linked Apache Iceberg tables that point at external catalogs cannot be cloned in the same zero-copy way; only Snowflake-managed objects participate in full zero-copy semantics.
⚠️ Anti-Pattern: Treating cloning as a backup strategy without a recurring schedule. A clone is a point-in-time snapshot, not a backup. If the clone is dropped after testing, no data protection beyond Time Travel and Fail-safe remains. Production data protection should rely on Time Travel retention plus replication, with clones used for ad-hoc snapshots only.
Time Travel
Time Travel was introduced in Chapter 1 as the mechanism that retains historical versions of permanent and transient tables for a configurable retention period.
Inside the collaboration and protection model, Time Travel is the first line of defense for self-service recovery.
The DATA_RETENTION_TIME_IN_DAYS parameter sets the retention window:
- 0 to 1 day on Standard Edition
- 0 to 90 days on Enterprise Edition and higher
Permanent tables default to 1 day; transient and temporary tables can only be set to 0 or 1 day even on Enterprise. Three SQL clauses surface Time Travel to users.
- AT, BEFORE, and CHANGES query the table at a historic point.
- UNDROP restores a dropped database, schema, or table whose retention window has not yet expired.
- CLONE ... AT or BEFORE produces the clone described in the previous subsection at a historical moment.
-- Inspect the table state ten minutes ago
SELECT * FROM orders AT (OFFSET => -60 * 10);
-- Recover a dropped table inside its retention window
UNDROP TABLE orders;
-- Show only the inserts and deletes that happened between two timestamps
SELECT * FROM orders
CHANGES(INFORMATION => DEFAULT)
AT (TIMESTAMP => '2099-03-01 00:00:00')
END (TIMESTAMP => '2099-03-01 12:00:00');
Time Travel for shared data has a specific behavior. The provider's table retains its Time Travel history, but the consumer cannot use AT or BEFORE clauses through the share unless the provider exposed a secure view that already encodes the historical query (for example, a view that selects FROM the base table AT (OFFSET => -60 * 60 * 24)). Time Travel on the consumer side is limited to the share's own metadata changes, not the underlying object content. This is why production sharing patterns publish curated snapshot views rather than live tables when historical access is part of the contract.
Setting DATA_RETENTION_TIME_IN_DAYS to 0 disables Time Travel for that object.
- UNDROP no longer works.
- AT and BEFORE queries fail.
- The object moves directly from drop to Fail-safe (for permanent tables) or to immediate purge (for transient and temporary tables).
The parameter cascades from account to database to schema to table, with the most specific setting winning, so a production database can keep 30 days of retention while a staging schema inside that database overrides to 1 day for cost control.
Time Travel storage cost is metered as historical bytes held during the retention window. Frequently updated tables produce many micro-partition versions, all of which survive in Time Travel until they age out. The ACCOUNT_USAGE.DATABASE_STORAGE_USAGE_HISTORY view exposes the TIME_TRAVEL_BYTES column for this reason; large values often indicate that retention is set higher than the team actually requires.
💡 Exam Trap: Transient and temporary tables cannot use Time Travel beyond 1 day, even on Enterprise Edition. The exam will offer a 90-day retention on a transient table as a distractor. Only permanent tables on Enterprise Edition or higher can extend retention to 90 days.
📊 Limit: DATA_RETENTION_TIME_IN_DAYS is 0 to 1 on Standard Edition and 0 to 90 on Enterprise Edition and higher. Increasing the retention does not retroactively recover data; the new value applies only to versions created after the change. Decreasing the retention causes versions older than the new value to begin moving to Fail-safe immediately.
⚠️ Anti-Pattern: Setting DATA_RETENTION_TIME_IN_DAYS = 0 on permanent production tables to reduce storage cost. This eliminates self-service recovery and pushes every restore through Fail-safe, which requires a Snowflake Support ticket and is not guaranteed to be instant. The storage savings are usually small compared to the operational risk.
Fail-safe
Fail-safe is the seven-day window that follows Time Travel on permanent tables. It is non-configurable, non-queryable by customers, and is the last line of defense against catastrophic data loss.
Only Snowflake Support can initiate a Fail-safe recovery, and the operation typically takes hours rather than seconds.
Fail-safe is not a backup product and is not designed for routine restores; it exists to handle scenarios where Time Travel was insufficient and no other recovery mechanism (clone, replication target, external backup) is available. Fail-safe applies only to permanent tables.
Transient tables and temporary tables have no Fail-safe at all; once their Time Travel window (0 or 1 day) expires, their data is gone with no recovery path. This is the central reason to think carefully about table type when storing ingest-ready landing data. Saving storage cost by marking a table transient also removes a week of recovery capacity.
Storage cost for Fail-safe is billed at the standard storage rate and shows up in the FAILSAFE_BYTES column of ACCOUNT_USAGE.DATABASE_STORAGE_USAGE_HISTORY.
Heavy churn tables can accumulate large Fail-safe footprints, particularly when frequent rewrites generate many micro-partition versions that flow through Time Travel and into Fail-safe.
The Fail-safe billing surface is the operational lever for shaping recovery cost:
- shorten Time Travel where appropriate,
- switch low-value tables to transient where Fail-safe is not needed,
- consolidate small frequent writes into larger batched writes to reduce partition turnover.
-- Inspect Fail-safe storage by database over the last 30 days
SELECT
database_name,
AVG(failsafe_bytes) / POWER(1024, 3) AS avg_failsafe_gb
FROM snowflake.account_usage.database_storage_usage_history
WHERE usage_date >= DATEADD('day', -30, CURRENT_DATE)
GROUP BY database_name
ORDER BY avg_failsafe_gb DESC;
The combined storage timeline of an object goes: active (current micro-partitions), then Time Travel (historical partitions for the retention window), then Fail-safe (7 days, permanent tables only), then purged. The flow is deterministic and there is no way to extend Fail-safe, shorten it, or query inside it from the customer side.
Even ACCOUNTADMIN cannot inspect Fail-safe content directly; the only interaction is opening a Snowflake Support case that names the object and the recovery point.
Decision Anchor: choosing the right protection mechanism
When to use
- Choose Time Travel when the recovery target is inside the configured retention window and the object is permanent or transient with 1-day retention.
- Choose Fail-safe (through a Snowflake Support ticket) when Time Travel has expired and the object was permanent.
- Choose cloning when an immediate writable copy at a historical point is required and the source object still exists.
- Choose replication and failover when the recovery scenario is regional or cross-cloud and applications must continue serving requests from a second account.
Diagram: lifecycle of a permanent table's storage
💡 Exam Trap: Fail-safe is 7 days, non-configurable, and only for permanent tables. Transient and temporary tables have no Fail-safe. The exam will offer "extend Fail-safe to 14 days" or "Fail-safe applies to transient tables" as distractors.
📊 Limit: Fail-safe storage is billed at the same rate as active storage and is not negotiable. The only way to reduce Fail-safe cost is to reduce the change volume of permanent tables or to convert low-value tables to the transient type.
⚠️ Anti-Pattern: Designing recovery procedures around Fail-safe. Snowflake Support honors Fail-safe requests on a best-effort basis and turnaround is measured in hours. Production restore plans should rely on Time Travel, clones, and replication targets first, with Fail-safe reserved for "everything else failed" outcomes.
