All Products
Search
Document Center

ApsaraDB for MongoDB:Restore one or more databases of an ApsaraDB for MongoDB instance

Last Updated:Oct 30, 2025

If you accidentally delete a collection or a document, you can restore one or more databases of your ApsaraDB for MongoDB instance to quickly recover the data.

Prerequisites

The instance is a replica set instance with cloud disks, a sharded cluster instance with cloud disks, or a replica set instance with local disks.

Note

The database and table recovery feature for replica set instances with cloud disks and sharded cluster instances with cloud disks is not available to all users. If you want to use this feature, submit a ticket to technical support to enable it.

Database and table recovery

The notes, billing methods, and procedures vary depending on the instance architecture.

Replica set instances with cloud disks and sharded cluster instances with cloud disks

Notes

  • You can restore data from one or more databases only to the original instance.

  • Ensure that a valid backup set exists before you restore databases or tables.

  • Ensure that the original instance has sufficient storage space. If the storage space is insufficient, scale out the instance before you proceed. For more information, see Change the configurations of a shard.

  • When you restore databases or tables, the system creates temporary tables in the original instance to store the restored data. After the restoration is complete, you can choose to overwrite the original databases and tables.

  • The time required to restore one or more databases depends on factors such as the data volume, the task queue, and network conditions. Wait for the instance status to change to Running.

  • You cannot use this feature to restore databases or tables whose names contain special characters. When you create databases and tables, use only letters, numbers, and underscores (_).

Billing

The database and table recovery feature is free of charge. You are charged only for the storage of backup files. For more information about backup billing, see Billing rules.

Enable the database and table recovery feature

You must enable the database and table recovery feature before you can use it. You cannot disable this feature after it is enabled.

  1. Go to the ApsaraDB for MongoDB replica set instances page or the ApsaraDB for MongoDB sharded cluster instances page. In the upper-left corner of the page, select a resource group and a region. Then, click the ID of the target instance.

  2. In the navigation pane on the left, click Backup and Restoration.

  3. Click Backup Settings.

  4. In the Backup Settings panel, in the Advanced Features section, select Database And Table Recovery.

  5. Click OK.

Restore some databases and tables to the original instance

Important

Database and table metadata is backed up during a full backup. After you enable the database and table recovery feature, you must perform a full backup, either an automatic backup or a manual backup, before you can use this feature to restore data.

  1. Go to the ApsaraDB for MongoDB replica set instances page or the ApsaraDB for MongoDB sharded cluster instances page. In the upper-left corner of the page, select a resource group and a region. Then, click the ID of the target instance.

  2. In the navigation pane on the left, click Backup and Restoration.

  3. Click Create Instance By Time Point.

  4. In the Create Instance By Time Point panel, set Recovery Mode to Database And Table Recovery.

  5. In the Database And Table Recovery dialog box, select a Restore Time and the Databases And Tables To Restore, and then click OK.

  6. Click OK. The instance status changes to Restoring from Backup. When the instance status changes back to Running, the restoration of the databases and tables is complete.

  7. (Optional) If needed, decide whether to overwrite the original tables with the temporary tables.

Replica set instances with local disks

Limits

  • Instance creation date: After March 26, 2019.

  • Region: China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Hangzhou), China (Shanghai), China (Shenzhen), or Singapore.

  • Database version: 4.0 or 4.2.

    Note
    • If the database version is earlier than 4.0, you must upgrade the database version. For more information, see Upgrade the major version of a database.

    • After you upgrade the database version, backup files that were created before the upgrade cannot be used to create new instances.

  • Storage engine: WiredTiger.

  • The backup file must contain the database that you want to restore. For example, to restore the "test" database of an instance, the backup file must contain the "test" database.

  • You cannot use this feature to restore databases or tables whose names contain special characters. When you create databases and tables, use only letters, numbers, and underscores (_).

Notes

  • You can restore one or more databases only from physical backups. Restoring from logical backups is not supported. If your ApsaraDB for MongoDB instance runs MongoDB 3.4 and has a total of more than 10,000 collections and indexes, physical backups may fail. To prevent this, you can upgrade the database version of the instance to MongoDB 4.0 or later before you perform a physical backup. For more information, see Upgrade the major version of a database.

    Note

    After you upgrade the database version, backup files that were created before the upgrade cannot be used to create new instances.

  • The time required to restore one or more databases depends on factors such as the data volume, the task queue, and network conditions. Wait for the status of the new instance to change to Running.

  • For better performance and stability, the new MongoDB instance created for data restoration uses the latest minor database version by default.

Billing

When you restore one or more databases, a new instance is created, and you are billed for it. For more information, see Billable items.

Procedure

  1. Go to the ApsaraDB for MongoDB replica set instances page. In the upper-left corner of the page, select a resource group and a region. Then, click the ID of the target instance.

  2. In the navigation pane on the left, click Backup and Restoration.

  3. On the Full Backup tab, choose to restore data by time point or from a backup point, as needed.

    Restore by time point

    1. Click Create Instance by Time Point.

    2. In the Create Instance by Time Point panel, set the following parameters.

      Parameter

      Description

      Select Time Point for Restoration

      Select a point in time to restore the instance data. You can select any point in time within the last seven days.

      Note

      The restoration time must be earlier than the current time and later than the instance creation time.

      Select Database for Restoration

      Select Partial Databases and select the names of the databases that you want to restore.

      Note

      You can also click Enter Databases to manually enter the database names.

    3. Click OK.

    Restore from a backup point

    1. In the backup file list, find the target backup file and click Create Instance from Backup in the Actions column.

    2. In the Create Instance from Backup panel, select Partial Databases and select the names of the databases that you want to restore.

      Note

      You can also click Enter Databases to manually enter the database names.

    3. Click OK.

  4. On the Clone Instance page, configure the new instance. For more information about the configuration items, see Create a replica set instance.

    Note

    To ensure that the new instance has enough space for the restored data, configure a storage capacity that is at least the same as that of the original instance.

  5. Click Buy Now and complete the payment.