This method involves temporarily moving backup data to a different directory, saving it there, and securing disk space on the backup data storage destination so that a backup can be made normally.
Use this method if you need time to prepare a larger capacity disk.
If space runs out on the backup data storage destination, archive logs can no longer be stored in the backup data storage destination. As a result, transaction logs continue to accumulate in the data storage destination or the transaction log storage destination.
If action is not taken soon, the transaction log storage destination will become full, and operations may not be able to continue.
To prevent this, secure space in the backup data storage destination, so that archive logs can be stored.
There are two methods of taking action:
Follow the procedure below to recover the backup data storage disk.
Temporarily save backup data
Move backup data to a different directory and temporarily save it, and secure space in the backup data storage destination directory.
The reason for saving the backup data is so that the data in the data storage destination can be recovered even if it is corrupted before you perform recovery. If there is no disk at the save destination and you consider that there is no risk of corruption at the data storage destination, delete the backup data.
The following example saves backup data from the backup data storage destination directory (/backup/inst1) under /mnt/usb/backup.
> mkdir /mnt/usb/backup/ > mv /backup/inst1/* /mnt/usb/backup/
Back up the database cluster
Back up the latest resources at the data storage destination. Refer to "3.2.1 Using WebAdmin" for details.
Delete temporarily saved backup data
If backup completes normally, the temporarily saved backup data becomes unnecessary and is deleted.
The following example deletes backup data that was temporarily saved in /mnt/usb.
> rm -rf /mnt/usb/backup
The following describes the procedure for recovering the backup storage disk.
There are two methods of taking action:
Performing recovery while the instance is active
Stopping the instance before performing recovery
The following table shows the different steps to be performed depending on whether you stop the instance.
No | Step | Instance stopped | |
---|---|---|---|
No | Yes | ||
1 | Stop transaction log mirroring | Y | N |
2 | Stop output of archive logs | Y | N |
3 | Stop applications | N | Y |
4 | Stop the instance | N | Y |
5 | Temporarily save backup data | Y | Y |
6 | Resume output of archive logs | Y | N |
7 | Resume transaction log mirroring | Y | N |
8 | Start an instance | N | Y |
9 | Run backup | Y | Y |
10 | Resume applications | N | Y |
11 | Delete temporarily saved backup data | Y | Y |
Y: Required
N: Not required
The procedure is as follows:
Performing recovery while the instance is active
Stop transaction log mirroring
Stop transaction log mirroring.
postgres=# SELECT pgx_pause_wal_multiplexing(); LOG: multiplexing of transaction log files has been stopped pgx_pause_wal_multiplexing ---------------------------- (1 row)
Stop output of archive logs
Transaction logs may accumulate during replacement of backup storage disk, and if the data storage disk or the transaction log storage disk becomes full, there is a risk that operations may not be able to continue.
To prevent this, use the following methods to stop output of archive logs.
Changing the archive_command parameter
Specify a command that will surely complete normally, such as "echo skipped archiving WAL file %f" or "/bin/true", so that archive logs will be regarded as having been output.
If you specify echo, a message is output to the server log, so it may be used as a reference when you conduct investigations.
Reloading the configuration file
Run the pg_ctl reload command or the pg_reload_conf SQL function.
If you simply want to stop output of errors without the risk that operations will not be able to continue, specify an empty string (") in archive_command and reload the configuration file.
Temporarily save backup data
Move backup data to a different directory and temporarily save it, and secure space in the backup data storage destination directory.
The reason for saving the backup data is so that the data in the data storage destination can be recovered even if it is corrupted before you perform the next step. If there is no disk at the save destination and you consider that there is no risk of corruption at the data storage destination, delete the backup data.
The following example saves backup data from the backup data storage destination directory (/backup/inst1) under /mnt/usb/backup.
> mkdir /mnt/usb/backup/ > mv /backup/inst1/* /mnt/usb/backup/
Resume output of archive logs
Return the archive_command setting to its original value, and reload the configuration file.
Resume transaction log mirroring
Execute the pgx_resume_wal_multiplexing SQL function.
SELECT pgx_resume_wal_multiplexing()
Run backup
Use the pgx_dmpall command to back up the database cluster.
Specify the following option in the pgx_dmpall command:
Specify the directory of the data storage destination in the -D option. If the -D option is omitted, the value of the PGDATA environment variable is used by default.
> pgx_dmpall -D /database/inst1
Delete temporarily saved backup data
If backup completes normally, the temporarily saved backup data becomes unnecessary and is deleted.
The following example deletes backup data that was temporarily saved in /mnt/usb.
> rm -rf /mnt/usb/backup
If an instance has been stopped
Stop applications
Stop applications that are using the database.
Stop the instance
Stop the instance. Refer to "2.1.2 Using Server Commands" for details.
If the instance fails to stop, refer to "17.11 Actions in Response to Failure to Stop an Instance".
Temporarily save backup data
Move backup data to a different directory and temporarily save it, and secure space in the backup data storage destination directory.
The reason for saving the backup data is so that the data in the data storage destination can be recovered even if it is corrupted before you perform recovery. If there is no disk at the save destination and you consider that there is no risk of corruption at the data storage destination, delete the backup data.
The following example saves backup data from the backup data storage destination directory (/backup/inst1) under /mnt/usb/backup.
> mkdir /mnt/usb/backup/ > mv /backup/inst1/* /mnt/usb/backup/
Start the instance
Start the instance. Refer to "2.1.2 Using Server Commands" for information on how to start an instance.
Run backup
Use the pgx_dmpall command to back up the database cluster.
Specify the following value in the pgx_dmpall command:
Specify the data storage destination in the -D option. If the -D option is omitted, the value of the PGDATA environment variable is used by default.
> pgx_dmpall -D /database/inst1
Resume applications
Resume applications that are using the database.
Delete temporarily saved backup data
If backup completes normally, the temporarily saved backup data becomes unnecessary and is deleted.
The following example deletes backup data that was temporarily saved in /mnt/usb.
> rm -rf /mnt/usb/backup
See
Refer to "pgx_rcvall" and "pgx_dmpall" in the Reference for information on the pgx_rcvall command and pgx_dmpall command.
Refer to "Write Ahead Log" under "Server Administration" in the PostgreSQL Documentation for information on archive_command.
Refer to "B.1 WAL Mirroring Control Functions" for information on the pgx_is_wal_multiplexing_paused and pgx_resume_wal_multiplexing.