Using
Common backup/restore operations for PostgreSQL databases using Veritas NetBackup for PostgreSQL are:
- Performing backups — Takes backup of the database and stores it in a predetermined location.
- Querying backups — Lists available database backups.
- Performing restores — Restores the database from a backup previously taken:
- Local restore — Database files are restored to the same host as the client.
- Redirected restore — Database files are restored to a host different from the client.
Performing backups
To take a backup of the database, enter the command on the Veritas NetBackup client:
/usr/NBPostgreSQLAgent/nbpgsql -o backup
Querying backups
To list available database backups, enter the command on the Veritas NetBackup client:
/usr/NBPostgreSQLAgent/nbpgsql -o query
Performing restores
You can perform database restores in the following two scenarios:
- Local restore
- Redirected restore
Local restore
In this scenario, the database files are restored on the original (source) database server host. This is the default option.
To perform a local restore:
Stop the database server.
Create the target directory to store the database files to use for the restore operation.
Determine the database backup id you want to use for the restore by querying available backups:
/usr/NBPostgreSQLAgent/nbpgsql -o query
Restore the database files to the target directory:
/usr/NBPostgreSQLAgent/nbpgsql -o restore -t <target-directory> -id <db-backup-id>
Once the restore operation is complete, replace the data directory
PGDATA
with the contents of the target directory.Set the
restore_command
parameter in thepostgresql.conf
file:Start the PostgreSQL server.
Redirected restore
In this scenario, the database files are restored on a target database server host that's different from the original (source) database server.
To perform a redirected restore:
Stop the database server on the target host.
Create the target directory on the target host to store the database files to use for the restore operation.
Determine the database backup id you want to use for the restore by querying available backups on the source host:
/usr/NBPostgreSQLAgent/nbpgsql -o query -C <source-db-server-host>
Restore the database files to the target directory on the target host:
/usr/NBPostgreSQLAgent/nbpgsql -o restore -t <target-directory> -id <db-backup-id> -C <source-db-server-host>
Once the restore operation is complete, replace the data directory
PGDATA
on the target host with the contents of the target directory.Set the
restore_command
parameter in thepostgresql.conf
file on the target host:Start the PostgreSQL server on the target host.
Could this page be better? Report a problem or suggest an addition!