Recover Data from Undo and Redo

Use PDU's Undo or Redo recovery commands to find older physical records or replay a consistent base copy to a selected position. Follow the preparation, scanning and export steps below.


I. Initialization

param datadir /recovery-input/mysql/data;
b;
use appdb;

Provide external Undo and system-tablespace files with spacepaths and systemfiles. Retain original rejection reasons for missing sources without substituting files from another instance.


II. Scan Undo History

param resmode undo;
param restype all;
scan orders;
restore tx all;

Recovery requires surviving physical old values and transaction records. Purged values cannot be recreated from current records alone. ACTIVE/PREPARED or unknown states cannot be treated as committed accidental operations.


III. Replay a Redo Page View

param datadir /recovery-input/base-before;
param redo /recovery-input/redo-after;
param redobaselsn <verified_base_lsn>;
param redoendlsn <verified_complete_mtr_end>;
param resmode redo;
b;
use appdb;
unload db appdb;

Replace bracketed parameters with verified LSN values. The target must lie in retained logs at a complete MTR boundary. Base pages cannot be newer than the target, and a newer current directory cannot substitute for an older base copy.


IV. Generate Offline Reconstruction SQL

param restoretarget rebuild;
param restype all;
scan all;
restore tx all;

rebuild requires a complete consistent snapshot matching the log endpoint and all persistent Undo. Binlog or an isolated IBD cannot construct a current snapshot alone. Retain E_REBUILD_PENDING and stop when persistent ACTIVE/PREPARED transactions remain.

PDU generates SQL only. Database creation, snapshot loading and index creation are outside a single rollback scope for inverse transactions. The user arranges execution separately in an isolated target.


Output Files

Scan records include the starting position, requested stopping point, actual replay end and transaction states. Recovery uses the saved scan results. Create a new task if the sources or target positions change.

After export, record native success and failure counts and original errors. Resume uses records and file metadata such as existence and size without rereading or validating exported data.

MySQL 文档