Overview

PDU provides powerful data recovery capabilities for various PostgreSQL disaster scenarios. Choose the appropriate recovery method based on your situation.

Choose Your Recovery Scenario


Recovery Scenario Comparison

ScenarioRequired ConfigurationData SourceRecovery Speed
Corrupted Data FilePGDATAData file directlyFast
Corrupted InstancePGDATAData file directlySlower
Single Database DirectoryDatabase directory pathDatabase directoryMedium
Deleted RecordsPGDATA + ARCHIVE_DESTWAL archive filesFast
Updated RecordsPGDATA + ARCHIVE_DESTWAL archive filesFast
Dropped TablesPGDATA + DISK_PATHDisk fragment scanningSlower

Quick Start

All recovery operations share a common initialization process. Here's the basic workflow:

1. Configure pdu.ini

vim pdu.ini
#PostgreSQL data directory
PGDATA=/home/pg/data
#PostgreSQL archive directory (required for DELETE/UPDATE recovery)
ARCHIVE_DEST=/home/pg/wal_arch
#Disk path (required for DROP TABLE recovery)
DISK_PATH=/dev/mapper/data-lv

2. Start PDU and Initialize

./pdu
 
PDU.public=# b;
 
Initializing...
 -pg_database:</home/pg/data/global/1262>
 
Database:postgres
      -pg_schema:</home/pg/data/base/5/2615>
      -pg_class:</home/pg/data/base/5/1259> Total 82 rows
      Schemas:
 public 10 tables

3. Choose Recovery Method

After initialization, select the appropriate recovery guide from the sidebar based on your scenario.

Tip

For best results, attempt recovery as soon as possible after data loss. The longer you wait, the higher the risk that disk space may be overwritten.