All Products
Search
Document Center

PolarDB:Restore data using DMS data tracking

Last Updated:Jun 20, 2026

The DMS data tracking feature lets you quickly find relevant updates within a specific time range, generate a rollback script, and execute it via a data change ticket to restore your data. This method is recommended for reversing accidental operations that affect fewer than 100,000 rows.

Prerequisites

  • The binary log feature is enabled for the cluster. For more information, see Enable the binary log.

  • If your cluster is in flexible management or stable change control mode in DMS, you must first log on to the target cluster through the DMS console.

Step 1: Find records and generate rollback script

Submit a data tracking ticket in the DMS console. Once approved, you can select the change records to roll back from the parsed logs and generate a rollback script.

  1. Log on to the new DMS console.

  2. In the top navigation bar, choose Database Development > Data Tracking > Data Tracking Ticket.

  3. In the upper-right corner of the page, click +Data Tracking.

  4. On the Data Tracking Tickets page, configure the following parameters.

    数据追踪

    Parameter

    Description

    Task Name

    A custom name for the task. This helps you find the ticket later and clarifies its purpose for approvers.

    Database Name

    The database where the accidental operation occurred.

    Table Name

    The table where the accidental operation occurred.

    Track Type

    The types of operations that you want to track. You can select multiple types.

    Time Range

    The default range is the last 2 hours. A single ticket can track a maximum duration of 6 hours. For longer periods, create multiple tickets. The earliest trackable time is limited by the oldest binary log file stored on the database server.

  5. Click Submit. The system then retrieves the log files.

    After the log files are retrieved, the ticket enters the approval process.

    Note

    If the binary log is not enabled or you are not logged on to the database, the system cannot retrieve the log files.

  6. Wait for the ticket to be approved.

    Note

    By default, the database administrator (DBA) assigned to the database approves data tracking tickets.

  7. After the ticket is approved, the system downloads and parses the logs.

  8. When parsing is complete, select the records to roll back and click Export Rollback Script.

Step 2: Execute the rollback

After exporting the rollback script, submit a data change ticket. You can attach the script to the ticket for execution against the target database.

  1. In the top navigation bar of the DMS console, choose Database Development > Data Change > Normal Data Modify.

  2. Complete the Data Change Ticket Application as described in the table below, and then click Submit Application.

    Table 1. Data change parameter descriptions

    Parameter

    Description

    Database

    The database to restore.

    Affected Rows

    The estimated number of affected rows. You can use a count query in SQLConsole to get an accurate number.

    Change SQL

    Select Attachments and upload the rollback script generated in Step 1.

  3. After the ticket is submitted, the system validates it.

  4. After the validation passes, click Submit for approval. Once approved, an execution task is created.

    Note

    By default, the corresponding DBA approves data change tickets.

  5. Click Execute Change.