Top
Enterprise Postgres 17 Operation Guide

16.2 Backup Using the Copy Command

To perform backup using the copy command, in addition to performing the standard backup procedure, it is also necessary to create a copy command, and then execute the pgx_dmpall command specifying it. This section describes the procedure specific to using the copy command.

Preparing for backup

You must prepare for backup before actually starting the backup process.

Perform the following procedure:

  1. Determine the database resources to be backed up

    Determine the database resources to be backed up using the copy command. The copy command can back up the following resources:

    • Database cluster

    • Tablespace

    To back up only some tablespaces, create a file listing them. This file is not necessary to back up all tablespaces.

    Example

    To back up only tablespaces tblspc1 and tblspc2

    tblspc1
    tblspc2
  2. Prepare a backup area

    Prepare a backup area to save the database resources to be backed up, as determined in step 1.

  3. Create the copy command

    Create the copy commands for backup and recovery. Refer to "16.4 Copy Command Interface" for details.

Performing backup

Execute the pgx_dmpall command with the -Y option specifying the full path of the copy command for backup created in step 3 of preparation for backup.

The example below backs up only some tablespaces, but not the database cluster, using the copy command.

Example

$ pgx_dmpall -D /database/inst1 -Y '/database/command/backup.sh'
  --exclude-copy-cluster -P '/database/command/tablespace_list.txt'

Point

  • To exclude up the database cluster from backup using the copy command, specify the --exclude-copy-cluster option.

  • To back up only some tablespaces using the copy command, use the -P option specifying the full path of the file created in step 1 of preparation for backup.

See

  • Refer to "pgx_dmpall" in the Reference for information on the command.

Checking backup status

Use the pgx_rcvall command to check the backup status.

Execute the pgx_rcvall command with the -l option specified to output backup data information. If backup was performed using the copy command, the resources backed up using the copy command will also be output.

Example

$ pgx_rcvall -l -D /database/inst1
Date                Status   Dir                               Resources backed up by the copy command
2022-03-01 13:30:40 COMPLETE /backup/inst1/2022-03-01_13-30-40 pg_data,dbspace,indexspace