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 Backup tab and then Overview page.

2

On the line listing the process, click the ellipsis icon and select Restore.

3

Select the restore point.

Select the restore point, enter information as needed, and then click Next:

Snapshot Restores from a stored snapshot. Select the snapshot from which to restore.
Point In Time

Creates a custom snapshot based on a replica set point in time. 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.

Select a Date and Time and click Next.

Oplog Timestamp

Creates a custom snapshot based on the timestamp of an entry in the oplog, as specified by the entry’s ts field. Ops Manager includes all operations up to and including the time of the timestamp. An entry’s ts field is a BSON timestamp and has two components: the timestamp and the increment.

Specify the following:

  • Timestamp: The value in seconds since the Unix epoch.
  • Increment: An incrementing ordinal for operations within a given second.
4

Select how to receive the restore files.

Select the restore method, format, and destination. Enter information as needed, and then click Finalize Request:

Pull Via Secure HTTP Create a one-time direct download link. If you select this, click Finalize Request and skip the rest of this procedure.
Push Via Secure Copy

Direct Ops Manager to copy the restore files to your server via SCP. To use this option you must have an existing key pair that Ops Manager can use to transmit the files. See Generate a Key Pair for SCP Restores.

Windows machines do not come with SCP and require additional setup outside the scope of this manual.

Format

Sets the format of the restore files:

  • Individual DB Files: Transmits MongoDB data files produced by Ops Manager Backup directly to the target directory. The data is compressed during transmission.
  • Archive (tar.gz): Delivers database files in a single tar.gz file that you must extract before reconstructing databases. With Archive (tar.gz) delivery, you need sufficient space on the destination server for the archive and the extracted files.
SCP Host The hostname of the server to receive the files.
SCP Port The port of the server to receive the files.
SCP User The username used to access to the server.
Auth Method Select whether to use a username and password or an SSH certificate to authenticate to the server.
Password The user password used to access to the server.
Passphrase The SSH passphrase used to access to the server.
Target Directory The absolute path to the directory on the server to which to copy the restore files.
5

Retrieve the snapshot.

If you selected Pull Via Secure HTTP, Ops Manager creates a link to the snapshot that by default is available for an hour and can be used just once. To download the snapshot, select the Backup tab and then Restore History page. When the restore job completes, select the download link next to the snapshot.

If you selected Push Via Secure Copy, 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.