> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Review and restore backups

> Provides an overview of backups in ClickHouse Cloud

export const Image = ({img, alt, size = "lg"}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} />
      </Frame>
    </div>;
};

export const ScalePlanFeatureBadge = ({feature = 'This feature', linking_verb_are = false}) => {
  return <div className="scalePlanFeatureContainer">
            <div className="scalePlanFeatureBadge">
                Scale plan feature
            </div>
            <div>
                <p>{feature} {linking_verb_are ? 'are' : 'is'} available in the Scale and Enterprise plans. To upgrade, visit the plans page in the cloud console.</p>
            </div>
        </div>;
};

export const CloudNotSupportedBadge = () => {
  return <div className="cloudNotSupportedBadge">
            <div className="cloudNotSupportedIcon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path strokeWidth="1.5" d="M6.33366 12.6666L12.3739 12.6667C13.6593 12.6667 14.7073 11.6187 14.7073 10.3334C14.7073 9.04804 13.6593 8.00003 12.3739 8.00003C12.3739 8.00003 12.3337 7.66659 12.0003 7.33325M10.667 5.33322C8.00033 2.33325 4.45395 4.78537 4.14195 6.68203C2.55728 6.7627 1.29395 8.06203 1.29395 9.6667C1.29395 11.3234 2.66699 12.6666 4.00033 12.6666" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
                <path strokeWidth="1.5" d="M2.66699 14L12.0003 4.66663" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
            </svg>

        </div>
            Not supported in ClickHouse Cloud
        </div>;
};

This guide covers how backups work in ClickHouse Cloud, what options you have to configure backups for your service, and how to restore from a backup.

**Prerequisites**

* You have read ["How backups work in ClickHouse Cloud"](/docs/products/cloud/features/backups/overview#how-backups-work-in-clickhouse-cloud) (Feature overview page)

<h2 id="backup-status-list">
  Backup status list
</h2>

Your service will be backed up based on the set schedule, whether it is the default daily schedule or a [custom schedule](/docs/products/cloud/guides/backups/configurable-backups) picked by you. All available backups can be viewed from the **Backups** tab of the service. From here, you can see the status of the backup, the duration, as well as the size of the backup. You can also restore a specific backup using the **Actions** column.

<Image img="https://mintcdn.com/private-7c7dfe99/flZ-Iruiim7eBp5N/images/cloud/manage/backup-status-list.webp?fit=max&auto=format&n=flZ-Iruiim7eBp5N&q=85&s=90bd6adb74f1b98138314895de94e541" size="md" alt="List of backup statuses in ClickHouse Cloud" border width="2136" height="1148" data-path="images/cloud/manage/backup-status-list.webp" />

<h2 id="understanding-backup-cost">
  Understanding backup cost
</h2>

Per the default policy, ClickHouse Cloud mandates a backup every day, with a 24 hour retention.  Choosing a schedule that requires retaining more data, or causes more frequent backups can cause additional storage charges for backups.

To understand the backup cost, you can view the backup cost per service from the usage screen (as shown below). Once you have backups running for a few days with a customized schedule, you can get an idea of the cost and extrapolate to get the monthly cost for backups.

<Image img="https://mintcdn.com/private-7c7dfe99/flZ-Iruiim7eBp5N/images/cloud/manage/backup-usage.webp?fit=max&auto=format&n=flZ-Iruiim7eBp5N&q=85&s=2c3400e14153c59b321e2b50e529b9fc" size="md" alt="Backup usage chart in ClickHouse Cloud" border width="1886" height="1548" data-path="images/cloud/manage/backup-usage.webp" />

Estimating the total cost for your backups requires you to set a schedule. Before setting a schedule, you can use the [pricing calculator](https://clickhouse.com/pricing) to obtain a monthly cost estimate by providing the following inputs:

* Size of the full and incremental backups
* Desired backup frequency
* Desired backup retention
* Cloud provider and region

<Note>
  Keep in mind that the estimated cost for backups will change as the size of the data in the service grows over time.
</Note>

<h2 id="restore-a-backup">
  Restore a backup
</h2>

Backups are restored to a new ClickHouse Cloud service, not to the existing service from which the backup was taken.

After clicking on the **Restore** backup icon, you can specify the service name of the new service that will be created, and then restore this backup:

<Image img="https://mintcdn.com/private-7c7dfe99/flZ-Iruiim7eBp5N/images/cloud/manage/backup-restore.webp?fit=max&auto=format&n=flZ-Iruiim7eBp5N&q=85&s=0eb8d031316fdfc7e80ec9553a09806e" size="md" alt="Restoring a backup in ClickHouse Cloud" width="1198" height="442" data-path="images/cloud/manage/backup-restore.webp" />

The new service will show in the services list as `Provisioning` until it is ready:

<Image img="https://mintcdn.com/private-7c7dfe99/flZ-Iruiim7eBp5N/images/cloud/manage/backup-service-provisioning.webp?fit=max&auto=format&n=flZ-Iruiim7eBp5N&q=85&s=22b2a86b4ef4660be0e12abf459e9fd3" size="md" alt="Provisioning service in progress" border width="718" height="452" data-path="images/cloud/manage/backup-service-provisioning.webp" />

<h2 id="working-with-your-restored-service">
  Working with your restored service
</h2>

After a backup has been restored, you will now have two similar services: the **original service** that needed to be restored, and a new **restored service** that has been restored from a backup of the original.

Once the backup restore is complete, you should do one of the following:

* Use the new restored service and remove the original service.
* Migrate data from the new restored service back to the original service and remove the new restored service.

<h3 id="use-the-new-restored-service">
  Use the **new restored service**
</h3>

To use the new service, perform these steps:

1. Verify that the new service has the IP Access List entries required for your use case.
2. Verify that the new service contains the data that you need.
3. Remove the original service.

<h3 id="migrate-data-from-the-newly-restored-service-back-to-the-original-service">
  Migrate data from the **newly restored service** back to the **original service**
</h3>

Suppose you can't work with the newly restored service for some reason, for example, if you still have users or applications that connect to the existing service. You may decide to migrate the newly restored data into the original service. The migration can be accomplished by following these steps:

**Allow remote access to the newly restored service**

The new service should be restored from a backup with the same IP Allow List as the original service. This is required as connections won't be allowed to other ClickHouse Cloud services unless you had allowed access from **Anywhere**. Modify the allow list and allow access from **Anywhere** temporarily. See the [IP Access List](/docs/products/cloud/guides/security/connectivity/setting-ip-filters) docs for details.

**On the newly restored ClickHouse service (the system that hosts the restored data)**

<Note>
  You will need to reset the password for the new service in order to access it. You can do that from the service list **Settings** tab.
</Note>

Add a read only user that can read the source table (`db.table` in this example):

```sql theme={null}
CREATE USER exporter
IDENTIFIED WITH SHA256_PASSWORD BY 'password-here'
SETTINGS readonly = 1;
```

```sql theme={null}
GRANT SELECT ON db.table TO exporter;
```

Copy the table definition:

```sql theme={null}
SELECT create_table_query
FROM system.tables
WHERE database = 'db' AND table = 'table'
```

**On the destination ClickHouse Cloud system (the one that had the damaged table):**

Create the destination database:

```sql theme={null}
CREATE DATABASE db
```

Using the `CREATE TABLE` statement from the source, create the destination:

<Tip>
  Change the `ENGINE` to `ReplicatedMergeTree` without any parameters when you run the `CREATE` statement. ClickHouse Cloud always replicates tables and provides the correct parameters.
</Tip>

```sql theme={null}
CREATE TABLE db.table ...
ENGINE = ReplicatedMergeTree
ORDER BY ...
```

Use the `remoteSecure` function to pull the data from the newly restored ClickHouse Cloud service into your original service:

```sql theme={null}
INSERT INTO db.table
SELECT *
FROM remoteSecure('source-hostname', db, table, 'exporter', 'password-here')
```

After you have successfully inserted the data into your original service, make sure to verify the data in the service. You should also delete the new  service once the data is verified.

<h2 id="undeleting-or-undropping-tables">
  Undeleting or undropping tables
</h2>

The `UNDROP` command is supported in ClickHouse Cloud through [Shared Catalog](/docs/products/cloud/features/infrastructure/shared-catalog).

To prevent users from accidentally dropping tables, you can use [`GRANT` statements](/docs/reference/statements/grant) to revoke permissions for the [`DROP TABLE` command](/docs/reference/statements/drop#drop-table) for a specific user or role.

<Note>
  To prevent accidental deletion of data, please note that by default it isn't possible to drop tables >`1TB` in size in ClickHouse Cloud.
  Should you wish to drop tables greater than this threshold you can use setting `max_table_size_to_drop` to do so:

  ```sql theme={null}
  DROP TABLE IF EXISTS table_to_drop
  SYNC SETTINGS max_table_size_to_drop=2000000000000 -- increases the limit to 2TB
  ```
</Note>

<Note>
  Legacy Plans: For customers on legacy plans, default daily backups retained for 24 hours, are included in the storage cost.
</Note>

<h2 id="backup-durations">
  Backup durations
</h2>

Backup and restore durations depend on several factors such as the size of the database as well as the schema and the number of tables in the database.
Incremental backups will usually complete much faster than a full backup as less data is being backed up.
Restoring from an incremental backup will be slightly slower than restoring from a full backup as all incremental backups and the last full backup in the chain are included in the restore as explained above.

In our testing, we have seen that smaller backups of \~1 TB could take around 10-15 minutes or longer to back up.
Backups less than 20 TB should complete within an hour, and backing up 50 TB of data should take about 2-3 hours.
Backups get economies of scale at larger sizes, and we have seen backups of up to 1 PB for some internal services complete in about 10 hours.

<Note>
  Backups to external buckets may be slower than backups to ClickHouse buckets
</Note>

Restore durations are about the same as the backup durations.

We recommend testing with your own database or sample data to get better estimates as the actual duration depends on several factors as outlined above.

<h2 id="configurable-backups">
  Configurable backups
</h2>

If you want to set up a backups schedule different from the default backup schedule, take a look at [Configurable Backups](/docs/products/cloud/guides/backups/configurable-backups).

<h2 id="export-backups-to-your-own-cloud-account">
  Export backups to your own cloud account
</h2>

For users wanting to export backups to their own cloud account, see [here](/docs/products/cloud/guides/backups/bring-your-own-backup/export-backups-to-own-cloud-account).
