PostgreSQL database backup

In this article, you will learn how to configure the PostgreSQL database environment using Xopero ONE.

To ensure that data consistency is kept, Xopero recommends using a dedicated backup type, which is a file-based backup with a pre-backup script for the PostgreSQL database.

Database backup starts with the script that sends a request to the database server to create a database dump in the temporary directory. When the database dump is finished, the dump file is backed up by Xopero ONE.

The pre-backup script can be also used to create a database dump before disk-level backup.

Xopero ONE uses the pg_dump utility to perform PostgreSQL database backup.

See also:

How to backup PostgreSQL environment using Xopero ONE

To configure the PostgreSQL database backup go to Create the backup plan window's advanced settings.

Go to the backup scripts, and next to the pre-backup script.

Enable the pre-backup script and choose the PostgreSQL database script from the list.

Set the database username in the Database user field.

It is good practice to create a dedicated user responsible to perform database backup tasks.

Set the user password by adding it to the Password Manager or choosing it from the list.

See also how to add a new password to the Safe Password Manager:

Set the script's arguments.

Script arguments look like below:

database output_dir "pg_dump_dir" port_number

where:

  • database - database name. A backup plan can backup only one or all databases. If you want to protect all databases use --all parameter instead of the database name.

  • output_dir - the directory to which the database dump is to go, and thus the folder to be backed up

  • pg_dump_dir - path to the pg_dump utility. This parameter is required only for Windows-hosted PostgreSQL database IMPORTANT! Specifying the port is optional. If you do not specify a port in the arguments, the default port will be used.

  • port_number - this parameter is required if you are using a non-standard port (other than 5432)

Set the checkbox to end the backup task with an error when the script fails.

After clicking the Save button the backup plan for PostgreSQL will be finished.

See also:

Last updated