# Backup, restore and encrypted recovery

> Back up Mimus clusters safely, maintain encryption key custody across rotations, restore DocumentDB dumps, and observe encrypted-WAL standby limits.

---

LLMS index: [llms.txt](/llms.txt)

---

## Run physical backups and offline page checks {#physical-backup}

Use `pg_basebackup` from the matching `/usr/mimus-19/bin` installation to take physical backups of Mimus clusters, including instances with `pg_tde`, `spock`, `pg_mysql`, or `Babelfish` enabled:

```sh
/usr/mimus-19/bin/pg_basebackup -D /var/backups/mimus-base -Fp -Xs -P -R
```

On encrypted clusters, physical pages on disk contain ciphertext. Standard checksum tools that are unaware of `pg_tde` cannot inspect encrypted page payloads directly; always use the Mimus toolchain built with layer `100` / `101` storage hooks and rehearse independent restore into a separate host before relying on a backup chain.

## Guard historical keys alongside WAL {#key-custody}

Rotating a principal key re-wraps internal relation keys, while historical WAL segments and older base backups still depend on earlier principal key versions during point-in-time recovery (PITR).

- Never delete or purge retired key versions from Vault, KMIP, or file keyrings while any physical backup or archived WAL referencing them remains within your retention window.
- Store your Mimus kernel revision, extension git trees, and `SHOW mimus_required_features` output in your backup manifest. See [Back up, restore and migrate](/docs/tde/recovery/) for full runbooks.

## Logical pg_restore for single-node DocumentDB {#documentdb-restore}

When restoring a `pg_dump` archive from a single-node DocumentDB instance into a fresh target, handle `pg_cron` background jobs with one of two verified procedures:

1. **Use fresh default jobs**: Run `pg_restore -N cron` to skip archived `cron` rows and keep the target installation's default jobs.
2. **Preserve archived job history**: Pause job scheduling on the clean target, run `CREATE EXTENSION documentdb CASCADE` and unschedule its four newly created default jobs in one transaction, restore the full archive, and resume scheduling.

## Observe encrypted-WAL replication boundaries {#wal-limits}

When cluster-wide WAL encryption (`pg_tde.wal_encrypt = on`) is enabled on `19.0.1-r4`:

- **Cascading physical replication** (standby streaming to another downstream standby) is **unsupported**.
- **Standby mid-segment restart**: A physical standby that restarts and re-streams from the beginning of an encrypted WAL segment is excluded in `19.0.1-r4`; provision fresh base backups or evaluate plaintext WAL over TLS links when standby restarts are routine.
- **MSSQL temporary objects**: On Babelfish instances, T-SQL `#temp` tables, `@table` variables, and sort/hash workfiles use ordinary `heap` storage and can reach disk in plaintext; see [Temporary storage and plaintext on disk](/docs/mssql/temporary-storage/).

---

Backlinks:

- [How-to Guides](/docs/guides/)
