Skip to content

Restore from a logical backup

To restore a backup, use the pbm restore command supplying the backup name from which you intend to restore. Percona Backup for MongoDB identifies the type of the backup (physical, logical or incremental) and restores the database up to the restore_to_time timestamp (available in pbm list output starting with version 1.4.0).

Before you start

You can restore a specific database or a collection either from a full or a selective backup. Read about known limitations of selective restores.

Restore a database

  1. List the backups

    $ pbm list
    
    2. Run the pbm restore command in the format:

    $ pbm restore <backup_name> --ns <database.collection>
    

You can specify several namespaces as a comma-separated list for the --ns flag: <db1.col1>, <db2.*>.

During the restore, Percona Backup for MongoDB retrieves the file for the specified database / collection and restores it.

Restore with users and roles

To restore a custom database with users and roles from a full backup, add the --with-users-and-roles flag to the pbm restore command:

$ pbm restore <backup_name> --ns <database.*> --with-users-and-roles

Post-restore steps

After the restore is complete, do the following:

  1. Start the balancer and all mongos nodes to reload the sharding metadata.
  2. We recommend to make a fresh backup to serve as the new base for future restores.

Next steps

Point-in-time recovery

Get expert help

If you need assistance, visit the community forum for comprehensive and free database knowledge, or contact our Percona Database Experts for professional support and services.


Last update: November 1, 2024
Created: November 1, 2024