DM-recovery: Dameng DM8 Database Recovery Capability Assessment

Foreword

The ecological core of DeepSeek Harness (DSH) lies in plugin-ization. For Dameng DM8 database operators, a common pain point is the lack of a structured method to assess the actual recovery capability of a database after a disaster. The DM-recovery plugin aims to fill this gap by comparing recovery scenarios with the actual database state and outputting an objective recovery capability report.

What This Is

DM-recovery is a recoverability assessment plugin for Dameng DM8 databases. Maintained by Shiyuedong-Jade and open-sourced under the MIT License. It does not perform repairs or scans; instead, by checking in-database metadata and (optionally) host-side read-only commands, it answers the questions of “to which point can it be recovered” and “what data needs to be discarded.”

Core Features

The plugin primarily evaluates 16 recovery scenarios and outputs five levels of capability determination:

  1. 16 Recovery Scenarios: Covering logical corruption (5 items), physical corruption (8 items), and cluster disaster recovery (3 items). Including single record accidental deletion, entire table accidental DROP/TRUNCATE, single page/single file corruption, control file loss, DMDSC node failure, etc.
  2. Five-Level Capability Determination: For each scenario, determines “Recoverable”, “Only coarse-grained recovery possible”, “Unrecoverable”, “Cannot determine”, or “Not applicable”.
  3. Archive Chain Segment-by-Segment Verification: Verify the continuity of the archive chain, check the unarchived tail and traceable starting point.
  4. Backup Availability Verification: Verify the credibility of backup sets from three dimensions: “ledger (V$BACKUPSET)”, “disk location”, and “backup path provided by the caller”.
  5. DMDSC Support: Supports per-node verification of parameter differences, bad page ownership, and archive directory self-sufficiency.
  6. Optional SSH Read-Only Verification: Execute dmrman CHECK BACKUPSET, log scanning, and file searching on the database host to obtain evidence of bad pages that cannot be obtained through in-database queries.
  7. HTML Report and findings: Generate an HTML report containing scenario comparison tables and conclusion summaries, along with findings.json for machine parsing.

Installation and Activation

In the DSH environment, install using the official plugin command:

dsh plugin --profile web add github:Shiyuedong-Jade/DM-recovery

After installation, dsh web needs to be restarted for the first run. Since the Dameng JDBC driver is a commercial component and is not distributed with the plugin, it must be manually placed in the working directory:

Platform Path
Windows %USERPROFILE%\.dsh\dm-recovery-readiness\drivers\
Linux ~/.dsh/dm-recovery-readiness/drivers/

Ensure the DmJdbcDriver8.jar file exists in the path.

Usage

Invoke the dm_recovery_readiness command in a session. This command has one required parameter action, supporting the following 6 actions:

action Description
report Generate HTML report and findings.json, this is the main output
readiness Execute disposal capability check, determine if online repair and recovery degree are possible
list Query bad page list, determine if re-repair is needed
triage Page-by-page triage, locate bad pages to specific objects and provide disposal paths
backup Check backup availability, verify ledger, disk, and custom paths
capacity Check archive space parameters and traceable window

Basic Parameters

Parameter Type Default Description
action string Required Specify one of the above actions
host string — Database server IP or hostname, supports host:port
port integer 5236 Database port
user string SYSDBA Database account
targets string — DMDSC node list, format host:port, comma-separated
outDir string Under plugin working directory Report output directory
backupPath string — When backup action is used, the backup location provided by the caller
sshHost string — Database host IP for host-side verification, if empty then only JDBC query is performed

Examples

Generate a recovery capability report:

dm_recovery_readiness report host=10.0.0.61 user=SYSDBA

Check backup availability:

dm_recovery_readiness backup host=10.0.0.61 backupPath=/path/to/backup

Report and Output

The report action generates two files in the output directory:

  1. dm-recovery-<dbname>-<timestamp>.html: Contains comparison tables for 16 scenarios, capability summary, and disposal suggestions.
  2. dm-recovery-<dbname>-<timestamp>.findings.json: Structured data for automated processing.

Reports are output to dm-recovery-reports under the plugin working directory by default.

Security and Permissions

This plugin adopts a pure read-only design:

  • In-database operations: All SQL are query statements.
  • Host operations: If SSH is configured, only three read-only commands are executed (dmrman CHECK BACKUPSET, log scanning script, file searching). No repair, recovery, or configuration modification operations are performed.

Use Cases and Notes

  • Applicable scenarios: Regular recovery capability check-ups, evaluating the survival capability of DM8 instances when encountering logical or physical corruption, and the rationality of DMDSC cluster disaster recovery configuration.
  • Prerequisites:
    • Node.js ≥ 20
    • Java ≥ 8 (for bridging)
    • Dameng JDBC driver DmJdbcDriver8.jar must be provided by yourself
    • DeepSeek Harness 0.1.x
    • If host verification is needed, plink (host key fingerprint needs to be confirmed) and manually copied script scan-backup-log.sh to the database host are required.

Brief Conclusion

The DM-recovery plugin provides a standardized recovery capability assessment method for Dameng database operations. Through structured scenario testing and detailed HTML reports, DBAs can quickly locate critical issues such as archive chain breaks, backup unavailability, or cluster configuration deficiencies. Its read-only feature ensures data safety during the assessment process.

GitHub Repository

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye