CertSafari
    Snowflake SnowPro Advanced: Data Engineer (DEA-C02)· Lessons

    Domain 3 · Lesson 13/22

    Zero-copy cloning for dev environments, promotion and rollback

    Use Time Travel and cloning to create new development environments.

    20 min read
    4.67% of exam
    3 sources
    Published 20 Oct 2026
    Docs as of 18 Oct 2026

    What you will be able to do

    • Create zero-copy clones of databases, schemas and tables, and explain how clone storage diverges from the source over time
    • Predict the state of tasks, pipes, alerts, streams, stages and clustering in a fresh clone, and what to resume before testing
    • Work out which grants a cloned database, schema or table keeps, and when COPY GRANTS applies
    • Build a development or rollback copy from a past state with CREATE … CLONE … AT | BEFORE
    • Validate changes in a clone, promote them atomically, and choose between UNDROP and a point-in-time clone to roll back

    Key concept

    Zero-copy clone — A clone is a new, writable object that starts out pointing at the same stored data as its source. It costs no extra storage until someone changes data in the clone, and from then on only the changed data is stored separately.

    1.Cloning a database, schema or table

    A development environment is only useful if it looks like production, and copying production row by row is slow and expensive. Snowflake's answer is CREATE <object> … CLONE. It is a variant of the usual CREATE command with the CLONE keyword added, and it is mainly used to make zero-copy clones of databases, schemas and tables. One statement such as CREATE DATABASE dev_db CLONE prod_db; gives analysts a full-size copy of a 40 TB production database to test against. No export, no reload, and no second 40 TB of storage on day one.

    Clone syntax for databases and schemas, including the optional Time Travel and child-object clausessql
    CREATE [ OR REPLACE ] { DATABASE | SCHEMA } [ IF NOT EXISTS ] <object_name>
      CLONE <source_object_name>
        [ { AT | BEFORE } ( { TIMESTAMP => <timestamp> | OFFSET => <time_difference> | STATEMENT => <id> } ) ]
        [ IGNORE TABLES WITH INSUFFICIENT DATA RETENTION ]
        [ IGNORE HYBRID TABLES ]
        [ INCLUDE INTERNAL STAGES ]

    Storage starts out shared and splits apart only when something changes. A new clone adds nothing to storage. That changes once the clone is modified: rows added, deleted or updated in a cloned table, or a new populated table created in a cloned schema. So a regression-test schema cloned six weeks ago can show growing table sizes while the source stays flat. The growth is real. It is the new data written by DML against the clone, and the micro-partitions both objects still share are not counted twice. Changes go in neither direction: edits to the source never show up in the clone, and edits to the clone never show up in the source.

    Cloning a database or schema is recursive. A database clone includes every schema and every object inside it. A schema clone includes everything in that schema. There are limits. The clone holds only the objects the cloning role has the right privileges on. External tables are never cloned. Hybrid tables can be cloned with a database but not with a schema. To clone at all, the role needs USAGE on a source database, SELECT on a source table, and OWNERSHIP on any alerts, pipes, streams and tasks it clones. External stages are cloned too, but a clone of an external stage has no effect on the bucket or container it points to.

    Permission inheritance in a clone depends on which level you clone. When the source is a database or schema, the clone inherits all granted privileges on the clones of the child objects inside it, so a table that a role could read in prod_db is still readable by that role in the clone, provided the role can reach it. The cloned container is the exception: the new database or schema does not inherit the privileges granted on the source container, and access to it must be granted again. A table cloned on its own inherits no explicit privileges unless COPY GRANTS is specified.

    Checkpoint 1 of 9· Fill the gap

    Your team needs a writable, full-size copy of a 40 TB production database for testing. It must not add another 40 TB of storage on day one. Which keyword completes the syntax?

    CREATE [ OR REPLACE ] { DATABASE | SCHEMA } [ IF NOT EXISTS ] <object_name>
       ?  <source_object_name>
        [ { AT | BEFORE } ( { TIMESTAMP => <timestamp> | OFFSET => <time_difference> | STATEMENT => <id> } ) ]
        [ IGNORE TABLES WITH INSUFFICIENT DATA RETENTION ]
        [ IGNORE HYBRID TABLES ]
        [ INCLUDE INTERNAL STAGES ]

    Checkpoint 2 of 9· Exam question

    A data engineering team wants to spin up a full-size copy of a 40 TB production database for analysts to test transformation logic against realistic data, without waiting for a bulk export/import and without doubling storage costs on day one. Which approach satisfies this requirement?

    Checkpoint 3 of 9· Exam question

    Six weeks after a schema was cloned for regression testing, the clone's table sizes in TABLE_STORAGE_METRICS have grown even though the original schema's size stayed flat. Which explanation matches how Zero-Copy Cloning charges for storage over time?

    Sources12

    2.What arrives in the clone, and in what state

    A clone copies the data, but anything that acts on its own schedule arrives switched off. Automated objects come over inactive, so a copy of production cannot start loading files, firing alerts or running schedules unnoticed. Some state is not carried over at all: load history, unconsumed stream records and files in table stages. Before you test a pipeline in a clone, check each object in this table.

    State of each object type right after a database or schema clone
    ObjectState in the cloneTo make it active or correct
    TaskSuspended by defaultALTER TASK … RESUME, one task at a time
    Pipe, AUTO_INGEST = FALSEPaused by defaultALTER PIPE … RESUME
    Pipe, AUTO_INGEST = TRUESTOPPED_CLONED: does not collect event notificationsALTER PIPE … RESUME; after that it processes only new notifications
    AlertSuspended by defaultALTER ALERT … RESUME
    StreamUnconsumed records are inaccessibleNothing to resume; the stream starts from the clone's history
    Table with a clustering keyKey is kept; Automatic Clustering is suspendedALTER TABLE <name> RESUME RECLUSTER
    Table stageCloned empty; files are not copiedRestage any files you need
    Internal named stageCloned only with INCLUDE INTERNAL STAGESFiles are copied only for stages with a directory table
    Sequence used as a column defaultCloned sequence if the same clone includes it; otherwise the source sequenceALTER TABLE <table_name> ALTER COLUMN <column_name> SET DEFAULT <new_sequence>.nextval

    Two of these rows can cost you money or cause bad data in production. First, a cloned table does not get the source table's load history. Files already loaded into production can therefore be loaded again into the clone, and the clone will not skip them. Second, a cloned table with a clustering key keeps the key, but Automatic Clustering starts out suspended even if it runs on the source. A dev copy of a clustered events table therefore does not recluster until someone runs RESUME RECLUSTER. Object parameters set on the source also carry over to the clone, so a table with a long data retention setting keeps it in the dev copy.

    Checkpoint 4 of 9· Check yourself

    A production schema has a Snowpipe with AUTO_INGEST = TRUE. You clone the schema for testing. New files land in the stage over the next two days, and then an engineer runs ALTER PIPE … RESUME on the cloned pipe. What does the cloned pipe load?

    Sources21

    3.Which grants a clone keeps

    When you clone a database or schema, the objects inside keep their grants, but the cloned database or schema itself gets none. Every child object (schemas in a database; tables and views in a schema) is cloned with all the privileges granted on its source. The new database or schema does not get the privileges granted on the source container. Pipes are an exception: the role that created the clone owns the cloned pipes.

    Cloning a single table works differently, and COPY GRANTS controls what happens. Most CREATE … CLONE statements do not copy the source object's grants. CREATE TABLE … CLONE supports COPY GRANTS, though. With COPY GRANTS, the clone gets every explicit privilege on the source except OWNERSHIP, but no future grants defined in the schema. Without it, the clone gets no explicit privileges from the source but does pick up the schema's future grants. Grants that end up missing are added with GRANT <privileges> … TO ROLE.

    Where a cloned object's privileges come from
    How the clone is createdPrivileges on the clone
    Child object inside a cloned database or schemaAll privileges granted on the source child object
    The cloned database or schema itselfNone from the source container
    CREATE TABLE … CLONE without COPY GRANTSFuture grants for tables in the schema; no explicit grants from the source
    CREATE TABLE … CLONE with COPY GRANTSExplicit grants from the source except OWNERSHIP; no future grants
    CREATE OR REPLACE TABLE … CLONE … COPY GRANTS over an existing nameGrants copied from the table being replaced
    Cloned pipeOWNERSHIP held by the role that created the clone

    The last COPY GRANTS row matters when you promote a change. If the statement replaces an existing table with the same name, the grants come from the table being replaced, not from the clone source. Replacing a production table with a tested dev clone therefore keeps production's grants, not the dev environment's.

    Checkpoint 5 of 9· Check yourself

    During promotion, an engineer runs CREATE OR REPLACE TABLE prod_db.sales.orders CLONE dev_db.sales.orders COPY GRANTS. In dev, only DEV_ENGINEER has SELECT on the table. In production, REPORTING and FINANCE have SELECT on the existing orders table. After the statement runs, which explicit grants are on prod_db.sales.orders?

    Sources21

    4.Cloning a past state with AT | BEFORE

    Adding Time Travel (retention period and AT | BEFORE) to a clone gives you a copy of an object as it was at an earlier point, not as it is now. Time Travel keeps changed and deleted data for the object's retention period. On Enterprise Edition, permanent tables, schemas and databases can keep it for up to 90 days. For databases, schemas and non-temporary tables, CLONE accepts AT | BEFORE with a TIMESTAMP, an OFFSET in seconds or a STATEMENT query ID. BEFORE(STATEMENT => id) gives the state just before that statement's changes, which is how you build a rollback copy from before a bad load. The query ID has to be from the last 14 days.

    For a database or schema clone, the shortest retention period among its tables limits how far back you can go. Say database db1 keeps seven days of history but its table t1 keeps only one. Cloning db1 as of 12 hours ago works. Cloning it as of two days ago fails, because t1's history from that point is already gone. IGNORE TABLES WITH INSUFFICIENT DATA RETENTION skips those tables so that the rest of the clone still succeeds.

    Clone a database as it was four days ago, skipping tables whose history no longer reaches back that farsql
    CREATE DATABASE restored_db CLONE my_db AT(TIMESTAMP => DATEADD(days, -4, current_timestamp)::timestamp_tz) IGNORE TABLES WITH INSUFFICIENT DATA RETENTION;

    A point-in-time clone takes the data as it was then, but not every other part of the object. Its name and structure come from the chosen point. Other metadata, such as comments and clustering keys, comes from the source as it is when the statement runs. Internal stages are cloned in their current state even when you use Time Travel. Tasks are not cloned at all when you run CREATE SCHEMA … CLONE with a timestamp. Child objects that did not exist yet at that point are left out. Cloning an object as of a time before it existed returns an error.

    Even a clone without AT uses Time Travel. Snowflake sets the AT point to the moment the statement started, so a long clone stays consistent. If DML hits a source table with retention set to 0 while the clone is running, the data the clone needs may already be purged, and the clone fails with Data is not available. Avoid DML on the source until the clone finishes. If you can't, set DATA_RETENTION_TIME_IN_DAYS=1 on the tables first. Also avoid renaming a table to the name of a just-dropped table during a clone, because that causes name conflicts.

    Checkpoint 6 of 9· Fill the gap

    A bad load four days ago corrupted my_db. You want a rollback copy from before it. Some transient tables in my_db keep only one day of history, and the clone must still succeed. The value you are passing is a calculated date and time, not a number of seconds or a query ID. Which parameter completes the AT clause?

    CREATE DATABASE restored_db CLONE my_db AT( ?  => DATEADD(days, -4, current_timestamp)::timestamp_tz) IGNORE TABLES WITH INSUFFICIENT DATA RETENTION;

    Sources321

    5.Validating in a clone and promoting the result

    A clone is a safe place to test because it is writable and independent of its source. You can run a breaking migration script against CREATE DATABASE dev_db CLONE prod_db, resume the cloned tasks one at a time, and check how downstream views and tasks behave. None of it touches production data. The independence has limits, though, and the risks come from references that point back to production.

    Check these references before you trust a test run in a clone:

    • Pipes: when a file lands in a stage location, every pipe that matches that location gets the notification. If the COPY statement in a pipe uses a fully qualified table name, Snowpipe loads duplicate data into that production table for each pipe. Pipes that use unqualified names load into the table in each database instead.
    • Sequences: a table cloned by itself still takes default values from the source sequence, so test inserts use up production sequence numbers until you change the column default.
    • Foreign keys: a table whose primary-key table was not cloned with it still references the source table's primary key.
    • Load history: files already loaded into production can be loaded again into the clone, so a test load may not match what production would do.

    Once a change has passed in the clone, you can promote it atomically. CREATE OR REPLACE statements are atomic: Snowflake deletes the old object and creates the new one in a single transaction. Readers therefore never see a moment when the table is missing. CREATE OR REPLACE TABLE prod.sales.orders CLONE dev.sales.orders COPY GRANTS puts the tested table in production's place without copying any data. Because it replaces an existing name, it keeps the production table's grants.

    Checkpoint 7 of 9· Check yourself

    Tomorrow you will promote a tested table with CREATE OR REPLACE TABLE prod.sales.orders CLONE dev.sales.orders COPY GRANTS. If the change goes wrong, you must be able to roll back to today's production data, and the rollback copy should add no storage until the tables diverge. What should you do?

    Sources12

    6.Rolling back: UNDROP or a point-in-time clone

    The right rollback depends on what went wrong. If the object was dropped, use UNDROP. If the object still exists but its data is wrong, use a point-in-time clone. UNDROP brings back the original object in place, in its most recent state before the DROP. It does not create a new object, and it fails if an object with that name already exists. When a replacement table now has the name, rename the replacement first, then UNDROP. Creating a new table with the old name does not restore anything. It adds another version, and the dropped one can still be restored.

    A point-in-time clone is the tool when the object still exists and the problem is in its data. Examples are a bad MERGE or a promoted transformation that wrote wrong values. Clone the object as it was before the faulty statement, check the result, then promote it with CREATE OR REPLACE … CLONE. Unlike UNDROP, you pick the exact point to return to, and you can inspect the result before it replaces anything. Remember the limit from cloning: the source object must have existed at that point. A table created by the promotion has no history before the promotion. To go back past that point, use the backup clone or the dropped version.

    Clone a whole database as it was just before a specific statement ransql
    CREATE DATABASE restored_db CLONE my_db BEFORE(STATEMENT => '8e5d0ca9-005e-44e6-b858-a8f5b37c5726');
    Choosing a rollback path
    SituationRollbackConstraint
    Table or schema was droppedUNDROP TABLE / UNDROP SCHEMARename any object now using the name first; needs OWNERSHIP plus CREATE privilege in the container
    Bad DML inside an existing tableCREATE TABLE … CLONE … BEFORE(STATEMENT => id), then CREATE OR REPLACE to promotePoint must be inside retention; STATEMENT ID from the last 14 days
    Bad promotion replaced the tableCREATE OR REPLACE … CLONE from a pre-promotion backup cloneThe new table's history begins at the promotion
    Change is older than the retention periodNone you can run yourselfData is in Fail-safe; only Snowflake can recover it

    Self-service recovery ends when the retention period ends. After that, past objects can no longer be cloned or undropped. The data moves into Fail-safe for 7 days, and only Snowflake can recover it. Take a table with a one-day retention period whose critical row was deleted four days ago. The team has no clone and no UNDROP that can reach that row. Each change gets its own deadline, the time of the change plus the retention period, so set the retention period with your rollback window in mind.

    Checkpoint 8 of 9· Match them up

    Each incident needs a different way back. Match each situation to the rollback that works for it.

    Tap a term, then the definition that fits it.

    Checkpoint 9 of 9· Exam question

    On a Snowflake account running Enterprise Edition, what is the maximum value that can be configured for DATA_RETENTION_TIME_IN_DAYS on a permanent table?

    Sources32

    Sources

    (3)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “This command is primarily used for creating zero-copy clones of databases, schemas, and tables.”
      ↩︎ Cloning a database, schema or table
      “Adding, deleting, or modifying rows in a cloned table.”
      ↩︎ Cloning a database, schema or table
      “Cloning includes only the objects on which the role that creates the clone has appropriate privileges.”
      ↩︎ Cloning a database, schema or table
      “A cloned table does not include the load history of the source table.”
      ↩︎ What arrives in the clone, and in what state
      “does not inherit any future grants defined for the object type in the schema”
      ↩︎ Which grants a clone keeps
      “If the statement is replacing an existing table of the same name, then the grants are copied from the table being replaced.”
      ↩︎ Which grants a clone keeps
      “Snowflake makes clones of internal stages in their current state, regardless of whether your CREATE CLONE statement uses Time Travel”
      ↩︎ Cloning a past state with AT | BEFORE
      “A clone is writable and is independent of its source.”
      ↩︎ Validating in a clone and promoting the result
      “when an object is replaced, the old object is deleted and the new object is created in a single transaction.”
      ↩︎ Validating in a clone and promoting the result
      “a clone does not contribute to the overall data storage for the object until operations are performed on the clone”
      ↩︎ Key concept
      “a clone does not contribute to the overall data storage for the object until operations are performed on the clone”
      ↩︎ Exam trap 1
    2. 2.
      “cloning an external stage has no impact on the referenced cloud storage.”
      ↩︎ Cloning a database, schema or table
      “Cloning is fast, but not instantaneous, particularly for large objects”
      ↩︎ Cloning a database, schema or table
      “the clone inherits all granted privileges on the clones of all child objects contained in the source object”
      ↩︎ Cloning a database, schema or table
      “The clone of the container itself (database or schema) doesn’t inherit the privileges granted on the source container.”
      ↩︎ Cloning a database, schema or table
      “When AUTO_INGEST = TRUE, a cloned pipe is set to the STOPPED_CLONED state.”
      ↩︎ What arrives in the clone, and in what state
      “By default, Automatic Clustering is suspended for the new table.”
      ↩︎ What arrives in the clone, and in what state
      “the clone inherits all granted privileges on the clones of all child objects contained in the source object”
      ↩︎ Which grants a clone keeps
      “For pipes, the role that creates the clone has the OWNERSHIP privilege on the pipes.”
      ↩︎ Which grants a clone keeps
      “inherits any other metadata, such as comments or table clustering keys, that is current in the source object”
      ↩︎ Cloning a past state with AT | BEFORE
      “the cloning operation internally sets the AT clause value as the timestamp when the statement was initiated.”
      ↩︎ Cloning a past state with AT | BEFORE
      “Snowpipe loads duplicate data into the source table”
      ↩︎ Validating in a clone and promoting the result
      “If a table is cloned, historical data for the table clone begins at the time/point when the clone was created.”
      ↩︎ Validating in a clone and promoting the result
      “If the source object didn’t exist at the time/point set in the AT | BEFORE clause, an error is returned.”
      ↩︎ Rolling back: UNDROP or a point-in-time clone
      “When AUTO_INGEST = TRUE, a cloned pipe is set to the STOPPED_CLONED state.”
      ↩︎ Exam trap 2
      “The clone of the container itself (database or schema) doesn’t inherit the privileges granted on the source container.”
      ↩︎ Exam trap 3
      “When a database or schema that contains tasks is cloned, the tasks in the clone are suspended by default.”
      ↩︎ Prediction
      “When a pipe is explicitly resumed, it only processes data files triggered as a result of new event notifications.”
      ↩︎ Checkpoint
    3. 3.
      “For permanent databases, schemas, and tables, the retention period can be set to any value from 0 up to 90 days.”
      ↩︎ Cloning a past state with AT | BEFORE
      “Calling UNDROP restores the object to its most recent state before the DROP command was issued.”
      ↩︎ Rolling back: UNDROP or a point-in-time clone
      “If an object with the same name already exists, UNDROP fails.”
      ↩︎ Rolling back: UNDROP or a point-in-time clone
      “Past objects can no longer be cloned.”
      ↩︎ Rolling back: UNDROP or a point-in-time clone
      “During that time, only Snowflake can recover it.”
      ↩︎ Rolling back: UNDROP or a point-in-time clone
      “After dropping an object, creating an object with the same name does not restore the object.”
      ↩︎ Exam trap 4
      “If an object with the same name already exists, UNDROP fails. You must rename the existing object”
      ↩︎ Checkpoint

    Spotted a mistake, or was something unclear? Tell us.