Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of MongoDB Ops Manager, refer to the upgrade documentation.
You were redirected from a different version of the documentation. Click here to go back.

Restore a Single Database

On this page

Overview

Backup snapshots contain a complete copy of your mongod data directory. In MongoDB 2.6 and earlier, you can restore a portion of your data, such as a single database or collection, from a backup with the mongodump and mongorestore tools and the --dbpath option.

Important

MongoDB 3.0 introduced major changes to the MongoDB tools in order to support additional storage engines such as WiredTiger. In MongoDB 3.0, mongodump and mongorestore do not support the --dbpath option. As such, you cannot use this procedure for a partial data restore on a mongod running MongoDB 3.0.

If you anticipate you will want to restore a single database, create a backup for just that database by excluding the databases or collections that you do not want to back up using the Blacklist field in the Advanced Settings.

Procedure

Select and Download a Snapshot

1

Select the Backups tab and then select Replica Set Status.

2

Click the name of the replica set that contains the database to restore.

Ops Manager displays your selection’s stored snapshots.

3

Select the snapshot from which to restore.

To select a stored snapshot, click the Restore this snapshot link next to the snapshot.

To select a custom snapshot, click the Restore button at the top of the page. In the resulting page, select a snapshot as the starting point. Then select the Use Custom Point In Time checkbox and enter the point in time in the Date and Time fields. Ops Manager includes all operations up to but not including the point in time. For example, if you select 12:00, the last operation in the restore is 11:59:59 or earlier. Click Next.

4

Select HTTP as the delivery method for the snapshot.

In the Delivery Method field, select Pull via Secure HTTP (HTTPS).

Optionally, you can instead choose SCP as the delivery method. See: Retrieve a Snapshot with SCP Delivery for the SCP delivery option’s configuration. If you choose SCP, you must provide the hostname and port of the server to receive the files and provide access to the server through a username and password or though an SSH key. Follow the instructions on the Ops Manager screen.

5

Finalize the request.

Click Finalize Request and confirm your identify via two-factor verification. Then click Finalize Request again.

6

Retrieve the snapshot.

Ops Manager creates a one-time link to a tar file of the snapshot. The link is available for one download and times out after an hour.

To download the snapshot, select the Ops Manager Backup tab and then select Restore Jobs. When the restore job completes, select the download link next to the snapshot.

If you optionally chose SCP as the delivery method, the files are copied to the server directory you specfied. To verify that the files are complete, see the section on how to validate an SCP restore.

Restore the Database

1

Use the mongodump command to dump a single database.

Use the unpacked snapshot restore directory as the dpath switch and the single database name as the --db switch in the mongodump command:

mongodump --dbpath <path> --db <database-name>
2

Use the mongorestore command to import the single database dump.

Enter this mongorestore command:

mongorestore --db <database-name> --drop

You also may specify the --drop switch to drop all collections from the target database before you restore them from the bson file created with mongodump.