‘Using Veritas NetBackup for PostgreSQL’¶
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 different host than the client.
Performing Backups¶
To take a backup of the database, enter the command on the NetBackup Client:
/usr/NBPostgreSQLAgent/nbpgsql -o backup
Querying Backups¶
To list available database backups, enter the command on the NetBackup Client:
/usr/NBPostgreSQLAgent/nbpgsql -o query
Performing Restores¶
Database restores can be performed 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 (default option).
To perform a local restore, use the steps below:
Stop the database server.
Create the target directory to store the database files to be used 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 completed, replace the data directory (PGDATA) with the contents of the target directory.
Set the
restore_commandparameter in thepostgresql.conffile: edb_notranlate_1Start the PostgreSQL server.
Redirected Restore¶
In this scenario, the database files are restored on a (target) database server host which is different from the original (source) database server.
To perform a redirected restore, use the steps below:
Stop the database server on the target host.
Create the target directory on the target host to store the database files to be used 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 completed, replace the data directory
PGDATAon the target host with the contents of the target directory.Set the
restore_commandparameter in thepostgresql.conffile on the target host: edb_notranlate_1Start the PostgreSQL server on the target host.