Using Veritas NetBackup for PostgreSQL

Suggest edits

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

BackupQuery

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:

  1. Stop the database server.

  2. Create the target directory to store the database files to be used 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 completed, 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 which is different from the original (source) database server.

To perform a redirected restore, use the steps below:

  1. Stop the database server on the target host.

  2. Create the target directory on the target host to store the database files to be used 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 completed, 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!