Protect the Recovery Scene

When a database incident occurs, protect the recovery scene before choosing a recovery method. The following sections describe the materials to preserve for startup failures, accidental DELETE/UPDATE and dropped tables.


Scenario 1: The Database Cannot Start or Data Files Are Damaged

  • Copy the complete data directory, including ibdata, table files, FRM/SDI, Redo, Undo and external tablespaces.
  • For encrypted tables, preserve matching keyring evidence. For partitioned tables, preserve every related partition file.
  • Record the exact version, storage engine, table definitions and incident time. Launch PDU in a result directory outside the sources.

Scenario 2: Accidental DELETE or UPDATE

Preserve Binlog covering the incident range and matching table definitions promptly. Recovery requires complete transactions and evidenced row images.

Binlog Is Available

Copy closed numbered logs and the .index list. Record the incident time, target database and table, relevant transactions and log positions. Do not purge logs needed for the incident.

param binlog /recovery-input/mysql/binlog;
ckbinlog;

Complete Binlog Is Not Available

Preserve copies of data files, system tablespaces, Undo and Redo. Other recovery paths depend on surviving delete marks, Undo history and logs. Data already purged with no other old image cannot be recreated.


Scenario 3: One or More Tables Were Dropped or Truncated

1. Identify the Data Directory and Its Disk Device

Use the original configuration and mount information to record the data directory, external tablespaces and devices. Run DropScan against a preserved image without requiring filesystem directory recovery first.

2. Prepare PDU on Another Disk

Place the program, source manifest, scan task and recovery output in separate locations. Confirm read-only sources and sufficient output space before scanning.

3. Configure the Source Manifest

The source manifest records the image path, scan range, source domain and object generation. Preserve unknown attribution explicitly rather than inferring business objects from space_id or index_id.

4. Scan the Preserved Disk Image

Launch PDU in the result directory. ds idx reports DS_TASK. Replace <DS_TASK> in subsequent examples with the absolute task path from this run; do not specify another output directory.

ds idx /recovery-input/sources.manifest;
ds show <DS_TASK> all;

See the detailed procedure for recovering dropped tables without backups.

MySQL 文档