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

Query Backup

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:

  1. Stop the database server.

  2. Create the target directory to store the database files to use for the restore operation.

  3. Determine the database backup id you want to use for the restore by querying available backups:

    /usr/NBPostgreSQLAgent/nbpgsql -o query

  4. Restore the database files to the target directory:

    /usr/NBPostgreSQLAgent/nbpgsql -o restore -t <target-directory> -id <db-backup-id>

  5. Once the restore operation is complete, replace the data directory PGDATA with the contents of the target directory.

  6. Set the restore_command parameter in the postgresql.conf file:

    restore_command = 'cp /var/lib/edb/as13/data/pgarchive/%f %p'
  7. 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:

  1. Stop the database server on the target host.

  2. Create the target directory on the target host to store the database files to use for the restore operation.

  3. 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>

  4. 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>

  5. Once the restore operation is complete, replace the data directory PGDATA on the target host with the contents of the target directory.

  6. Set the restore_command parameter in the postgresql.conf file on the target host:

    restore_command = 'cp /var/lib/edb/as13/data/pgarchive/%f %p'
  7. Start the PostgreSQL server on the target host.


Could this page be better? Report a problem or suggest an addition!