RESTORE … SNAPSHOT

Restore a cluster, account, database, or table from an existing valid Snapshot. Restoration changes target state: confirm scope and coordinate writes. SQL Snapshots depend on retained primary-storage objects, not independent physical DR copies.

v4.2.5 syntax

RESTORE CLUSTER {SNAPSHOT = '<snapshot_name>'};
RESTORE ACCOUNT <account_name> {SNAPSHOT = '<snapshot_name>'}
    [TO ACCOUNT <target_account_name>];
RESTORE DATABASE [<account_name>.]<database_name> {SNAPSHOT = '<snapshot_name>'}
    [TO ACCOUNT <target_account_name>];
RESTORE TABLE [<account_name>.]<database_name>.<table_name> {SNAPSHOT = '<snapshot_name>'}
    [TO ACCOUNT <target_account_name>];
  • Use the brace snapshot clause. The v4.2.5 probe rejected RESTORE DATABASE ... FROM SNAPSHOT ...; do not copy that form from another version.

  • Database/table scopes can qualify the source account with dot notation; omission uses the current account. Do not use RESTORE ACCOUNT ... DATABASE ... TABLE ....

  • TO ACCOUNT identifies a target account, not a new database name. Cross-account operations require system-account privileges and version-specific rules. This page verifies only a temporary database in the same account.

  • Check the existing snapshot’s scope, SHOW SNAPSHOTS, target, version, and privileges. Cluster/account restoration can affect many objects: drill in isolation rather than executing tutorial recovery on production.

Runnable temporary-database experiment

Run on an independent test instance with unused names. Write 42, snapshot, change to 99, and restore to 42. Cleanup affects only the example snapshot/database.

CREATE DATABASE mo_snapshot_reference_lab;
USE mo_snapshot_reference_lab;
CREATE TABLE ledger(id INT PRIMARY KEY, amount INT);
INSERT INTO ledger VALUES(1,42);
CREATE SNAPSHOT mo_snapshot_reference_snap FOR DATABASE mo_snapshot_reference_lab;
SHOW SNAPSHOTS;
UPDATE ledger SET amount=99 WHERE id=1;
-- Expected-Value: 99
SELECT amount FROM ledger WHERE id=1;
RESTORE DATABASE mo_snapshot_reference_lab {SNAPSHOT='mo_snapshot_reference_snap'};
-- Expected-Value: 42
SELECT amount FROM mo_snapshot_reference_lab.ledger WHERE id=1;
DROP SNAPSHOT mo_snapshot_reference_snap;
DROP DATABASE mo_snapshot_reference_lab;

Verified on 2026-10-14 against single-CN 8.0.30-MatrixOne-v4.2.5 with a system test account. Do not validate only the database name: check key rows, counts, aggregates, watermarks, privileges, and external dependencies. See recovery drills for failure selection, independent targets, and RPO/RTO records.

Repeatable restore and authorization

A restore can be repeated with the same snapshot. For account restore, restored grants refer to the target account’s logical table IDs, including after TRUNCATE. A database or table restore keeps the target’s current grants rather than replacing them with grants from the snapshot. A failed CREATE DATABASE ... CLONE authorization check leaves no empty target database. Cloning requires permission to create the target and to read the source. After full account restore, an old target administrator identity must reconnect; other sessions remain usable.

Boundaries

Stop or coordinate target writes, retain source data/configuration, and avoid clearing shared storage. Snapshot restoration does not downgrade binaries, catalog migrations, or file formats and does not establish that old binaries can read newer data. Cross-version, cross-account, and cluster restoration need separate verification.