# US 2026/0030120 A1 · Database recovery method and apparatus

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2026/0030120 A1
- Document ID: US20260030120A1
- Status: Published application
- Kind: A1
- Application number: 19/341,934
- Filed: 2025-09-26
- Published: 2026-01-29
- Earliest claimed: 2023-03-29
- Assignees: Huawei Cloud Computing Technologies Co., Ltd.
- Applicants: Huawei Cloud Computing Technologies Co., Ltd.
- Inventors: Cheng Zhao; Lengdong Wu; Chenyang Niu; Meng Wang; Jiwei Zhang
- Web page: https://patentgrep.com/patent/US20260030120A1

## CPC

- G06F 11/1469: {Backup restoration techniques}
- G06F 11/14: Error detection or correction of the data by redundancy in operations (error detection or correction of the data by redundancy in hardware G06F11/16)
- G06F 11/1448: {Management of the data involved in backup or backup restore}
- G06F 11/1451: {by selection of backup contents}
- G06F 11/1471: involving logging of persistent data for recovery
- G06F 16/2358: {Change logging, detection, and notification (replication G06F16/27)}
- G06F 2201/80: Database-specific techniques
- G06F 2201/84: Using snapshots, i.e. a logical point-in-time copy of the data
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

This application discloses a database recovery method and apparatus, and pertains to the field of database technologies. After receiving a recovery instruction for a database, a computer device queries, based on a recovery moment indicated by the recovery instruction, an LSN and time association log for an LSN corresponding to the recovery moment, obtains recovery data of the database based on the LSN corresponding to the recovery moment, and performs data recovery on the database based on the recovery data. Then, a start LSN used by a database corresponding to the recovery moment is greater than an LSN corresponding to a current moment. After the database is rolled back from the current moment to a historical moment, an LSN greater than the LSN corresponding to the current moment is applied to the database starting from the LSN corresponding to the current moment.

## Claims

### Claim 1

A database recovery method, wherein the method comprises:
in response to receiving, at a first moment, a first recovery instruction for a database, querying, based on a first recovery moment indicated by the first recovery instruction, a log sequence number (LSN) and time association log for a first LSN corresponding to the first recovery moment, wherein the LSN and time association log is used to record LSNs respectively corresponding to a plurality of moments in the database, and the first recovery moment is earlier than the first moment in time sequence;
obtaining first recovery data of the database based on the first LSN; and
performing data recovery on the database based on the first recovery data, to obtain a database corresponding to the first recovery moment, wherein a start LSN used by the database corresponding to the first recovery moment is greater than an LSN corresponding to the first moment.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the start LSN used by the database corresponding to the first recovery moment is a next LSN of the LSN corresponding to the first moment.

### Claim 3 (depends on 1)

The method according to claim 1, further comprising:
in response to receiving an operation instruction for the database corresponding to the first recovery moment, executing the operation instruction, and
generating a redo log corresponding to the operation instruction, wherein an LSN of the redo log is greater than the LSN corresponding to the first moment.

### Claim 4 (depends on 1)

The method according to claim 1, wherein obtaining the first recovery data of the database based on the first LSN comprises:
obtaining a first full backup snapshot from a full backup of the database based on the first LSN, wherein an LSN of the first full backup snapshot is less than the first LSN; and
obtaining a first redo log set from an incremental backup of the database based on the LSN of the first full backup snapshot and the first LSN, wherein the first redo log set comprises a redo log whose LSN is between the LSN of the first full backup snapshot and the first LSN; and
performing the data recovery on the database based on the first recovery data, to obtain the database corresponding to the first recovery moment comprises:
updating the database to a first database obtained through recovery by using the first full backup snapshot; and
sequentially performing forward recovery on the first database in ascending order of LSNs by using the redo log in the first redo log set, to obtain the database corresponding to the first recovery moment.

### Claim 5 (depends on 1)

The method according to claim 1, wherein obtaining the first recovery data of the database based on the first LSN comprises:
obtaining a second full backup snapshot from a full backup of the database based on the first LSN, wherein an LSN of the second full backup snapshot is greater than the first LSN; and
obtaining a second redo log set from an incremental backup of the database based on the first LSN and the LSN of the second full backup snapshot, wherein the second redo log set comprises a redo log whose LSN is between the first LSN and the LSN of the second full backup snapshot; and
performing the data recovery on the database based on the first recovery data, to obtain the database corresponding to the first recovery moment comprises:
updating the database to a second database obtained through recovery by using the second full backup snapshot; and
sequentially performing reverse recovery on the second database in descending order of LSNs by using the redo log in the second redo log set, to obtain the database corresponding to the first recovery moment.

### Claim 6 (depends on 1)

The method according to claim 1, wherein obtaining the first recovery data of the database based on the first LSN comprises:
obtaining a third full backup snapshot from a full backup of the database based on the first LSN, wherein an LSN of the third full backup snapshot is equal to the first LSN; and
performing the data recovery on the database based on the first recovery data, to obtain the database corresponding to the first recovery moment comprises:
updating the database to a third database obtained through recovery by using the third full backup snapshot, and using the third database as the database corresponding to the first recovery moment.

### Claim 7 (depends on 1)

The method according to claim 1, wherein the first recovery instruction is an nth recovery instruction for the database, n=1, and obtaining the first recovery data of the database based on the first LSN comprises:
obtaining a third redo log set from an incremental backup of the database based on the first LSN and the LSN corresponding to the first moment, wherein the third redo log set comprises a redo log whose LSN is between the first LSN and the LSN corresponding to the first moment; and
performing the data recovery on the database based on the first recovery data, to obtain the database corresponding to the first recovery moment comprises:
sequentially performing reverse recovery on the database in descending order of LSNs by using the redo log in the third redo log set, to obtain the database corresponding to the first recovery moment.

### Claim 8 (depends on 1)

The method according to claim 1, wherein the first recovery instruction is an nth recovery instruction for the database, n≥2, and obtaining the first recovery data of the database based on the first LSN comprises:
obtaining a fourth redo log set from an incremental backup of the database based on the first LSN and the LSN corresponding to the first moment, wherein the fourth redo log set comprises a redo log whose LSN is between a start LSN used by a database corresponding to a previous recovery moment and the LSN corresponding to the first moment, and a redo log whose LSN is between an LSN corresponding to the previous recovery moment and the first LSN; and
performing the data recovery on the database based on the first recovery data, to obtain the database corresponding to the first recovery moment comprises:
sequentially performing reverse recovery on the database in descending order of LSNs by using the redo log whose LSN is between the start LSN used by the database corresponding to the previous recovery moment and the LSN corresponding to the first moment, to obtain the database corresponding to the previous recovery moment; and
performing, by using the redo log whose LSN is between the LSN corresponding to the previous recovery moment and the first LSN, recovery on the database corresponding to the previous recovery moment, to obtain the database corresponding to the first recovery moment.

### Claim 9 (depends on 1)

The method according to claim 1, further comprising:
in response to receiving, at a second moment, a second recovery instruction for the database, querying, based on a second recovery moment indicated by the second recovery instruction, the LSN and time association log for a second LSN corresponding to the second recovery moment earlier than the second moment in time sequence;
obtaining second recovery data of the database based on the second LSN; and
performing data recovery on the database based on the second recovery data, to obtain a database corresponding to the second recovery moment, wherein a start LSN used by the database corresponding to the second recovery moment is greater than an LSN corresponding to the second moment.

### Claim 10 (depends on 9)

The method according to claim 9, wherein the second recovery moment is later than the first recovery moment in time sequence, and the second recovery moment is earlier than the first moment in time sequence.

### Claim 11 (depends on 1)

The method according to claim 1, wherein the method further comprises:
adding database recovery timeline information corresponding to the first recovery moment to a timeline log, wherein the database recovery timeline information comprises a recovery LSN, a start LSN, and an end LSN, the recovery LSN is the first LSN, the start LSN is the start LSN used by the database corresponding to the first recovery moment, and the end LSN is an LSN corresponding to an end moment of a next recovery instruction.

### Claim 12

A database recovery apparatus, comprising:
a processor, and
a memory coupled to the processor to store instructions, which when executed by the processor, cause the database recovery apparatus to:
in response to receiving, at a first moment, a first recovery instruction for a database, query, based on a first recovery moment indicated by the first recovery instruction, a log sequence number (LSN) and time association log for a first LSN corresponding to the first recovery moment, wherein the LSN and time association log is used to record LSNs respectively corresponding to a plurality of moments in the database, and the first recovery moment is earlier than the first moment in time sequence;
obtain first recovery data of the database based on the first LSN; and
perform data recovery on the database based on the first recovery data, to obtain a database corresponding to the first recovery moment, wherein a start LSN used by the database corresponding to the first recovery moment is greater than an LSN corresponding to the first moment.

### Claim 13 (depends on 12)

The apparatus according to claim 12, wherein the start LSN used by the database corresponding to the first recovery moment is a next LSN of the LSN corresponding to the first moment.

### Claim 14 (depends on 12)

The apparatus according to claim 12, wherein the instructions, when executed, further cause the database recovery apparatus to:
after the data recovery is performed on the database based on the first recovery data to obtain the database corresponding to the first recovery moment, execute, in response to receiving an operation instruction for the database corresponding to the first recovery moment, the operation instruction; and
generate a redo log corresponding to the operation instruction, wherein an LSN of the redo log is greater than the LSN corresponding to the first moment.

### Claim 15 (depends on 12)

The apparatus according to claim 12, wherein the instructions, when executed, further cause the database recovery apparatus to:
obtain a first full backup snapshot from a full backup of the database based on the first LSN, wherein an LSN of the first full backup snapshot is less than the first LSN; and obtain a first redo log set from an incremental backup of the database based on the LSN of the first full backup snapshot and the first LSN, wherein the first redo log set comprises a redo log whose LSN is between the LSN of the first full backup snapshot and the first LSN; and
update the database to a first database obtained through recovery by using the first full backup snapshot; and sequentially perform forward recovery on the first database in ascending order of LSNs by using the redo log in the first redo log set, to obtain the database corresponding to the first recovery moment.

### Claim 16 (depends on 12)

The apparatus according to claim 12, wherein the the instructions, when executed, further cause the database recovery apparatus to:
obtain a second full backup snapshot from a full backup of the database based on the first LSN, wherein an LSN of the second full backup snapshot is greater than the first LSN; and obtain a second redo log set from an incremental backup of the database based on the first LSN and the LSN of the second full backup snapshot, wherein the second redo log set comprises a redo log whose LSN is between the first LSN and the LSN of the second full backup snapshot; and
update the database to a second database obtained through recovery by using the second full backup snapshot; and sequentially perform reverse recovery on the second database in descending order of LSNs by using the redo log in the second redo log set, to obtain the database corresponding to the first recovery moment.

### Claim 17 (depends on 12)

The apparatus according to claim 12, wherein the instructions, when executed, further cause the database recovery apparatus to:
obtain a third full backup snapshot from a full backup of the database based on the first LSN, wherein an LSN of the third full backup snapshot is equal to the first LSN; and
update the database to a third database obtained through recovery by using the third full backup snapshot, and use the third database as the database corresponding to the first recovery moment.

### Claim 18 (depends on 12)

The apparatus according to claim 12, wherein the first recovery instruction is an nth recovery instruction for the database, wherein n=1;
the instructions, when executed, further cause the database recovery apparatus to:
obtain a third redo log set from an incremental backup of the database based on the first LSN and the LSN corresponding to the first moment, wherein the third redo log set comprises a redo log whose LSN is between the first LSN and the LSN corresponding to the first moment; and
sequentially perform reverse recovery on the database in descending order of LSNs by using the redo log in the third redo log set, to obtain the database corresponding to the first recovery moment.

### Claim 19 (depends on 12)

The apparatus according to claim 12, wherein the first recovery instruction is an nth recovery instruction for the database, wherein n≥2;
the instructions, when executed, further cause the database recovery apparatus to:
obtain a fourth redo log set from an incremental backup of the database based on the first LSN and the LSN corresponding to the first moment, wherein the fourth redo log set comprises a redo log whose LSN is between a start LSN used by a database corresponding to a previous recovery moment and the LSN corresponding to the first moment, and a redo log whose LSN is between an LSN corresponding to the previous recovery moment and the first LSN; and
sequentially perform reverse recovery on the database in descending order of LSNs by using the redo log whose LSN is between the start LSN used by the database corresponding to the previous recovery moment and the LSN corresponding to the first moment, to obtain the database corresponding to the previous recovery moment; and perform recovery on the database corresponding to the previous recovery moment by using the redo log whose LSN is between the LSN corresponding to the previous recovery moment and the first LSN, to obtain the database corresponding to the first recovery moment.

### Claim 20

A non-transitory machine-readable storage medium having instructions stored therein, which when executed by a processor, cause the processor to:
in response to receiving, at a first moment, a first recovery instruction for the database, query, based on a first recovery moment indicated by the first recovery instruction, a log sequence number (LSN) and time association log for a first LSN corresponding to the first recovery moment, wherein the first recovery moment is earlier than the first moment in time sequence;
obtain first recovery data of the database based on the first LSN; and
perform data recovery on the database based on the first recovery data, to obtain a database corresponding to the first recovery moment, wherein a start LSN used by the database corresponding to the first recovery moment is greater than an LSN corresponding to the first moment.
