Skip to main content

Bench Partial Restore Command

The bench partial-restore command restores specific database tables from a partial SQL backup instead of restoring an entire site. It is particularly useful when you only need to recover selected DocTypes or tables that were backed up using the bench backup --only or --exclude options.

Tip:

Use this command when you want to restore only a portion of your database without affecting the remaining data on the site.

Usage

Run the following command to restore data from a partial SQL backup.

bench partial-restore [OPTIONS] SQL_FILE_PATH

How Partial Restore Works

Unlike the standard bench restore command, which restores an entire database, bench partial-restore imports only the tables available in the specified SQL backup file.

This makes it ideal for recovering selected DocTypes, restoring accidentally deleted data, or importing partial backups into an existing site.

Best Practice:

Create a backup of your current site before performing a partial restore, especially when restoring into a production environment.

Supported Backup Files

The command supports both of the following database backup formats:

  • Plain SQL files (.sql)
  • Compressed SQL files (.sql.gz)

Any SQL backup containing valid database tables can be restored using this command.

SQL_FILE_PATH Argument

The required SQL_FILE_PATH argument specifies the location of the SQL backup file to restore.

The file path may be:

  • Relative to the Bench directory
  • Relative to the sites directory
  • An absolute file path

Available Flag

Flag Description
-v, --verbose Displays detailed information about the restore process.

Example

Restore a Partial Backup

bench --site {site} partial-restore -v {/path/to/sql/file}

This command restores the tables contained in the specified SQL backup file and displays detailed progress information during the restore operation.

Note:

The partial-restore command restores only the database content available in the SQL file. It does not restore public files, private files, or site configuration.

Rating: 0 / 5 (0 votes)