Feature
User exit (for the copy command) called from the pgx_dmpall command.
Format
The syntax for calling the copy command from the pgx_dmpall command is described below.
copyCommandName prepare 'pathOfBackupInfoFile' 'pathOfBackupTargetListFile'
copyCommandName backup
copyCommandName finalize 'pathOfBackupInfoFile'
Argument
Operation mode
Mode | Description |
---|---|
prepare | Implements the preparation process for backing up using the copy command. Called before the PostgreSQL online backup mode is started. |
backup | Implements the backup process. Called during the PostgreSQL online backup mode. |
finalize | Implements the backup completion process. Called after the PostgreSQL online backup mode is completed. |
Point
If using high-speed copy of the storage device (which performs high-speed retrieval of snapshots and copies data to different physical areas), it is possible to invoke the snapshot process in backup mode, and the copy process in finalize mode.
Full path of the backup information file
Full path of the backup information file of the latest backup, enclosed in single quotation marks. If a backup has not been performed, specify '-'.
Full path of the backup target list file
Full path of the file containing the resources to be backed up using the copy command, enclosed in single quotation marks. One of the following is described in each resource name.
Resource | Description |
---|---|
Database cluster | pg_data |
Tablespace | Tablespace name |
Example
To back up the database cluster and the tablespaces dbspace and indexspace using the copy command, the file should contain the following:
pg_data dbspace indexspace
Information
The encoding of resource names output to the backup target list file by the pgx_dmpall command is the encoding used when this command connects to the database with auto specified for the client_encoding parameter, and is dependent on the locale at the time of command execution.
The number of arguments vary depending on operation mode. The argument of each operation mode is as follows.
Operation mode | First argument | Second argument | Third argument |
---|---|---|---|
prepare | Operation mode | Backup information file path name | Backup target list file path name |
backup | None | None | |
finalize | Backup information file path name |
Additionally, the access permissions for the backup information file and backup target list file are different depending on the operation mode. The access permissions of each operation mode are as follows.
Operation mode | Backup information file | Backup target list file |
---|---|---|
prepare | Can be viewed by the instance administrator only | Can be viewed by the instance administrator only |
backup | - | - |
finalize | Can be viewed and updated by the instance administrator only | - |
Return value
Return value | Description |
---|---|
0 | Normal end The pgx_dmpall command continues processing. |
Other than 0 | Abnormal end The pgx_dmpall command terminates in error. |
Description
The copy command operates with the privileges of the operating system user who executed the pgx_dmpall command. Therefore, grant copy command execution privileges to users who will execute the pgx_dmpall command. Additionally, have the copy command change users as necessary.
To write to the backup information file, use a method such as redirection from the copy command.
Because the copy command is called for each mode, implement all processing for each one.
To copy multiple resources simultaneously, have the copy command copy them in parallel.
Note
The backup information file and backup target list file cannot be deleted. Additionally, the privileges cannot be changed.
Standard output and standard error output of the copy command are output to the terminal where the pgx_dmpall command was executed.
If the copy command becomes unresponsive, the pgx_dmpall command will also become unresponsive. If the copy command is deemed to be unresponsive by the operating system, use an operating system command to forcibly stop it.
Output the copy command execution trace and the result to a temporary file, so that if it terminates in error, the cause can be investigated at a later time.
For prepare mode only, it is possible to use the PostgreSQL client application to access the database using the copy command. For all other modes, do not execute Fujitsu Enterprise Postgres commands or PostgreSQL applications.
Enable the fsync parameter in postgresql.conf, because data on the shared memory buffer needs to have been already written to disk when backup starts.