NetBackup104_AdminGuide_PostgreSQL
NetBackup104_AdminGuide_PostgreSQL
PostgreSQL Administrator's
Guide
Release 10.4
NetBackup™ for PostgreSQL Administrator's Guide
Last updated: 2024-03-26
Legal Notice
Copyright © 2024 Veritas Technologies LLC. All rights reserved.
Veritas, the Veritas Logo, Veritas Alta, and NetBackup are trademarks or registered trademarks
of Veritas Technologies LLC or its affiliates in the U.S. and other countries. Other names may
be trademarks of their respective owners.
This product may contain third-party software for which Veritas is required to provide attribution
to the third party (“Third-party Programs”). Some of the Third-party Programs are available
under open source or free software licenses. The License Agreement accompanying the
Software does not alter any rights or obligations you may have under those open source or
free software licenses. Refer to the Third-party Legal Notices document accompanying this
Veritas product or available at:
https://www.veritas.com/about/legal/license-agreements
The product described in this document is distributed under licenses restricting its use, copying,
distribution, and decompilation/reverse engineering. No part of this document may be
reproduced in any form by any means without prior written authorization of Veritas Technologies
LLC and its licensors, if any.
The Licensed Software and Documentation are deemed to be commercial computer software
as defined in FAR 12.212 and subject to restricted rights as defined in FAR Section 52.227-19
"Commercial Computer Software - Restricted Rights" and DFARS 227.7202, et seq.
"Commercial Computer Software and Commercial Computer Software Documentation," as
applicable, and any successor regulations, whether delivered by Veritas as on premises or
hosted services. Any use, modification, reproduction release, performance, display or disclosure
of the Licensed Software and Documentation by the U.S. Government shall be solely in
accordance with the terms of this Agreement.
http://www.veritas.com
Technical Support
Technical Support maintains support centers globally. All support services will be delivered
in accordance with your support agreement and the then-current enterprise technical support
policies. For information about our support offerings and how to contact Technical Support,
visit our website:
https://www.veritas.com/support
You can manage your Veritas account information at the following URL:
https://my.veritas.com
If you have questions regarding an existing support agreement, please email the support
agreement administration team for your region as follows:
Japan [email protected]
Documentation
Make sure that you have the current version of the documentation. Each document displays
the date of the last update on page 2. The latest documentation is available on the Veritas
website:
https://sort.veritas.com/documents
Documentation feedback
Your feedback is important to us. Suggest improvements or report errors or omissions to the
documentation. Include the document title, document version, chapter title, and section title
of the text on which you are reporting. Send feedback to:
You can also see documentation information or ask a question on the Veritas community site:
http://www.veritas.com/community/
https://sort.veritas.com/data/support/SORT_Data_Sheet.pdf
Contents
Index .................................................................................................................... 38
Chapter 1
Introduction to NetBackup
for PostgreSQL
This chapter includes the following topics:
Features Description
Backup The agent supports full instance backups of the PostgreSQL database.
■ (Linux) Ensure that the user who is performing backups and restores is a super
user or has superuser privileges.
■ Set the following database user privileges:
User Privileges
To set the database user privileges, run the following PostgreSQL command:
ALTER USER<db_user> with SUPERUSER
In Linux, after you edit the .pgpass file, change the .pgpass file permissions.
O/P: C:\Users\Administrator\AppData\Roaming
7 To select the schedule type, under the Schedules tab, click OK to select the
Application Backup schedule type.
Note: The XBSA framework supports the Application backup schedule type
only.
8 In the Clients tab, click New and then add the NetBackup client that has the
NetBackup for PostgreSQL Agent.
9 In the Add Client screen, click New, and then in the Client Name field, type
the name of the client.
10 In the NetBackup Administration Console, click NetBackup Management
> Policies to view the policy in the existing policies list.
11 Before performing the backup, review the settings in the nbpgsql.conf file.
For more information, see
Note: Ensure that the PostgreSQL agent and NetBackup are of the same version
for successful backup and restore operations.
Chapter 3
NetBackup for
PostgreSQL backup and
restore
This chapter includes the following topics:
■ Redirected restores
■ Disaster recovery
After you set the parameters for the backup, the agent reads the parameters and
starts the backup according to the specified parameters. The agent writes the data
that you want to protect into the WAL files.
These WAL files are then archived in the archive directory that you can create at
your chosen location.
When you create the archive or WAL directory, Veritas recommends that you create
outside the data directory.
Ensure that before you run a backup, set the parameters in the postgresql.conf
file to enable WAL archiving.
For more information, see See “The postgresql.conf configuration file” on page 14.
The agent protects the following files:
■ Schema files that are associated with all database tables.
■ Files that are associated with the database tables.
■ Data and index files.
Note: Ensure that the PostgreSQL agent and NetBackup are of the same version
for successful backup and restore operations.
NetBackup for PostgreSQL backup and restore 13
About PostgreSQL backups
PostgreSQL
Database server Sends PostgreSQL
data for back up
Requests snapshot, reads and
mounts snapshot, reads the 3 NetBackup
PostgreSQL data primary server
2 5
Snapshot Back up status is
creation returned
NetBackup
media server
NetBackup XBSA
NetBackup client PostgreSQL data
VSS/LVM Snapshot 4 is backed up
Storage unit
Parameters Description
wal_level This parameter determines how much information is written to the WAL
files.
archive_mode This parameter enables the archive mode so that the WAL logs get
stored in the archive directory using the archive_command.
archive_timeout This parameter sets the number of seconds after which the log file
segment switches to a new segment.
statement_timeout This parameter aborts any statement that takes more than the set
number of milliseconds.
Prerequisites
Before you run the backup, ensure that you meet the following prerequisites:
■ Ensure that the user has administrator (Windows) or root (Linux) access.
■ (Windows) Set the NetBackup\bin directory in the environment variable.
For example, Path =C:\Program Files\Veritas\Netbackup\bin
■ (Linux) Symbolic link: If a symbolic link does not exists, create the symbolic link
libpq.so and ensure that it points to the valid libpq .so.<n>, where n is the
PostgreSQL library version.
■ Create the archivedir directory and then set the following parameters in the
postgresql.conf file:
■ wal_level = archive
■ archive_mode = on
■ archive_timeout =0
NetBackup for PostgreSQL backup and restore 15
Performing PostgreSQL backups
■ statement_timeout=0
Note: Ensure that you add the time in milliseconds. The recommended time
is 30000 milliseconds (30 seconds).
■ (Linux) After creating the archivedir directory, change the group and ownership
to PostgreSQL user.
■ Restart the PostgreSQL services.
■ Configure PostgreSQL backups with DataStore policies.
For more information, See “Configuring PostgreSQL backups with DataStore
policies” on page 9.
■ Verify the installation prerequisites and the post-installation requirements.
For more information,
For more information, See “Post-installation requirements for NetBackup”
on page 7.
To run the backup
1 Run the following command:
nbpgsql -o backup
-S primary_server
-P policy_name
-s schedule_name
(Linux)-z snapshot_size
(Linux)-l postgresql_library_path
[-portnum db_port]
[-u dbuser]
(Linux)[-b backup_type]
2 (Optional) Type the database password, when the command line prompts for
a password . NetBackup connects to the database and initiates the backup.
NetBackup for PostgreSQL backup and restore 16
Validating the PostgreSQL backups
For example, to query a backup from client ClientA, run the following command:
nbpgsql -o query -S primary_server [-C ClientA]
For example, to list backup files with the policy name policy_name, run the following
command:
nbpgsql -o query -S primary_server [-P policy_name]
Read progress
file
2
Progress file
NetBackup
media server
NetBackup XBSA
NetBackup client
Storage unit
NetBackup for PostgreSQL backup and restore 18
Performing the PostgreSQL restores
Prerequisites
Before you run a restore, ensure that you meet the following prerequisites:
■ Ensure that the user has administrator (Windows) or root (Linux) access.
■ (LVM users) Ensure that data logs and the logs directory reside on the logical
volume.
Note: Ensure that the PostgreSQL agent and NetBackup are of the same version
for successful backup and restore operations.
NetBackup for PostgreSQL backup and restore 19
Redirected restores
Redirected restores
Redirected restores lets you restore backup files to a client different from the client
that originally performed the backup. The new location can be a different host or a
different file path using a different name for the redirected restore. To redirect a
restore to a different host, include the destination client name in the
install_path\NetBackup\db\altnames directory.
3 In the altnames directory, add the names of the client(s) whose files the
requesting client wants to restore. For example, if you want Host B to have
permissions to redirect restores from Host A, add Host A to the Host B file.
Note: (Linux only) The NetBackup service user account must have ownership
of the altnames directory and host files.
Note: For redirected restore, provide the source client name (client from which
backup was taken) to the -C option.
5 After a successful redirected restore, undo the changes that you made on the
primary server and the client.
NetBackup for PostgreSQL backup and restore 20
Recovering the restores
In Linux operating system, the owner and the group defaults to postgres after a
successful restore. You must change the ownership to PostgreSQL owner and
modify the settings according to your environment.
Parameters Description
restore_command This parameter specifies the shell command that is run to copy log
files back from archival storage. This parameter is required for archival
storage but is optional for streaming replication. The command string
may contain %f that is replaced by the name of the desired log file and
%p is replaced by the absolute path to copy the log file to.
Disaster recovery
Disaster recovery is a plan to recover the data that can get lost in a disaster event.
The agent supports redirected restore as a disaster recovery strategy.
For more information, See “Redirected restores” on page 19.
Chapter 4
Troubleshooting for
PostgreSQL
This chapter includes the following topics:
Step1 Remember the error Error messages are usually the vehicles for telling you something went wrong.
message. If you do not see an error on the command line, but still suspect a problem,
check the logs and the reports. These can provide an error message that
directly points to the problem. The logs and reports are essential
troubleshooting tools.
Troubleshooting for PostgreSQL 24
Troubleshooting errors when using NetBackup for PostgreSQL
Step 4 Correct the problem. After you define the problem, use the information to correct it.
Step 5 Contact Technical If you cannot solve the troubleshooting, contact the Technical support.
Support.
■ install_path\NetBackup\logs\bpcd
■ install_path\NetBackup\logs\user_ops\dbext\logs
You must enable the bprd and the bpcd log files. For more information, see the
NetBackup Troubleshooting Guide.
The logs that are specific to NetBackup client are located at:
■ install_path\netbackup\logs\nbpgsql.log
Troubleshooting for PostgreSQL 25
Troubleshooting errors when using NetBackup for PostgreSQL
The logs that are specific to NetBackup XBSA are located at:
■ <NetBackup_install_path>/netbackup/logs/exten_client
The nbpgsql backup fails with You may encounter this problem Verify the following and then run the backup again:
the following error: when the library path is not
■ Ensure that you provide the correct postgresql
provided in the nbpgsql
Unable to load postgresql library library path, which contains the libpq.so
command using the "-l"
(Linux) or libpq.dll (Windows) file.
switch or the library path is
■ (Linux) If libpq.so is not available, create a
provided but it does not contain
symbolic link named libpq.so that points to
libpq.so (Linux) or
libpq.so.<n>.
libpq.dll (Windows).
■ (Windows) If libpq.dll is not available under
bin directory of the PostgreSQL installation
location, it may be available under lib directory.
The nbpgsql backup fails with The PostgreSQL backup fails To add the appropriate database user name and
the following error: when the nbpgsql command port number:
is run with invalid database user
Unable to connect to the ■ Provide the database user name using the
name, port number, or
database "-u" switch of the nbpgsql command.
password.
■ Provide the database port number using the
"-portnum" switch of nbpgsql command.
■ Provide the database password using the
my.cnf (Linux) or my.ini (Windows) file.
The nbpgsql backup fails with The nbpgsql backup fails if the To run a nbpgsql backup successfully:
the following error: environment variable path is not
■ Update the environment variable path with
updated with NetBackup bin
Unable to load xbsa.dll NetBackup_install_path/bin.
directory.
Troubleshooting for PostgreSQL 26
Troubleshooting errors when using NetBackup for PostgreSQL
The nbpgsql backup fails with The nbpgsql backup fails if the To run the nbpgsql backup successfully:
the following error: nbpgsql.conf file is not
■ Configure the valid primary server name, policy
updated with the required
XBSA initiation failed name, schedule type in the nbpgsql.conf
parameters.
file or from the command line.
■ Verify if there are communication errors
between the nbpgsql agent and the
NetBackup primary server. For more
information see the NetBackup Administrator's
Guide Volume I.
(Windows)VSS snapshot The nbpgsql backup may fail Run cmd.exe in Administrator mode.
creation failed when the user does not have
the privileges to run the
nbpgsql operations.
The nbpgsql restore operation The nbpgsql restore fails if the For a successful restore:
does not restore any data from nbpgsql.conf file is not
■ Verify that the target directory is valid and
the target NetBackup client. updated with the NetBackup
empty.
client name and the target
■ Initiate the restore from the NetBackup source
directory.
client.
■ Set the NetBackup client name and target
directory parameters in the nbpgsql.conf
file.
The nbpgsql backup fails with The nbpgsql backup may fail To verify the space in the volume group:
the following error: when the volume group does
1 Run the following command:
not have sufficient space for the
(Linux)Error creating LVM
snapshot. $vgs
snapshot
The command displays the volume group
details.
Error messages after a The nbpgsql backup gives To remove the snapshots:
successful backup: these errors when the volume
1 Run the following command to list the existing
group contains the snapshots.
<volume_group>/<snapshot_name> snapshot:
You can list the snapshots and
Read failure after 0 of 4096 at
then remove them before you $lvs
29393616896: input or output
run the backup again.
error. The command displays the snapshot details.
Note: nbpgsql created LVM
OR 2 To remove the snapshots, run the following
snapshot names are prefixed
command:
<volume_group>/<snapshot_name>: with pgsqlsnap
read failure after 0 of 4096 at $ lvremove -f
4096: input or output error. <volume_group>/<snapshot_name>
The nbpgsql backup on Linux The nbpgsql backup fails To unmount the snapshot
(LVM), fails with the following during an attempt to unmount
1 Run the following command to list all mounted
error: the snapshot, the device, or
file systems:
when you remove the existing
Error unmounting the
snapshots. $ mount-l
snapshot-Device or resource
busy 2 If the snapshot still exists, create a mount
directory using the following command:
OR
$mount<mount_directory>
Error removing the
snapshot-pgsqlsnap_<timestamp> Note: This directory is created in
/mnt/<snapshot_name>. The prefix names
Note: <timestamp> is the LVM
for snapshot are pgsqlsnap.
snapshot time.
3 Run the following command to remove the
mount directory:
lvremove -f
<volume_group>/<snapshot_name>
Troubleshooting for PostgreSQL 28
Troubleshooting errors when using NetBackup for PostgreSQL
Even after a successful restore, The restore operation is ■ Verify that the PostgreSQL version from the
the PostgreSQL services, failed successful, only when you backed up data is same as the PostgreSQL
to start. restore the backup on a version on the computer where you want to
machine that has the same restore the data.
minor version of PostgreSQL.
The nbpgsql.conf file is Starting from NetBackup 8.2, If the nbpgsql.conf file does not exist, you can
missing after installing the agent the nbpgsql.conf file is not create the file by running the backup utility
on RHEL or SUSE. created by default when you command without any options. For example,
install the agent on RHEL or ./nbpgsql. This command creates the default
SUSE. The existing nbpgsql.conf file.
configuration file is prevented
from getting overwritten as the
RPM installer overwrites any
existing files in the destination
directory
/usr/NBPostgreSQLAgent/.
Restore or restore and recovery Restore or restore and recovery Ensure that the client version and media server
from pre-upgrade images fail from pre-upgrade images fail version are the same for restore or restore and
with the following error message: with an error when media server recovery operation.
and client versions mismatch.
2816 DataStore policy
restore
Appendix A
NetBackup for
PostgreSQL commands
and conventions
This appendix includes the following topics:
Options Description
-h Displays the Help usage, when it is the only option on the nbpgsql
command line.
-portnum Configures the database server port number that identifies the PostgreSQL
instance on which the backup or restore is performed.
nbpgsql -h
■ Brackets [ ] indicate that the enclosed component of the command line is optional.
Other parameters are required.
NetBackup for PostgreSQL commands and conventions 31
NetBackup for PostgreSQL Agent command conventions
■ Italics indicate that the information is user supplied. For example, you may
provide the client name and the schedule name for a backup operation.
■ nbpgsql -o backup
■ nbpgsql -o restore
■ nbpgsql -o query
■ nbpgsql -o delete
NetBackup for PostgreSQL commands 33
nbpgsql -o backup
nbpgsql -o backup
nbpgsql -o backup – runs the backup operation from the NetBackup client.
SYNOPSIS
nbpgsql -o backup
-S primary_server
-P policy_name
-s schedule_name
(Linux) -l postgresql_library_path
(Linux) -z snapshot_size
[-portnum db_port]
[-udatabase_user]
Description
This command invokes the backup operation from the NetBackup client using the
NetBackup DataStore policy name and the schedule type. The parameter -S and
-P are required parameters for Windows. The parameters -b, -l, and -z are required
parameters for Linux. The -portnum and -u are the optional parameters.
On Linux systems, the directory path is /usr/openv/netbackup/bin.
On Windows, the directory path is install_path\NetBackup\bin.
Options
-l
(Linux) Configures the PostgreSQL library directory
-portnum
Configures the database port number that identifies the PostgreSQL instance
on which the backup is performed.
-P
Configures the NetBackup DataStore policy name.
NetBackup for PostgreSQL commands 34
nbpgsql -o backup
-S
Configures the NetBackup server name.
-s
Specifies the schedule name that you have configure for the DataStore policy.
-u
Configures the database user name.
-z
(Linux) Specifies the LVM snapshot size.
-b Configures the backup type as LVM or non-LVM.
NetBackup for PostgreSQL commands 35
nbpgsql -o restore
nbpgsql -o restore
nbpgsql -o restore – restores the backup files from the NetBackup server.
SYNOPSIS
nbpgsql -o restore -S primary_server -t target_directory [-id
db_backup_id] [-Cclient_name]
Description
The nbpgsql command restores the backup file using -t and -S as the required
parameters. The -id and -C are optional parameters.
On Linux systems, the directory path to this command is
/usr/openv/netbackup/bin.
Options
-C
Specifies the client name.
-id
Specifies the backup image name.
-S
Configures the NetBackup primary server.
-t
Configures the target directory where the backups are restored.
NetBackup for PostgreSQL commands 36
nbpgsql -o query
nbpgsql -o query
nbpgsql -o query – query the backup.
SYNOPSIS
nbpgsql -o query -S primary_server [-C NetBackup_client_name] [-P
policy_name]
Description
The nbpgsql -o query command gets the backup using -S as the required
parameter and -C and -P as optional parameters.
On Linux systems, the directory path to this command is
/usr/openv/netbackup/bin/.
Options
-C Retrieves and lists all the backups of the specified client.
-P Retrieves and lists all backups with the specified policy name.
-S Configures the NetBackup primary server.
NetBackup for PostgreSQL commands 37
nbpgsql -o delete
nbpgsql -o delete
nbpgsql -o delete – deletes the backup information from the NetBackup catalog
files.
SYNOPSIS
nbpgsql -o delete -S primary_server[-id db_backup_id]
Description
The nbpgsql -o delete command deletes the backup information from the
NetBackup catalog files, but retains the backups in the storage media.
The parameter -S is a required parameter and -id is the optional parameter.
Options
-id
Specifies the backup image name to delete the specified backup information.
-S
Configures the NetBackup primary server.
Index
B
backups
archive directory 12
delete 12
query 12
schema files 12
symbolic link 12
Write-Ahead logs level 12
R
redirected restore
altnames 18
different file path 18
different host 18
restore
target directory 18
restores
recovery 18
redirected restore 18