Outdated Version

You are viewing an older version of this section. View current production version.


Restore data from a binary backup file.


RESTORE [DATABASE] db_name FROM "backup_path"


  • db_name is the name of a MemSQL database.
  • backup_path is the path used in BACKUP .
  • If you wish to restore the backup into a differently named database, you can do so by specifying the full path to the .backup file in backup_path. For example, you can do BACKUP DATABASE db TO './path/' followed by RESTORE DATABASE newdb FROM './path/db.backup'
  • The RESTORE command replays a binary backup file in the same manner in which MemSQL recovers a database snapshot during startup.
  • A RESTORE operation temporarily puts the database being restored into the recovering snapshot state. A database in this state cannot be queried. When the RESTORE command finishes, it puts the database into the online state. (see the Database topic for more information).
  • The path backup_path needs to be accessible by the memsqld process. Paths are resolved relative to the memsqlbin/data directory.
  • This command must be run on the master aggregator node (see Node Requirements for MemSQL Commands).

MemSQL does not support restoring database backups from a newer version of MemSQL into an older version.


This MemSQL feature is only available in MemSQL Enterprise Edition. MemSQL Enterprise Edition includes 24x7 support and several enterprise-only features for critical deployments. For more information about MemSQL Developer and MemSQL Enterprise, see the MemSQL Editions page.


The following example restores from the /var/lib/memsql/data/ directory.

memsql> RESTORE DATABASE memsql_demo FROM "./";
Query OK, 1 row affected, 2 warnings (44.52 sec)