NetBackup™ Commands Reference Guide
- Introduction
- Appendix A. NetBackup Commands
Name
nbpgsql — used to perform backup, query, restore, and delete operations on NetBackup PostgreSQL clients
SYNOPSIS
-o backup -S primary_server_name -P policy_name -s schedule_name -l postgresql_library_path -z lvm_snapshot_size [-C client_server_name] [-portnum postgresql_server_port] [-u postgresql_server_user] [-instance postgresql_instance_name] [-pgid provider_generated_id]
-o backup -S primary_server_name -P policy_name -s schedule_name -l postgresql_library_path -z lvm_snapshot_size [-C client_server_name] [-b backup_type] [-d backup_directory_path] [-dbname database_name] [-delwal delete_wal_logs] [-g pg_basebackup_compression_level] [-portnum postgresql_server_port] [-u postgresql_server_user] [-instance postgresql_instance_name] [-pgid provider_generated_id]
-o restore -S primary_server_name -P policy_name -t target_restore_directory [-u postgresql_server_user] [-C client_server_name] [-id backup_image_id] [-pitr point-in_time_recovery_time]
-o query -S primary_server_name [-u postgresql_server_user] [-P policy_name] [-C client_server_name] [-instance postgresql_instance_name]
-o delete -S primary_server_name -id backup_image_id
On UNIX systems, the directory path to this command is /usr/openv/netbackup/bin
On Windows systems, the directory path to this command is install_path\NetBackup\bin
DESCRIPTION
This command invokes backup, query, restore, and delete operations for NetBackup PostgreSQL clients. The delete operation removes the backup information from the NetBackup catalog, but retains the backup on the storage media.
OPTIONS
- -b backup_type
Specifies the backup type to use for the backup operation. By default, the snapshot backup type is selected. Accepted values for -b are:
pg_basebackup: The PostgreSQL utility performs the backup of the instance. Veritas recommends this option in the case of a non-LVM deployment. NetBackup performs streaming backups when the pg_basebackup type is specified. These backups change to non-streaming backups when the -d option is specified. This option is available for both UNIX and Windows systems.
pg_dumpall: The PostgreSQL utility performs the logical backup of the instance. Veritas recommends this option in the case of non-LVM deployment. NetBackup performs streaming backups when the pg_dumpall type is specified. These backups change to non-streaming backups when the -d option is specified. This option is available for both UNIX and Windows systems.
pg_dump: The PostgreSQL utility performs the logical backup of an individual database. NetBackup performs streaming backups when the pg_dump type is specified. These backups change to non-streaming backups when the -d option is specified. This option is available for both UNIX and Windows systems.
vss: Snapshot backup type for Windows clients only.
lvm: Snapshot backup type for UNIX clients only.
- -C client_server_name
Specifies the NetBackup client name. When you use this option with the -o query option, the operation retrieves and lists all backups from the specified NetBackup client.
- -d backup_directory_path
Used to configure the backup directory path when the -b option is pg_basebackup, pg_dumpall, or pg_dump. When you specify the -d option, backups of pg_basebackup, pg_dumpall, or pg_dump change to non-streaming backups. Consistent backup files are generated in the backup directory path and are cleaned after the backup. Ensure that the directory path is empty. Any information in the specified directory is deleted.
- -dbname database_name
Use this option with the -b pg_dump to specify the name of the database you want backed up. This option backs up an individual database.
- -delwal value
This parameter is used to delete the WAL files during a backup. Accepted values are 0 or 1. Use 1 to enable the deletion of the WAL files and 0 to disable the deletion of WAL files.
- -g postgresql_compression_level
Configures the compression level when you use the -b pg_basebackup backup operation. The range of accepted values is between 1 and 9 with one being the lowest and nine being the highest compression ratio.
- -id backup_image_id
Specifies the backup image ID. When you use this option with the -o delete operation, it specifies the backup image ID that is deleted from the NetBackup catalog. The backup image is not deleted.
When you use the -id parameter with the -o restore operation to restore an incremental backup, the files are restored from the previous full backup until the backup whose backup image ID is provided.
You cannot use the -id and the -pitr options together.
When neither the -id nor the -pitr parameter is provided, the client time is considered as the point-in-time recovery time.
- -instance postgresql_instance_name
Used to specify the PostgreSQL server instance name. When you use this option with the -o query option, it retrieves and lists all backups of the specified instance name.
- -l postgresql_library_path
Specifies the PostgreSQL library directory. This option is only available for UNIX clients.
- -o operation_type
Specify the operation you want to perform. Valid operation types are:
backup: Used to backup PostgreSQL instances and databases.
query: Used to query the NetBackup catalog for PostgreSQL backups.
restore: Used to restore PostgreSQL instances and database backups.
delete: Used to delete catalog information of PostgreSQL backups.
- -P policy_name
Used to specify the NetBackup DataStore policy name. When you use this option with the -o query option, the command retrieves and lists all backups with the specified policy name.
- -pgid provider_generated_id
Configures the NetBackup provider-generated ID for the backup.
For a PostgreSQL instance, the format of the -pgid must be in the form shown: POSTGRESQL_INSTANCE_client_server_name_port.
For an individual PostgreSQL database backup, the format of the -pgid must be in the form shown: POSTGRESQL_DATABASE_database_name_client_server_name_port
Follow this format to list the recovery points of backups in the NetBackup web UI.
- -pitr "YYYY-MM-DD hh:mm:ss"
Configures the point-in-time recovery time. This value represents the point in time up to which the recovery is performed.
You cannot use the -id and -pitr parameters together.
When the parameter -pitr is used and the time specified matches the time of a backup image, the -id and -pitr functions similarly. But when the time is between a backup and an incremental backup, then files are restored from the previous full backup until that incremental backup. If no incremental backup has been performed after the time provided, then backup files are restored to the last backup.
When neither the -id nor -pitr parameters are not provided, then the time is considered as the point-in-time recovery time.
- -portnum postgresql_server_port
Specifies the PostgreSQL instance port number that NetBackup uses for backup and restore operations. By default, the port number is 5432.
- -S primary_server_name
Specifies the NetBackup primary server name.
- -s schedule_name
Specifies the schedule name that you have configured for the DataStore policy.
- -t target_restore_directory
Configures the target directory where the backups are restored.
- -u postgresql_server_user
Specifies the name of the PostgreSQL server user. The default user is postgres. When you use this option with the -o query option, this option retrieves and lists all backups for the specified user.
For UNIX computers, this parameter is an optional parameter for backup, restore, and query operations. The parameter is not available for the delete operation. For Windows computers, this parameter is optional for backup. The parameter is not available for restore, query, and delete operations.
- -z lvm_snapshot_size
Configures the LVM snapshot size. This option is only available for UNIX clients.
EXAMPLES
Example 1: Perform a streaming pg_basebackup backup.
# nbpgsql -o backup -S Primary_Server1 -P Policy1 -s Schedule1 -l /path/to/pgsql/lib -C Client_Server1 -b pg_basebackup -g 5 -portnum 5432 -u postgres -instance postgres-linux-5432 -pgid POSTGRESQL_INSTANCE_Client_Server1_5432
Example 2: Perform a non-streaming and compressed pg_basebackup backup.
# nbpgsql -o backup -S Primary_Server1 -P Policy1 -s Schedule1 -l /path/to/pgsql/lib -C Client_Server1 -b pg_basebackup -d /backup/dir/path -g 5 -portnum 5432 -u postgres -instance postgres-linux-5432 -pgid POSTGRESQL_INSTANCE_Client_Server1_5432
Example 3: Perform a restore with the -pitr parameter on UNIX.
# nbpgsql -o restore -S Primary_Server1 -P Policy1 -t /target/restore/directory -u postgres -C Client_Server1 -pitr "2023-12-18 11:43:15"
Example 4: Perform a query on Windows.
nbpgsql -o query -S Primary_Server1 -P Policy1 -C Client_Server1 -instance postgres-linux-5432