Database migration method and device, equipment and storage medium

Through automated database migration methods and devices, the problem of high labor and high risk in the migration of relational databases to native distributed databases is solved, and efficient and reliable migration tasks are achieved.

CN120578643APending Publication Date: 2025-09-02AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510701677.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-28
Publication Date
2025-09-02

AI Technical Summary

Technical Problem

During the migration from relational databases to native distributed databases, manual code transformation is required, resulting in high workload and high risk.

Method used

Provide a database migration method and device to automatically complete the migration task from a relational database to a native distributed database. By detecting the data migration task type, performing corresponding data processing steps, including data query and insertion tasks, reducing the workload and risks of manual transformation.

Benefits of technology

The automated database migration process is realized, reducing the workload and risks of manual transformation, and improving the efficiency and reliability of migration tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120578643A_ABST
    Figure CN120578643A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a database migration method and device, equipment and a storage medium, and the method comprises the steps: determining a data migration task contained in a data migration instruction under the condition that the data migration instruction is received; wherein the data migration instruction is used for performing data migration from a relational database to a native distributed database; the data migration task comprises a data query task and / or a data insertion task; and executing corresponding data processing steps according to the database migration task and the data migration instruction so as to complete a data processing task corresponding to the data migration instruction. According to the technical scheme, a general processing method for processing the data migration task from the relational database to the native distributed database can be constructed, the migration task from the relational database to the native distributed database is automatically completed, and risk errors and transformation workloads are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of data processing technology, and in particular to a database migration method, apparatus, device, and storage medium. Background Art

[0002] In the work of "relational database migration to native distributed database technology stack migration and transformation", due to the differences in the database's own characteristics and mechanisms, a lot of adaptive transformation of the program logic is required, especially the content related to database transactions.

[0003] For example, when a large amount of data needs to be inserted into a database, manual transaction commit is often used, combining multiple insert operations into a single atomic operation. However, the transaction behavior of native distributed databases differs from that of relational databases: if any SQL statement within a transaction fails, the entire transaction is rolled back. In relational databases, if any SQL statement within a transaction fails, previous or subsequent transactions can still commit.

[0004] In relational databases, the default value of fetchSize is 10, which means that the number of data items read into the ResultSet at a time is 10. In native distributed databases, the default value of fetchSize is 0. When a query is executed, all query result sets are stored in the client memory at once, which may cause memory overflow in extreme cases. Summary of the Invention

[0005] Embodiments of the present invention provide a database migration method, apparatus, device, and storage medium, which can automatically complete the migration task from a relational database to a native distributed database, reducing risk errors and transformation workload.

[0006] In a first aspect, an embodiment of the present invention provides a database migration method, the method comprising:

[0007] Upon receiving a data migration instruction, determining a data migration task included in the data migration instruction; wherein the data migration instruction is used to migrate data from a relational database to a native distributed database; the data migration task includes: a data query task and / or a data insertion task; and executing corresponding data processing steps according to the database migration task and the data migration instruction to complete the data migration task corresponding to the data migration instruction.

[0008] In a second aspect, an embodiment of the present invention provides a database migration device, the device comprising:

[0009] A migration task determination module is configured to, upon receiving a data migration instruction, determine the data migration task contained in the data migration instruction; wherein the data migration instruction is used to migrate data from a relational database to a native distributed database; the data migration task includes: a data query task and / or a data insertion task; and a data processing module is configured to execute corresponding data processing steps according to the database migration task and the data migration instruction to complete the data migration task corresponding to the data migration instruction.

[0010] In a third aspect, an embodiment of the present invention provides a computer device, the computer device comprising:

[0011] one or more processors;

[0012] a memory for storing one or more programs;

[0013] When the one or more programs are executed by the one or more processors, the one or more processors implement the database migration method described in any embodiment.

[0014] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the database migration method described in any embodiment.

[0015] The technical solution provided by the embodiment of the present invention determines the data migration task contained in the data migration instruction upon receiving the data migration instruction; wherein the data migration instruction is used to migrate data from a relational database to a native distributed database; the data migration task includes: a data query task and / or a data insertion task; and corresponding data processing steps are executed according to the database migration task and the data migration instruction to complete the data migration task corresponding to the data migration instruction. The technical solution of the embodiment of the present invention solves the problem in the prior art that, in the process of processing the data migration task from a relational database to a native distributed database, manual code-level modification is required, which results in a large manual workload and high risk. A general processing method for processing the data migration task from a relational database to a native distributed database can be constructed to automatically complete the migration task from a relational database to a native distributed database, reducing risk errors and modification workload. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 This is a flow chart of a database migration method provided by an embodiment of the present invention;

[0017] Figure 2 This is a flowchart of another database migration method provided by an embodiment of the present invention;

[0018] Figure 3 This is a workflow diagram for executing a data insertion task provided by an embodiment of the present invention;

[0019] Figure 4 This is a workflow diagram for executing a data query task provided by an embodiment of the present invention;

[0020] Figure 5 This is a schematic diagram of the structure of a database migration device provided by an embodiment of the present invention;

[0021] Figure 6 It is a structural diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0022] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0023] Figure 1 This is a flowchart of a database migration method provided by an embodiment of the present invention. The embodiment of the present invention can be applied to the scenario of processing data migration tasks from a relational database to a native distributed database. The method can be executed by a database migration device, which can be implemented by software and / or hardware.

[0024] like Figure 1 As shown, the database migration method includes the following steps:

[0025] S110 . Upon receiving a data migration instruction, determine a data migration task included in the data migration instruction.

[0026] Data migration instructions are used to migrate data from a relational database to a native distributed database. A relational database is built on the relational database model and uses concepts and methods such as set algebra to process data. A native distributed database is a database system designed specifically for distributed environments. By distributing data across multiple nodes, it achieves high availability, scalability, and performance.

[0027] Furthermore, the data migration task may be a data processing task for migrating data from a relational database to a native distributed database. Specifically, the data migration task may include multiple types of data processing tasks. For example, the data migration task may include a data query task and a data insertion task. The data insertion task may be a task that requires inserting data from a relational database to a native distributed database. The data query task may be a task that requires querying data from a relational database to a native distributed database. The technical solution of the embodiment of the present invention can execute appropriate data processing steps according to the type of data processing task.

[0028] S120: Execute corresponding data processing steps according to the database migration task and the data migration instruction to complete the data migration task corresponding to the data migration instruction.

[0029] Among them, when the database migration task includes a data query task, the corresponding data query step can be matched to execute the data query task in the database migration task; when the database migration task includes a data insertion task, the corresponding data insertion step can be matched to execute the data insertion task in the database migration task.

[0030] The technical solution provided by the embodiment of the present invention determines the data migration task contained in the data migration instruction upon receiving the data migration instruction; wherein the data migration instruction is used to migrate data from a relational database to a native distributed database; the data migration task includes: a data query task and / or a data insertion task; and corresponding data processing steps are executed according to the database migration task and the data migration instruction to complete the data migration task corresponding to the data migration instruction. The technical solution of the embodiment of the present invention solves the problem in the prior art that, in the process of processing the data migration task from a relational database to a native distributed database, manual code-level modification is required, which results in a large manual workload and high risk. A general processing method for processing the data migration task from a relational database to a native distributed database can be constructed to automatically complete the migration task from a relational database to a native distributed database, reducing risk errors and modification workload.

[0031] Figure 2 This is another flowchart of a database migration method provided by an embodiment of the present invention. This embodiment of the present invention is applicable to processing data migration task scenarios from a relational database to a native distributed database. Based on the above embodiment, this embodiment further illustrates how to execute corresponding data processing steps based on the database migration task and the data migration instructions. The device can be implemented by software and / or hardware and integrated into a computer device with application development capabilities.

[0032] like Figure 2 As shown, the database migration method includes the following steps:

[0033] S210 : When a data migration instruction is received, determine a data migration task included in the data migration instruction.

[0034] Data migration instructions are used to migrate data from a relational database to a native distributed database. A relational database is built on the relational database model and uses concepts and methods such as set algebra to process data. A native distributed database is a database system designed specifically for distributed environments. By distributing data across multiple nodes, it achieves high availability, scalability, and performance.

[0035] Furthermore, the data migration task may be a data processing task for migrating data from a relational database to a native distributed database. Specifically, the data migration task may include multiple types of data processing tasks. For example, the data migration task may include a data query task and a data insertion task. The data insertion task may be a task that requires inserting data from a relational database to a native distributed database. The data query task may be a task that requires querying data from a relational database to a native distributed database. The technical solution of the embodiment of the present invention can execute appropriate data processing steps according to the type of data processing task.

[0036] S220: When the data migration task includes a data query task, detect whether the data query task includes a data read and write operation, and perform a corresponding data query operation according to the operation detection result.

[0037] If a data migration task includes a data query task, it can detect whether the query task requires data read / write operations. Based on the detection result, the corresponding data query operation can be executed. In other words, different data query operations can be executed depending on whether the query task includes data read / write operations or not.

[0038] Optionally, when the operation detection result shows that no read or write operations are included, a first fetchSize parameter is determined according to the hardware resource parameters of the native distributed database; and a data query task corresponding to the data query instruction is executed based on the first fetchSize parameter.

[0039] Among them, the hardware resource parameter can be a parameter used to indicate the amount of hardware resources of the native distributed database. For example, the hardware resource parameters may include parameters such as CPU model, memory capacity, and hard disk capacity. The first fetchSize parameter may be a fetchSize parameter corresponding to the execution of the data query task without including read and write operations. The fetchSize parameter is used to set the number of records read each time in the ResultSet when executing the data query task. Specifically, the first fetchSize parameter can be determined based on the hardware parameters and the execution rules for executing the data query task. Optionally, the first fetchSize parameter can also be set manually in advance. Furthermore, the query steps corresponding to the data query task executed according to the first fetchSize parameter can be performed.

[0040] Optionally, when the operation detection result includes read and write operations, a new connection including the read and write operations is constructed; a second fetchSize parameter is determined according to the hardware resource parameters of the native distributed database, and the read and write operations are performed based on the second fetchSize parameter.

[0041] Among them, the new connection represents a new communication channel between the relational database and the native distributed database. Specifically, the new link can be used to perform read and write operations in data query tasks. Since the fetchSize parameter is only effective within the same transaction, data query operations and data insertion operations can be understood as two different transactions, so it is necessary to establish a new connection and determine the adapted fetchSize parameter for performing data read and write operations. Furthermore, the second fetchSize parameter can be the fetchSize parameter corresponding to the data query task when read and write operations are included. Specifically, the second fetchSize parameter can be determined based on the hardware calculation parameters and the execution rules for performing read and write operations. Optionally, the second fetchSize parameter can also be set manually in advance. In addition, the original data query task can be executed based on the above-mentioned first fetchSize parameter.

[0042] Optionally, a data query result corresponding to the data query task may be obtained and sent to the relational database.

[0043] S230: When the data migration task includes a data insertion task, execute the data insertion tasks corresponding to the data migration instructions in batches.

[0044] Among them, when the data migration task includes a data insertion task, the data insertion tasks can be executed in batches first, that is, all data insertion tasks can be executed at the same time, and the execution method can be adjusted if the subsequent execution fails.

[0045] Optionally, before executing the batch data insertion tasks corresponding to the data migration instructions, you can perform format verification on the data to be inserted in the data migration instructions and delete any data that fails the format verification. Format verification includes, but is not limited to, field type verification and length verification. Data that fails verification can be filtered out to minimize data processing failures caused by data issues.

[0046] S240 . If the data insertion task fails to be executed, execute the data insertion tasks in the data migration instruction one by one.

[0047] If a data insertion task fails, you can modify the task execution mode to execute it line by line. This means you can execute each step of the task one by one. By modifying the task execution mode to execute line by line when a data insertion task fails, you can successfully insert error-free data into the native distributed database, avoiding rollback of all inserted data.

[0048] For example, in order to better understand the technical solution provided by the present invention, a specific embodiment is introduced below:

[0049] Figure 3 This is a workflow diagram for executing a data insertion task provided by an embodiment of the present invention. Figure 3 As shown, when executing a data insertion task, the first step is to verify the format (field type, length) of the pre-inserted data before executing the data insertion, and filter out the data that fails the verification, so as to minimize the processing failure due to data problems; the second step is to monitor the data execution results. If the batch data execution fails, the data is inserted one by one by automatically committing the transaction.

[0050] Figure 4 This is a workflow diagram for executing a data query task provided by an embodiment of the present invention. Figure 4 As shown, when executing a data query task, you can determine whether there are read and write operations in the data query task. If so, create a new connection, set the fetchSize parameter corresponding to the new connection, and use the original connection to execute the data query step; if there are no read and write operations, there is no need to create a new connection, set the fetchSize parameter in the original connection, and execute the data query step.

[0051] The technical solution provided by the embodiment of the present invention determines the data migration task included in the data migration instruction upon receiving the data migration instruction; on the one hand, when the data migration task includes a data query task, detects whether the data query task includes data read and write operations, and executes the corresponding data query operation according to the operation detection result; on the other hand, when the data migration task includes a data insertion task, batch executes the data insertion tasks corresponding to the data migration instruction; when the data insertion task fails to execute, executes the data insertion tasks in the data migration instruction one by one. The technical solution of the embodiment of the present invention solves the problem in the prior art that, in the process of processing the data migration task from a relational database to a native distributed database, manual code-level modification is required, which results in a large manual workload and high risk. A general processing method for processing the data migration task from a relational database to a native distributed database can be constructed to automatically complete the migration task from a relational database to a native distributed database, reducing risk errors and modification workload.

[0052] Figure 5 This is a structural diagram of a database migration device provided by an embodiment of the present invention. The embodiment of the present invention can be applied to processing data migration task scenarios from relational databases to native distributed databases. The device can be implemented by software and / or hardware and integrated into a computer device with application development capabilities.

[0053] like Figure 5 As shown, the database migration apparatus includes: a migration task determination module 310 and a data processing module 320 .

[0054] Among them, the migration task determination module 310 is used to determine the data migration task contained in the data migration instruction when receiving the data migration instruction; wherein, the data migration instruction is used to migrate data from a relational database to a native distributed database; the data migration task includes: data query task and / or data insertion task; the data processing module 320 is used to execute corresponding data processing steps according to the database migration task and the data migration instruction to complete the data migration task corresponding to the data migration instruction.

[0055] The technical solution provided by the embodiment of the present invention determines the data migration task contained in the data migration instruction upon receiving the data migration instruction; wherein the data migration instruction is used to migrate data from a relational database to a native distributed database; the data migration task includes: a data query task and / or a data insertion task; and corresponding data processing steps are executed according to the database migration task and the data migration instruction to complete the data migration task corresponding to the data migration instruction. The technical solution of the embodiment of the present invention solves the problem in the prior art that, in the process of processing the data migration task from a relational database to a native distributed database, manual code-level modification is required, which results in a large manual workload and high risk. A general processing method for processing the data migration task from a relational database to a native distributed database can be constructed to automatically complete the migration task from a relational database to a native distributed database, reducing risk errors and modification workload.

[0056] In an optional embodiment, the data processing module 320 includes: a data query task execution unit, which is used to: when the data migration task includes a data query task, detect whether the data query task includes data reading and writing operations, and execute corresponding data query operations according to the operation detection results.

[0057] In an optional embodiment, the data query task execution unit includes: a first query processing sub-unit, used to: when the operation detection result is that it does not include read and write operations, determine a first fetchSize parameter based on the hardware resource parameters of the native distributed database; and execute the data query task corresponding to the data query instruction based on the first fetchSize parameter.

[0058] In an optional embodiment, the data query task execution unit includes: a second query processing sub-unit, used to: when the operation detection result is that the read and write operations are included, construct a new connection including the read and write operations; the new connection represents a new communication channel between the relational database and the native distributed database; determine a second fetchSize parameter according to the hardware resource parameters of the native distributed database, and execute the read and write operations based on the second fetchSize parameter.

[0059] In an optional embodiment, the data processing module 320 also includes: a data insertion task execution unit, which is used to: in the case where the data migration task includes a data insertion task, batch execute the data insertion tasks corresponding to the data migration instruction; in the case where the data insertion task fails to execute, execute the data insertion tasks in the data migration instruction one by one.

[0060] In an optional embodiment, the database migration device further includes: a format verification module, which is used to: perform format verification on the data to be inserted in the data migration instruction before batch executing the data insertion task corresponding to the data migration instruction, and delete the data to be inserted that fails the format verification.

[0061] In an optional implementation, the database migration device further includes: a query result feedback module, configured to obtain a data query result corresponding to the data query task, and send the data query result to the relational database.

[0062] The database migration device provided in the embodiment of the present invention can execute the database migration method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0063] Figure 6 A schematic structural diagram of a computer device provided in an embodiment of the present invention. Figure 6 A block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present invention is shown. Figure 6 The computer device 12 shown is only an example and should not limit the functionality and scope of use of the embodiments of the present invention. The computer device 12 can be any terminal device with computing capabilities and can be configured in the database migration device.

[0064] like Figure 6 As shown, computer device 12 is implemented as a general-purpose computing device. Components of computer device 12 may include, but are not limited to, one or more processors or processing units 16, system memory 28, and a bus 18 that connects various system components (including system memory 28 and processing unit 16).

[0065] The bus 18 may be one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. Examples of these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0066] The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.

[0067] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache 32. Computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be configured to read and write non-removable, non-volatile magnetic media ( Figure 6 Not shown, often called a "hard drive"). Although Figure 6 Not shown, a magnetic disk drive for reading and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of various embodiments of the present invention.

[0068] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0069] The computer device 12 may also communicate with one or more external devices 14 (e.g., a keyboard, a pointing device, a display 24, etc.), one or more devices that enable a user to interact with the computer device 12, and / or any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may occur through an input / output (I / O) interface 22. Furthermore, the computer device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 20. Figure 6 As shown, the network adapter 20 communicates with the other modules of the computer device 12 via the bus 18. Figure 6 Not shown, other hardware and / or software modules may be used in conjunction with computer device 12, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0070] The processing unit 16 executes various functional applications and database migration by running programs stored in the system memory 28, for example, implementing the database migration method provided in an embodiment of the present invention, which includes:

[0071] Upon receiving a data migration instruction, determining a data migration task included in the data migration instruction; wherein the data migration instruction is used to migrate data from a relational database to a native distributed database; the data migration task includes: a data query task and / or a data insertion task; and executing corresponding data processing steps according to the database migration task and the data migration instruction to complete the data migration task corresponding to the data migration instruction.

[0072] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the database migration method provided in any embodiment of the present invention is implemented, including:

[0073] Upon receiving a data migration instruction, determining a data migration task included in the data migration instruction; wherein the data migration instruction is used to migrate data from a relational database to a native distributed database; the data migration task includes: a data query task and / or a data insertion task; and executing corresponding data processing steps according to the database migration task and the data migration instruction to complete the data migration task corresponding to the data migration instruction.

[0074] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.

[0075] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0076] Program code embodied on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0077] Computer program code for performing the operations of the present invention can be written in one or more programming languages, or a combination thereof, including object-oriented programming languages ​​such as C, Java, Smalltalk, C++, C#, and Python, and also conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0078] Those skilled in the art will appreciate that the modules or steps of the present invention described above can be implemented using a general-purpose computing device. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they can be implemented using program code executable by a computer device, which can then be stored in a storage device and executed by the computing device. Alternatively, they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.

[0079] Note that the above are only preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will appreciate that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments, and substitutions are possible for those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments and may include many other equivalent embodiments without departing from the scope of the present invention. The scope of the present invention is determined by the scope of the appended claims.

Claims

1. A database migration method, characterized in that: include: Upon receiving a data migration instruction, determining a data migration task included in the data migration instruction; wherein the data migration instruction is used to migrate data from a relational database to a native distributed database; the data migration task includes: a data query task and / or a data insertion task; Corresponding data processing steps are performed according to the database migration task and the data migration instruction to complete the data migration task corresponding to the data migration instruction.

2. The method according to claim 1, characterized in that The performing corresponding data processing steps according to the database migration task and the data migration instruction includes: In the case that the data migration task includes a data query task, it is detected whether the data query task includes a data read and write operation, and a corresponding data query operation is performed according to the operation detection result.

3. The method according to claim 2, characterized in that The performing of the corresponding data query operation according to the operation detection result includes: If the operation detection result is that no read or write operations are included, determining a first fetchSize parameter according to hardware resource parameters of the native distributed database; The data query task corresponding to the data query instruction is executed based on the first fetchSize parameter.

4. The method according to claim 2, characterized in that The performing of the corresponding data query operation according to the operation detection result includes: If the operation detection result indicates that the operation includes a read and write operation, a new connection including the read and write operation is established; the new connection represents a new communication channel between the relational database and the native distributed database; A second fetchSize parameter is determined according to the hardware resource parameters of the native distributed database, and the read and write operations are performed based on the second fetchSize parameter.

5. The method according to claim 1, wherein The performing corresponding data processing steps according to the database migration task and the data migration instruction includes: In a case where the data migration task includes a data insertion task, executing the data insertion tasks corresponding to the data migration instructions in batches; If the data insertion task fails to be executed, the data insertion tasks in the data migration instruction are executed one by one.

6. The method according to claim 5, characterized in that Before batch executing the data insertion tasks corresponding to the data migration instructions, the method further includes: Performing format verification on the data to be inserted in the data migration instruction, and deleting the data to be inserted that fails the format verification.

7. The method according to claim 2, characterized in that The method further comprises: Obtaining a data query result corresponding to the data query task, and sending the data query result to the relational database.

8. A database migration device, characterized in that: The device comprises: A migration task determination module is configured to, upon receiving a data migration instruction, determine a data migration task included in the data migration instruction; wherein the data migration instruction is configured to migrate data from a relational database to a native distributed database; and the data migration task includes a data query task and / or a data insertion task; The data processing module is configured to execute corresponding data processing steps according to the database migration task and the data migration instruction, so as to complete the data migration task corresponding to the data migration instruction.

9. A computer device, characterized in that: The computer device comprises: one or more processors; a memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the database migration method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the database migration method according to any one of claims 1 to 7 is implemented.