---
name: "pg_restorecluster"
section: "1"
platform: "linux"
package: "postgresql-common"
version: "278"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/pg_restorecluster"
---

# pg\_restorecluster(1)

Restore from a pg\_backupcluster backup

## NAME

pg\_restorecluster - Restore from a pg\_backupcluster backup

## SYNOPSIS

**pg\_restorecluster** \[*options*\] *version* *cluster* *backup*

## DESCRIPTION

**pg\_restorecluster** restores a PostgreSQL cluster from a backup created by **pg\_backupcluster**. The cluster will be newly created in the system using the name provided on the command line; this allows renaming a cluster on restore. The restored cluster configuration will be updated to reflect the new name and location.

The *backup* name passed must end in either **.basebackup** or **.dump**; usually this will be the full path to a backup directory in `/var/backups/postgresql/version-cluster/` as reported by **pg\_backupcluster ... list**.

Basebackups are restored as-is. For dumps, **pg\_createcluster** is used to create a new cluster, and schema and data are restored via **pg\_restore**.

## OPTIONS

- **-d --datadir** *DIR*

  Use *DIR* as data directory for the restored cluster (default per createcluster.conf, by default /var/lib/postgresql/*version*/*cluster*).

- **-p --port** *N*

  Use port *N* for restored cluster (default is next free port).

- **-s --start**

  Start cluster after restoring (default for restore from dump; off for basebackup restores).

  After the cluster has been started, **ANALYZE** is run on all databases.

- **--archive**

  Configure cluster for recovery from WAL archive. This sets **restore\_command** to retrieve WAL files from *backup***/../wal**.

- **--pitr** *TIMESTAMP*

  - **--recovery-target-time** *TIMESTAMP*

  Additionally to setting **restore\_command**, set **recovery\_target\_time** to *TIMESTAMP* for point-in-time recovery. Also sets **recovery\_target\_action='promote'**.

- **--wal-archive** *DIR*

  For archive recovery, read WAL from archive *DIR* (default is *backup***/../wal**).

## FILES

- /var/backups

  Default root directory for cluster backup directories.

See [**pg\_backupcluster**(1)](/pg_backupcluster/1.md) for a description of files.

## SEE ALSO

[**pg\_backupcluster**(1)](/pg_backupcluster/1.md), [**pg\_restore**(1)](/pg_restore/1.md), [**vacuumdb**(1)](/vacuumdb/1.md).

## AUTHOR

Christoph Berg \<myon@debian.org\>
