> ## Documentation Index
> Fetch the complete documentation index at: https://ngquct-docs-fix-500-query-results.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Backup & Restore

> Dump and restore PostgreSQL or Redshift databases with pg_dump and pg_restore, with progress, cancel, and SSH tunnel reuse

`pg_dump` and `pg_restore` have to be on your Mac first. TablePro shells out to them and ships no copy of its own:

```bash theme={null}
brew install libpq
brew link --force libpq
```

The lookup takes the first match from `/usr/bin/which`, then `/opt/homebrew/bin`, `/usr/local/bin`, and Postgres.app's latest version. That path decides which client version does the work.

<Info>
  PostgreSQL and Redshift only. For any other engine, use a SQL export from [Import & Export](/features/import-export). Restore is disabled on a read-only [Safe Mode](/features/safe-mode) connection; backup is not, because it writes nothing to the database.
</Info>

<Frame caption="The Backup Dump sheet with its format and scope options">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-docs-fix-500-query-results/hA72m8tSnRe3b-ew/images/backup-dump-dialog.png?fit=max&auto=format&n=hA72m8tSnRe3b-ew&q=85&s=803531d00f1b02fc889d632823c54015" alt="Backup Dump sheet" width="1560" height="960" data-path="images/backup-dump-dialog.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-docs-fix-500-query-results/hA72m8tSnRe3b-ew/images/backup-dump-dialog-dark.png?fit=max&auto=format&n=hA72m8tSnRe3b-ew&q=85&s=79c89ba2c6fee8a3ae6ae1c076e2e2ec" alt="Backup Dump sheet" width="1560" height="960" data-path="images/backup-dump-dialog-dark.png" />
</Frame>

## Backup dump

<Steps>
  <Step title="Start the dump">
    Choose **File > Backup Dump…** on a connected session and pick the database.
  </Step>

  <Step title="Choose where to save it">
    The default filename is `<database>-<yyyy-MM-dd-HHmmss>.dump`. Dumps use the custom archive format (`pg_dump -Fc`), which is what `pg_restore` reads back.
  </Step>

  <Step title="Watch the byte counter">
    **Cancel** confirms, sends `SIGTERM`, and removes the partial file. On success the result sheet gives the size and **Show in Finder**.
  </Step>
</Steps>

## Restore dump

<Steps>
  <Step title="Pick the dump file">
    Choose **File > Restore Dump…** and select a file `pg_dump` wrote in custom archive format.
  </Step>

  <Step title="Pick the target database">
    `pg_restore` runs with `--no-owner --no-acl`, so the connection user ends up owning the restored objects.
  </Step>

  <Step title="Wait it out">
    Restore shows no percentage. **Cancel** confirms and sends `SIGTERM`, and the target database is left as it stands: drop it and restore into a fresh one, or clean up the partial objects yourself.
  </Step>
</Steps>

No `--clean` is passed, so restoring on top of a schema that already holds conflicting objects produces errors instead of replacing them.

## SSH tunnels and SSL

Both flows reuse the connection's active SSH tunnel, with no second port forward. SSL connections pass their mode to the tools through `PGSSLMODE`, `verify-ca` and `verify-full` included.

## Failures

A non-zero exit shows the last 64 KB of `pg_dump` or `pg_restore` stderr in a scrollable monospaced view. Three causes account for most of them.

| What you see                                                                                 | What to do                                                                                                                                                                       |
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *"pg\_dump was not found on this system. Install it with `brew install libpq` and link it."* | Install and link `libpq` so the binaries are on `PATH`                                                                                                                           |
| An authentication failure                                                                    | The password goes through `PGPASSWORD` and the tools run with `--no-password`, so this is the role or the database rather than a missing prompt. Check that the role has `LOGIN` |
| Objects that conflict with the dump                                                          | Restore into a fresh database, or drop the conflicting objects first                                                                                                             |
