# US 11,308,048 B2 · Database migration method, apparatus, device, and computer-readable medium

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

- Number: US 11,308,048 B2
- Document ID: US11308048B2
- Status: Granted
- Kind: B2
- Application number: 17/243,391
- Filed: 2021-04-28
- Published: 2021-08-12
- Granted: 2022-04-19
- Earliest claimed: 2019-03-26
- Assignees: Beijing OceanBase Technology Co., Ltd.
- Applicants: Beijing Oceanbase Technology Co., Ltd.
- Inventors: Hu Xu; Yuzhong Zhao; Min Yang
- Web page: https://patentgrep.com/patent/US11308048B2

## CPC

- G06F 16/214: {Database migration support}
- G06F 16/27: Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present specification discloses a database migration method, including: copying metadata from a first server of a database, the metadata including identification information of synthetic data; receiving a service instruction sent by a client after the copying the metadata from the first server of the database; determining, based on the service instruction, whether the synthetic data needs to be retrieved from the first server of the database; and in response to it is determined that the synthetic data needs to be retrieved from the first server of the database, copying the synthetic data from the first server of the database based on the identification information of the synthetic data. According to the present disclosure, the service instruction sent by the client is received in advance, and the synthetic data is copied from the first server of the database based on the identification information of the synthetic data, thereby reducing time taken for database migration.

## Claims

### Claim 1

A database migration method, comprising:
copying metadata from a first server of a database to a second server of the database, the metadata including identification information of synthetic data;
receiving, by the second server, a service instruction sent by a client after the copying the metadata from the first server of the database;
determining, by the second server and based on the service instruction, whether the synthetic data needs to be retrieved from the first server of the database;
in response to it is determined that the synthetic data needs to be retrieved from the first server of the database, requesting, by the second server, to copy the synthetic data of the database from the first server by sending the identification information of the synthetic data to the first server; and
copying the synthetic data from the first server of the database to the second server based on the identification information of the synthetic data sent by the second server.

### Claim 2 (depends on 1)

The database migration method according to claim 1, wherein the service instruction retrieves incremental data, and the metadata further includes identification information of the incremental data; and
wherein the method further comprises:
before the receiving the service instruction sent by the client, copying the incremental data from the first server of the database based on the identification information of the incremental data; and
after the copying the incremental data from the first server of the database, receiving the service instruction sent by the client.

### Claim 3 (depends on 2)

The database migration method according to claim 2, further comprising: after the receiving the service instruction sent by the client,
copying the synthetic data from the first server of the database based on the identification information of the synthetic data.

### Claim 4 (depends on 3)

The database migration method according to claim 3, further comprising: after the copying the synthetic data from the first server of the database,
deleting the first server of the database.

### Claim 5 (depends on 4)

The database migration method according to claim 4, further comprising:
before the copying the metadata from the first server of the database;
setting a synchronization position in a log of the first server of the database;
copying the incremental data and the synthetic data from the first server of the database before the synchronization position; and
copying incremental data and synthetic data from the log after the synchronization position.

### Claim 6 (depends on 2)

The database migration method according to claim 2, wherein the identification information of the incremental data includes an identifier of a table to which the incremental data belongs and an identifier of a partition to which the incremental data belongs.

### Claim 7 (depends on 2)

The database migration method according to claim 2, wherein the incremental data includes first incremental data and persistently stored second incremental data, and the first incremental data is converted into the second incremental data in response to a storage amount of the first incremental data reaches a threshold.

### Claim 8 (depends on 7)

The database migration method according to claim 7, wherein the synthetic data is formed through the second incremental data being merged with previously stored synthetic data, macroblocks are generated each time the synthetic data is formed, and the synthetic data includes a plurality of macroblocks.

### Claim 9 (depends on 8)

The database migration method according to claim 8, wherein the identification information of the synthetic data includes an identifier of a table to which the macroblocks belong, an identifier of a partition to which the macroblocks belong, a number of times the macroblocks are merged, and serial numbers of the macroblocks in a same merging.

### Claim 10

A computer-readable medium, wherein the computer-readable medium stores computer-readable instructions, which when executed by a processor enable the processor to implement acts including:
copying metadata from a first server of a database to a second server of the database, the metadata including identification information of synthetic data;
receiving, by the second server, a service instruction sent by a client after the copying the metadata from the first server of the database;
determining, by the second server and based on the service instruction, whether the synthetic data needs to be retrieved from the first server of the database;
in response to it is determined that the synthetic data needs to be retrieved from the first server of the database, requesting, by the second server, to copy the synthetic data of the database from the first server by sending the identification information of the synthetic data to the first server; and
copying the synthetic data from the first server of the database to the second server based on the identification information of the synthetic data sent by the second server.

### Claim 11

A database migration device, comprising a memory storing executable instructions and a processor configured to execute the executable instructions, thereby implementing acts including:
copying metadata from a first server of a database to a second server of the database, the metadata including identification information of synthetic data;
receiving, by the second server, a service instruction sent by a client after the copying the metadata from the first server of the database;
determining, by the second server and based on the service instruction, whether the synthetic data needs to be retrieved from the first server of the database;
in response to it is determined that the synthetic data needs to be retrieved from the first server of the database, requesting, by the second server, to copy the synthetic data of the database from first server by sending the identification information of the synthetic data to the first server; and
copying the synthetic data from the first server of the database to the second server based on the identification information of the synthetic data sent by the second server.

### Claim 12 (depends on 11)

The device according to claim 11, wherein the service instruction retrieves incremental data, and the metadata further includes identification information of the incremental data; and
wherein the acts include:
before the receiving the service instruction sent by the client, copying the incremental data from the first server of the database based on the identification information of the incremental data; and
after the copying the incremental data from the first server of the database, receiving the service instruction sent by the client.

### Claim 13 (depends on 12)

The device according to claim 12, wherein the acts include:
after the receiving the service instruction sent by the client, copying the synthetic data from the first server of the database based on the identification information of the synthetic data.

### Claim 14 (depends on 13)

The device according to claim 13, wherein the acts include:
after the copying the synthetic data from the first server of the database, deleting the first server of the database.

### Claim 15 (depends on 14)

The device according to claim 14, wherein the act includes:
before the copying the metadata from the first server of the database,
setting a synchronization position in a log of the first server of the database,
copying the incremental data and the synthetic data from the first server of the database before the synchronization position, and
copying incremental data and synthetic data from the log after the synchronization position.

### Claim 16 (depends on 12)

The device according to claim 12, wherein the identification information of the incremental data includes an identifier of a table to which the incremental data belongs and an identifier of a partition to which the incremental data belongs.

### Claim 17 (depends on 12)

The device according to claim 12, wherein the incremental data includes first incremental data and persistently stored second incremental data, and the first incremental data is converted into the second incremental data in response to a storage amount of the first incremental data reaches a threshold.

### Claim 18 (depends on 17)

The device according to claim 17, wherein the synthetic data is formed through the second incremental data being merged with previously stored synthetic data, macroblocks are generated each time the synthetic data is formed, and the synthetic data includes a plurality of macroblocks.

### Claim 19 (depends on 18)

The device according to claim 18, wherein the identification information of the synthetic data includes an identifier of a table to which the macroblocks belong, an identifier of a partition to which the macroblocks belong, a number of times the macroblocks are merged, and serial numbers of the macroblocks in a same merging.

### Claim 20

A data base system, comprising:
a first server of a database; and
a second server of the database, the second server configured to implement a database migration operation including actions of:
copying metadata from the first server of the database to the second server of the database, the metadata including identification information of synthetic data;
receiving a service instruction sent by a client after the copying the metadata from the first server of the database;
determining, based on the service instruction, whether the synthetic data needs to be retrieved from the first server of the database;
in response to determining that the synthetic data needs to be retrieved from the first server of the database, requesting to copy the synthetic data of the database from the first server by sending the identification information of the synthetic data to the first server; and
copying the synthetic data from the first server of the database to the second server based on the identification information of the synthetic data.
