Data Protection & Data Sharing
How Snowflake recovers from mistakes, survives regional outages, and shares live data with other accounts without ever copying it. Two chapters: continuous data protection (Time Travel, Fail-safe, cloning, replication), then secure sharing and the Marketplace.
Domain 5 is only 10%, but data protection comes up across the other domains too, so this part earns more than its weight. Most mistakes are about who may do what: Fail-safe reachable only through Support, consumers strictly read-only, reader accounts billed to the provider, and the list of things a clone doesn't carry (load history, grants on the cloned database or schema itself, internal named stages). Watch for invented commands too: RESTORE SCHEMA sounds right and doesn't exist; UNDROP does.
Continuous Data Protection
Four features, one underlying mechanism from Part 1: micro-partitions are immutable, so old versions can be kept around and pointed back to. Time Travel, Fail-safe, and zero-copy cloning are three different ways of exploiting that one fact.
Time Travel
Time Travel lets you query, clone, or restore data as it existed at any point within a configurable retention window, by keeping the old micro-partitions a change would otherwise discard. It covers tables, schemas, and databases.
Retention by edition
| Edition | Default retention | Configurable range |
|---|---|---|
| Standard | 1 day | 0 or 1 day |
| Enterprise and above | 1 day | 0 to 90 days (permanent tables only) |
Retention is controlled by DATA_RETENTION_TIME_IN_DAYS, settable at account, database, schema, or table level, with the more specific level winning. An account-level MIN_ acts as a floor: if it's set to 5 and a table tries to set 2, the effective retention is 5, the higher of the two. The effective retention can never dip below the account minimum. The account minimum applies to every object, old or new: Snowflake uses the higher of the two numbers and leaves the table's own setting as written. Retention 0 turns Time Travel off: changed data in a permanent table goes straight to Fail-safe, and in a transient table it's deleted. Raising retention keeps data already in Time Travel for longer. Lowering it moves older history out of Time Travel, into Fail-safe on permanent tables, and the 7 days of Fail-safe start when the data leaves Time Travel.
Three ways to query the past, plus UNDROP to bring back a dropped object
Every Time Travel recovery uses one of four constructs. Learn the mapping, not just the syntax:
| Clause | What it gives you | Reach for it when |
|---|---|---|
AT (TIMESTAMP => ...) | The table exactly as it was at a wall-clock moment | You know when things were still good |
AT (OFFSET => -3600) | The table N seconds ago, relative to now | "About an hour ago" is precise enough |
BEFORE (STATEMENT => '<query_ | The table one instant before a specific statement ran | Recovering from a bad DML whose query ID you have; the surgical option |
UNDROP TABLE / SCHEMA / DATABASE | A dropped object back in place, children included | The object is gone entirely, not just its rows |
UNDROP restores an entire dropped table, schema, or database, along with every child object, in a single operation, as long as it's still inside the retention window and no object of the same name already occupies that spot (rename or drop the conflicting object first).
The syntax, all of it
-- Query the past three waysSELECT * FROM orders AT (TIMESTAMP => '2026-07-01 08:00:00':: TIMESTAMP_ TZ); SELECT * FROM orders AT (OFFSET => -3600); -- one hour agoSELECT * FROM orders BEFORE (STATEMENT => '<query_id>' ); -- just before that DML-- Recover: clone the past, or resurrect the droppedCREATE TABLE orders_before_ bug CLONE orders AT (OFFSET => -3600); UNDROP TABLE orders;-- Configure retention (Enterprise permanent tables: up to 90)ALTER TABLE orders SET DATA_RETENTION_ TIME_ IN_ DAYS = 30;
AT includes changes up to and including the moment given; BEFORE stops just short of the named statement, which makes BEFORE(STATEMENT) the precise tool after a bad DML: Safia deletes the wrong payroll rows, Thomas grabs the query ID from history, and the table one instant before her statement is a single clone away.
User A runs CREATE OR REPLACE SCHEMA ... CLONE, which drops the schema User B was working in and puts the clone under its name, within the Time Travel window. The fix is not a fresh CREATE TABLE AS SELECT, and not contacting Support. Rename the offending clone to free up the name, then UNDROP SCHEMA the original. Practice this one until the fix is automatic.

