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

# Manage database backups and point-in-time recovery from the CLI

> List a database's backups and restores, turn point-in-time recovery on and off, and restore a database to a moment in time from the CLI.

Database commands live under `brimble database`, or `brimble db` for short. They accept a database name or ID. When you omit it, the CLI uses the [linked directory](https://paper.brimble.io/cli/overview.md), or a picker of your databases in a terminal.

For database metrics, use [`brimble project stats`](https://paper.brimble.io/cli/projects#stats).

## Backups and restores

```bash theme={null}
brimble db backups my-db
brimble db backups my-db --page 2
```

Lists backups and restores, newest first. Point-in-time restores show the moment they restored to and the database they created. Failed entries show why they failed.

## Point-in-time recovery

[Point-in-time recovery](https://paper.brimble.io/projects/point-in-time-recovery.md) saves every change to a bucket you own, so you can restore a database to any second in the last 7 days. It needs a paid plan and a database engine that supports it. `brimble db pitr status` tells you whether yours does.

### Check the status

```bash theme={null}
brimble db pitr status my-db
```

Shows whether point-in-time recovery is on, which bucket it saves to, and the range you can restore to.

### Turn it on

```bash theme={null}
brimble db pitr enable my-db --bucket db-archive
```

`--bucket` is a [Brimble bucket](https://paper.brimble.io/object-storage/buckets.md) name or ID. If the database already backs up to your own bucket, you can leave it out. In a terminal without `--bucket`, you pick a bucket from a list.

To use an external S3-compatible bucket instead, pass its details and set the secret key in `BRIMBLE_BUCKET_SECRET_ACCESS_KEY`. In a terminal, the CLI asks for the secret key if the variable isn't set.

```bash theme={null}
export BRIMBLE_BUCKET_SECRET_ACCESS_KEY=...
brimble db pitr enable my-db \
  --endpoint https://s3.us-east-1.amazonaws.com \
  --bucket-name my-db-pitr \
  --region us-east-1 \
  --access-key-id AKIA...
```

Automatic backups turn off while point-in-time recovery is on. You can restore once the first full backup finishes, usually within a few minutes. Check with `brimble db pitr status`.

### Restore to a point in time

```bash theme={null}
brimble db pitr restore my-db --to 15m
brimble db pitr restore my-db --to "2026-10-25 06:30"
brimble db pitr restore my-db --to 2026-10-25T06:30:00Z --name my-db-before-migration
```

`--to` takes how long ago (`30s`, `15m`, `2h`, `1d`) or a time. A time without a timezone is read as UTC. The time must be within the range `status` shows. In a terminal without `--to`, the CLI shows the range and asks.

The restore creates a new database named `<database>-restored`, or the name you pass with `--name`. The original keeps running unchanged. Follow the restore with `brimble db backups my-db`. The new database is ready when the restore shows **Completed**. See [what the restored database gets](https://paper.brimble.io/projects/point-in-time-recovery.md#what-the-restored-database-gets) and [how to switch your app over](https://paper.brimble.io/projects/point-in-time-recovery.md#switch-your-app-over).

### Turn it off

```bash theme={null}
brimble db pitr disable my-db
```

Automatic backups turn back on. Files already in your bucket stay there.

Every command asks before it changes anything. Pass `-y` to skip the question. `disable` refuses to run in a script without `-y`. With `-o json`, `status`, `restore` and `backups` print the API response.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.