Data migration method and device

By configuring and concurrently executing parameter files for data migration tasks, and using the combination of the main control process and sub-control processes, the problems of low data migration efficiency and low automation in the existing technology are solved, and an efficient and accurate data migration process is achieved.

CN112579569BActive Publication Date: 2024-10-29CHINA CONSTRUCTION BANK
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011481092.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-15
Publication Date
2024-10-29
Estimated Expiration
2040-12-15

AI Technical Summary

Technical Problem

When faced with complex business or system-level data migration, existing data migration methods have problems such as insufficient concurrent processing capabilities, complex dependencies, lag in data verification, excessive manual intervention, and low automation, resulting in low migration efficiency and difficulty in traceability. .

Method used

By configuring the parameter files of multiple business modules to be migrated, including database information, dependencies and data migration information, and using the combination of the main control process and the sub-control process to perform data migration concurrently according to the dependencies and concurrency numbers, using stored procedures and data The verification script ensures the order and correctness of migration, and implements multi-process concurrent scheduling through named pipes.

Benefits of technology

It improves the efficiency of data migration, reduces manual intervention, improves the degree of automation, ensures the correctness of data migration, and eliminates the need to interrupt the entire task when an exception is encountered, improving the reliability and speed of migration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112579569B_ABST
    Figure CN112579569B_ABST
Patent Text Reader

Abstract

The present invention discloses a data migration method and device, and relates to the field of computer technology. A specific implementation of the method includes: receiving a data migration task, configuring a plurality of parameter files corresponding to business modules to be migrated according to the data migration task; using a main control process to read the concurrency number of a sub-control process, and starting a plurality of sub-control processes according to the concurrency number of the sub-control process; using a main control process and a plurality of sub-control processes, according to the dependency relationship between a plurality of business modules to be migrated and the data migration information corresponding to each business module to be migrated, combined with database information, to perform data migration. This implementation can realize the concurrent execution of data migration of a plurality of business modules to be migrated, improve the efficiency of data migration, reduce manual intervention, and have a high degree of automation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a data migration method and device. Background Art

[0002] With the widespread application of databases and the continuous development of corporate business, migrating data from one database to another has become a common database operation. In order to ensure the continuity and traceability of business data, enterprises need to process and integrate the business data stored in the old system according to the new business logic and store it in the new system.

[0003] When migrating data between different systems, SQL (Structured Query Language) scripts are usually used to perform row-level operations. However, the existing migration methods cannot handle complex business or even system-level data migration concurrently. At the same time, the data migration scripts with dependencies are complex, data verification is delayed, and manual intervention is frequent. Once an error occurs during the migration process, it is difficult to trace it back, resulting in low automation and low efficiency. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a data migration method and device, which can realize the concurrent execution of data migration of multiple business modules to be migrated, improve the efficiency of data migration, reduce manual intervention, and have a high degree of automation.

[0005] To achieve the above objective, according to one aspect of an embodiment of the present invention, a data migration method is provided.

[0006] A data migration method according to an embodiment of the present invention includes: receiving a data migration task, configuring a plurality of parameter files corresponding to business modules to be migrated according to the data migration task, wherein the parameter files include: database information, dependency relationships among the plurality of business modules to be migrated, data migration information corresponding to each of the business modules to be migrated, and a concurrency number of sub-control processes; using a main control process to read the concurrency number of the sub-control processes, and starting a plurality of sub-control processes according to the concurrency number of the sub-control processes; and using the main control process and the plurality of sub-control processes to perform data migration according to the dependency relationships among the plurality of business modules to be migrated and the data migration information corresponding to each of the business modules to be migrated, in combination with the database information.

[0007] Optionally, the use of a main control process and multiple sub-control processes to perform data migration according to the dependency relationship between the multiple business modules to be migrated and the data migration information corresponding to each of the business modules to be migrated, combined with the database information, includes: using the main control process to determine the migration order corresponding to the multiple business modules to be migrated according to the dependency relationship between the multiple business modules to be migrated; using the main control process to pass the module unique identifiers of the multiple business modules to be migrated as parameters to multiple sub-control processes according to the migration order corresponding to the multiple business modules to be migrated; using the sub-control process to query the data migration information corresponding to the target business module according to the module unique identifier of the target business module, and then performing data migration on the target business module according to the data migration information corresponding to the target business module, combined with the database information; wherein the target business module is the business module to be migrated corresponding to the module unique identifier passed into the sub-control process.

[0008] Optionally, the data migration information includes: stored procedures, subtask scripts and data verification scripts corresponding to the subtask scripts; the database information includes: a source database, a destination database, and connection information between the source database and the destination database; and, based on the data migration information corresponding to the target business module and in combination with the database information, performing data migration on the target business module includes: calling the stored procedure corresponding to the target business module, and executing the subtask script contained in the target business module according to the connection information between the source database and the destination database, so as to migrate the data of the target business module from the source database to the destination database; after completing the execution of the subtask script contained in the target business module, executing the data verification script corresponding to the subtask script contained in the target business module; if the verification passes, marking the data migration status of the target business module as completed migration; if the verification fails, marking the data migration status of the target business module as incomplete migration.

[0009] Optionally, after executing data migration on the target business module, the method also includes: determining whether there is a business module to be migrated that has not executed data migration, and the data migration status of the business module on which the business module to be migrated that has not executed data migration depends is that migration is completed; if so, using the main control process, passing the module unique identifier of the business module to be migrated that has not executed data migration as a parameter to the sub-control process corresponding to the target business module, so as to execute data migration on the module of the business module to be migrated that has not executed data migration; wherein, the sub-control process corresponding to the target business module is the sub-control process that executes data migration on the target business module.

[0010] Optionally, after marking the data migration status of the target business module as incomplete migration, the method further includes: after repairing the data migration anomaly existing in the target business module, using the main control process to mark the data migration status of the target business module as completed migration.

[0011] Optionally, the method also includes: using the main control process to call the mkfilo method to create a named pipe, and then cyclically writing multiple blank lines of data into the named pipe according to the concurrency of the sub-control process to initialize the named pipe; wherein the number of data lines of the multiple blank lines of data is the concurrency of the sub-control process.

[0012] Optionally, the module unique identifiers of the multiple business modules to be migrated are used as parameters and passed into multiple sub-control processes according to the migration order corresponding to the multiple business modules to be migrated, including: reading the multiple blank lines of data in sequence; each time a blank line of data is read, selecting a business module to be migrated from the multiple business modules to be migrated according to the migration order corresponding to the multiple business modules to be migrated; and passing the module unique identifier of the selected business module to be migrated as a parameter into the sub-control process whose process status is idle.

[0013] To achieve the above objective, according to another aspect of an embodiment of the present invention, a data migration device is provided.

[0014] A data migration device according to an embodiment of the present invention includes: a configuration module, which is used to receive a data migration task, and configure a parameter file corresponding to multiple business modules to be migrated according to the data migration task, wherein the parameter file includes: database information, dependency relationships between the multiple business modules to be migrated, data migration information corresponding to each of the business modules to be migrated, and the concurrency number of sub-control processes; a startup module, which is used to read the concurrency number of the sub-control processes using a main control process, and start multiple sub-control processes according to the concurrency number of the sub-control processes; and a migration module, which is used to perform data migration using the main control process and multiple sub-control processes according to the dependency relationships between the multiple business modules to be migrated and the data migration information corresponding to each of the business modules to be migrated, in combination with the database information.

[0015] Optionally, the migration module is also used to: utilize the main control process to determine the migration order corresponding to the multiple business modules to be migrated according to the dependency relationship between the multiple business modules to be migrated; utilize the main control process to pass the module unique identifiers of the multiple business modules to be migrated as parameters into multiple sub-control processes according to the migration order corresponding to the multiple business modules to be migrated; utilize the sub-control process to query the data migration information corresponding to the target business module according to the module unique identifier of the target business module, and then perform data migration on the target business module according to the data migration information corresponding to the target business module and the database information; wherein, the target business module is the business module to be migrated corresponding to the module unique identifier passed into the sub-control process.

[0016] Optionally, the data migration information includes: stored procedures, subtask scripts and data verification scripts corresponding to the subtask scripts; the database information includes: a source database, a destination database, and connection information between the source database and the destination database; and the migration module is also used to: call the stored procedure corresponding to the target business module, and execute the subtask script contained in the target business module according to the connection information between the source database and the destination database, so as to migrate the data of the target business module from the source database to the destination database; after executing the subtask script contained in the target business module, execute the data verification script corresponding to the subtask script contained in the target business module; if the verification passes, mark the data migration status of the target business module as completed migration; if the verification fails, mark the data migration status of the target business module as incomplete migration.

[0017] Optionally, the migration module is also used to: determine whether there is a business module to be migrated that has not executed data migration, and the data migration status of the business module on which the business module to be migrated that has not executed data migration depends is that the migration is completed; if so, using the main control process, the module unique identifier of the business module to be migrated that has not executed data migration is passed as a parameter to the sub-control process corresponding to the target business module, so as to execute data migration on the module of the business module to be migrated that has not executed data migration; wherein, the sub-control process corresponding to the target business module is the sub-control process that executes data migration on the target business module.

[0018] Optionally, the migration module is further used to: after repairing the data migration anomaly existing in the target business module, use the main control process to mark the data migration status of the target business module as completed migration.

[0019] Optionally, the startup module is also used to: use the main control process to call the mkfilo method to create a named pipe, and then cyclically write multiple blank lines of data to the named pipe according to the concurrency number of the sub-control process to initialize the named pipe; wherein the number of data lines of the multiple blank lines of data is the concurrency number of the sub-control process.

[0020] Optionally, the migration module is also used to: read the multiple blank lines of data in sequence; each time a blank line of data is read, select a business module to be migrated from the multiple business modules to be migrated according to the migration order corresponding to the multiple business modules to be migrated; and pass the module unique identifier of the selected business module to be migrated as a parameter to the sub-control process whose process status is idle.

[0021] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device is provided.

[0022] An electronic device according to an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the data migration method according to the embodiment of the present invention.

[0023] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer readable medium is provided.

[0024] A computer-readable medium according to an embodiment of the present invention stores a computer program, and when the program is executed by a processor, the data migration method according to the embodiment of the present invention is implemented.

[0025] An embodiment of the above invention has the following advantages or beneficial effects: parameter information corresponding to the data migration task is configured, database information, dependencies between multiple business modules to be migrated, data migration information corresponding to each business module to be migrated, and the number of concurrent sub-control processes are set, so that data migration of multiple business modules to be migrated can be automatically and sequentially executed, avoiding the problem of complex data migration scripts in existing data migration methods, and concurrent execution of data migration of multiple business modules to be migrated can be achieved through a main control process and multiple sub-control processes, thereby improving the efficiency of data migration, reducing manual intervention, and having a high degree of automation; and, the data migration information includes a stored procedure, which satisfies the requirement that the migration of each business module to be migrated is processed through an independent stored procedure, so if a migration exception occurs in a business module to be migrated, there is no need to interrupt the entire data migration task, thereby further improving the efficiency of data migration; in addition, the data migration information includes a sub-task script and a data verification script corresponding to the sub-task script, thereby ensuring the correctness of data migration; and, multi-process concurrent scheduling of data migration tasks is achieved through named pipes, thereby speeding up data migration.

[0026] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0028] Figure 1 is a schematic diagram of main steps of a data migration method according to an embodiment of the present invention;

[0029] Figure 2 is a schematic diagram of a main process of performing data migration using a main process and multiple sub-control processes according to an embodiment of the present invention;

[0030] Figure 3 is a schematic diagram of a main process of performing data migration on a target business module according to an embodiment of the present invention;

[0031] Figure 4 is a schematic diagram of main modules of a data migration device according to an embodiment of the present invention;

[0032] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0033] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0034] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0035] Figure 1 Schematic diagram of the main steps of the data migration method according to an embodiment of the present invention. Figure 1 As shown, the main steps of the data migration method may include step S101 to step S103.

[0036] Step S101: receiving a data migration task, and configuring a plurality of parameter files corresponding to the business modules to be migrated according to the data migration task.

[0037] The data migration task refers to processing and integrating the business data stored in the old system according to the new business logic and storing it in the new system; that is, the data migration task refers to migrating the business data corresponding to the business modules involved in the system from the source database to the destination database. The migration object corresponding to the data migration task is the business data corresponding to the business module; the source database is the storage location of the business data corresponding to the business module before the migration; the destination database is the storage location of the business data corresponding to the business module after the migration.

[0038] In the embodiment of the present invention, through the data migration task, multiple business modules to be migrated can be obtained, and the source database and the destination database can also be obtained, and then the parameter file corresponding to the data migration task can be configured, that is, the parameter file corresponding to the multiple business modules to be migrated. Among them, the parameter file may include: database information, the dependency relationship between the multiple business modules to be migrated, the data migration information corresponding to each business module to be migrated, and the number of concurrent sub-control processes. For ease of understanding, the information contained in the parameter file is explained below.

[0039] (1) Database information can be understood as information related to a database, and specifically may include: a source database, a destination database, and connection information between the source database and the destination database. The connection information may include the network address of the database, the user name and password for connecting to the database. Through the connection information, a connection between the source database and the destination database can be established, which is a prerequisite for migrating data from the source database to the destination database.

[0040] (2) The dependency relationship between multiple business modules to be migrated refers to the dependency relationship between the business modules to be migrated in the processing order. For example, the business modules to be migrated include the user information module, the payment business module, and the payment business module. During data migration, there is a dependency relationship between these modules in terms of front-end and back-end processing, such as migrating the user information module first, then migrating the payment business module, and finally migrating the payment business module. Then there is a dependency relationship between the user information module and the payment business module, that is, the user information module is the pre-dependent module of the payment business module. In addition, there is a dependency relationship between the payment business module and the payment business module, that is, the payment business module is the pre-dependent module of the payment business module. By obtaining the dependency relationship between the multiple business modules to be migrated, the migration order of the multiple business modules to be migrated can be obtained according to the dependency relationship.

[0041] (3) The data migration information corresponding to each business module to be migrated includes the stored procedure corresponding to each business module to be migrated, the subtask script contained in each business module to be migrated, and the data verification script corresponding to the subtask script.

[0042] A stored procedure refers to a set of SQL statements in a large database system to complete a specific function. It is stored in the database and is permanently valid after being compiled once. Users execute it by specifying the name of the stored procedure and providing parameters (if the stored procedure has parameters). A stored procedure is an important object in a database. When the amount of data is particularly large, the use of stored procedures can achieve a multiple-speed efficiency improvement. In an embodiment of the present invention, a stored procedure corresponding to each business module to be migrated can be configured, so that the migration of each business module to be migrated can be processed through an independent stored procedure. Therefore, if a migration exception occurs in a business module to be migrated, there is no need to interrupt the entire data migration task, further improving the data migration efficiency. Considering that the data migration information includes a stored procedure, the data migration method provided in an embodiment of the present invention is applied to a database with a stored procedure, such as Oracle Database, which is a relational database management system of Oracle Corporation.

[0043] The subtask script is a more detailed processing unit in the business module to be migrated. For example, the business data corresponding to the user information module includes: corporate customer information, private customer information and customer branch information, then the user information module contains subtask script 1 for data migration of corporate customer information, subtask script 2 for data migration of private customer information and subtask script 3 for data migration of customer branch information. In addition, the user information module also contains data verification script 1 corresponding to subtask script 1, data verification script 2 corresponding to subtask script 2 and data verification script 3 corresponding to subtask script 3. In other words, data verification script 1 can be used to verify the data migration of corporate customer information, data verification script 2 can be used to verify the data migration of private customer information, and data verification script 3 can be used to verify the data migration of customer branch information. Specifically, it can be verified whether the number of data before and after the migration is consistent, whether the income and expenditure amounts before and after the migration are consistent, whether the flow before and after the migration is consistent, etc.

[0044] (4) The concurrency of the sub-control process refers to the number of processes that can perform data migration concurrently. If the concurrency of the sub-control process is 2, then the data migration of two business modules to be migrated can be performed simultaneously. The data migration method of the prior art has the problem of not being able to process concurrently. In the data migration method provided in the embodiment of the present invention, the concurrency of the sub-control process can be configured, so that the data migration of multiple business modules to be migrated can be performed concurrently, further improving the efficiency of data migration.

[0045] Step S102: using the main control process to read the concurrency number of the sub-control process, and starting multiple sub-control processes according to the concurrency number of the sub-control process.

[0046] The main control process and the sub-control process work together to perform data migration tasks. Among them, the main control process is used to manage the sub-control process. After reading the concurrency of the sub-control process, that is, obtaining the number of sub-control processes, the main control process can start multiple sub-control processes according to the number of sub-control processes, so that multiple sub-control processes can perform data migration on multiple business modules to be migrated. It should be noted that the number of sub-control processes and the number of business modules to be migrated can be different. For example, if the concurrency of the sub-control process is 2 and the number of business modules to be migrated is 10, then the main control process can start 2 sub-control processes, and then these 2 sub-control processes perform data migration on the 10 business modules to be migrated.

[0047] Step S103: using the main control process and multiple sub-control processes, data migration is performed according to the dependency relationship between multiple business modules to be migrated and the data migration information corresponding to each business module to be migrated, combined with database information.

[0048] After multiple sub-control processes are started, the main control process and multiple sub-control processes can be used to perform data migration on multiple business modules to be migrated. In the process of performing data migration, the dependency relationship between the multiple business modules to be migrated configured in step S101, the data migration information and database information corresponding to each business module to be migrated need to be followed.

[0049] Figure 2 FIG. 1 is a schematic diagram of the main process of performing data migration using a main process and multiple sub-control processes according to an embodiment of the present invention. Figure 2 As shown, the main process of performing data migration using a main process and multiple sub-control processes may include:

[0050] Step S201: using the main control process, according to the dependency relationship between the multiple service modules to be migrated, determining the migration order corresponding to the multiple service modules to be migrated.

[0051] As explained in step S101 above, the dependency relationship between multiple business modules to be migrated refers to the dependency relationship between the business modules to be migrated in the processing order. Therefore, the main control process can determine the migration order corresponding to the multiple business modules to be migrated according to the dependency relationship between the multiple business modules to be migrated. For example, there are 10 business modules to be migrated from Y1 to Y10, and the dependency relationship is that Y3 needs to depend on Y1 and Y2, Y7 needs to depend on Y6, and Y6 needs to depend on Y4, then the migration order corresponding to these 10 business modules to be migrated can be: Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, Y9, Y10.

[0052] Step S202: using the main control process, according to the migration order corresponding to the multiple business modules to be migrated, the module unique identifiers of the multiple business modules to be migrated are passed as parameters to the multiple sub-control processes.

[0053] The main control process is used to manage the sub-control process. Therefore, after the main control process determines the migration order corresponding to multiple business modules to be migrated, the module unique identifiers of multiple business models to be migrated can be passed as parameters to multiple sub-control processes in sequence according to the migration order, so that the sub-control process can obtain which business module to be migrated needs to perform data migration. For example, there are two sub-control processes, A and B, and data migration is required for 10 business modules to be migrated from Y1 to Y10, and the migration order is from Y1 to Y10. Then first pass the module unique identifier of Y1 to sub-control process A, and pass the module unique identifier of Y2 to sub-control process B; then, after sub-control process A or B completes data migration, that is, the process status of sub-control process A or B is idle, the module unique identifier of Y3 can be passed to the sub-process with an idle process status in accordance with the migration order, so that the sub-process can perform data migration on Y3. Similarly, according to the migration order, the module unique identifiers of Y4 to Y10 are passed to the sub-process with an idle process status in sequence.

[0054] As an embodiment of the present invention, the data migration method may also include: using the main control process to call the mkfilo method to create a named pipe, and then cyclically writing multiple blank lines of data to the named pipe according to the concurrency number of the sub-control process to initialize the named pipe. Among them, the number of data lines of the multiple blank lines of data is the concurrency number of the sub-control process. The mkfilo method is a method for creating a named pipe. Named pipes, i.e., Named Pipes, is a simple inter-process communication mechanism that supports reliable, one-way or two-way data communication between different processes on the same computer or between different processes on different computers across a network. The data migration method provided in the embodiment of the present invention implements multi-process concurrent scheduling of data migration tasks through named pipes, thereby speeding up data migration.

[0055] Furthermore, according to the migration order corresponding to the multiple business modules to be migrated, the module unique identifiers of the multiple business modules to be migrated are used as parameters and passed into the multiple sub-control processes, which may include: reading multiple blank lines of data in sequence; each time a blank line of data is read, a business module to be migrated is selected from the multiple business modules to be migrated according to the migration order corresponding to the multiple business modules to be migrated; the module unique identifier of the selected business module to be migrated is used as a parameter and passed into the sub-control process whose process status is idle. For example, data migration is required for the 10 business modules to be migrated from Y1 to Y10, and the migration order is from Y1 to Y10. There are two sub-control processes, A and B, and the number of data rows of the blank line data is 2 rows. First, after determining that the process status of sub-control processes A and B are both idle, the two blank lines of data can be read, so that the module unique identifier of Y1 can be passed into sub-control process A, and the module unique identifier of Y2 can be passed into sub-control process B; then, after sub-control process A or B completes data migration, that is, the process status of sub-control process A or B is idle, then a blank line of data can be read, and then the module unique identifier of Y3 can be passed into the sub-process with an idle process status in accordance with the migration order, so that the sub-process can perform data migration on Y3. Similarly, if the process status of sub-control process A or B is idle, a blank line of data is read, and then the module unique identifiers of Y4 to Y10 can be passed into the sub-process with an idle process status in accordance with the migration order.

[0056] Step S203: using the sub-control process, querying the data migration information corresponding to the target business module according to the module unique identifier of the target business module, and then performing data migration on the target business module according to the data migration information corresponding to the target business module and combining the database information.

[0057] Among them, the target business module is the business module to be migrated corresponding to the module unique identifier passed into the sub-control process. For example, if the module unique identifier of Y1 is passed into the sub-control process A, then the sub-control process A can query the data migration information corresponding to Y1 according to the module unique identifier of Y1, and then perform data migration on Y1 according to the data migration information corresponding to Y1 and in combination with the database information. In step S101, it has been explained that the data migration information may include: stored procedures, sub-task scripts, and data verification scripts corresponding to the sub-task scripts, and the database information includes: source database, destination database, and connection information between the source database and the destination database.

[0058] Figure 3 FIG. 1 is a schematic diagram of the main process of performing data migration on a target business module according to an embodiment of the present invention. Figure 3 As shown, the main process of performing data migration on the target business module may include:

[0059] Step S301: calling the stored procedure corresponding to the target business module, and executing the subtask script contained in the target business module according to the connection information between the source database and the target database, so as to migrate the data of the target business module from the source database to the target database;

[0060] Step S302: After the subtask script included in the target business module is executed, a data verification script corresponding to the subtask script included in the target business module is executed;

[0061] Step S303: if the verification is passed, the data migration status of the target business module is marked as completed;

[0062] Step S304: If the verification fails, the data migration status of the target business module is marked as incomplete migration.

[0063] Assume that the target business module is Y1, and the module unique identifier of Y1 is passed to the sub-control process A, then the sub-control process A performs data migration on Y1. The specific data migration process is:

[0064] (1) Sub-control process A calls the stored procedure corresponding to Y1, and executes the sub-task script contained in Y1 according to the connection information between the source database and the destination database, so as to migrate the data of Y1 from the source database to the destination database. It should be noted that if Y1 contains multiple types of business data, then each type of business data corresponds to a sub-task script, and it is necessary to execute the sub-task script corresponding to each type of business data in turn according to the migration order of multiple types of business data, that is, migrate each type of business data from the source database to the destination database in turn.

[0065] (2) After the subtask scripts included in Y1 are executed, the data verification script corresponding to the subtask scripts included in Y1 is executed. If the verification passes, the data migration status of Y1 is marked as completed; if the verification fails, the data migration status of Y1 is marked as incomplete.

[0066] It should be noted that if Y1 contains multiple types of business data, then each type of business data corresponds to a subtask script, and it is necessary to execute the subtask scripts corresponding to each type of business data in sequence according to the migration order of the multiple types of business data. After the subtask script corresponding to the business data of type L1 is executed, it is necessary to execute the data verification script corresponding to the subtask script, that is, to verify the data migration of the business data of type L1. If the verification passes, the data migration is performed on the next type of business data of type L1 according to the migration order of the multiple types of business data. If the verification fails, it is necessary to query and solve the problems existing in the data migration process of the business data of type L1, and then perform data migration on the next type of business data of type L1. Obviously, if the data migration verification corresponding to all types of business data contained in Y1 passes, the data migration status of Y1 is marked as completed, otherwise, the data migration status of Y1 is marked as incomplete.

[0067] As an embodiment of the present invention, after marking the data migration status of the target business module as not completed, the data migration method may further include: after repairing the data migration anomaly existing in the target business module, marking the data migration status of the target business module as completed by using the main control process. The data migration of each business module to be migrated is processed by an independent stored procedure. If a business module to be migrated reports an error during the data migration process, the problem can be manually repaired, and then the main control process can be automatically called up to mark the data migration status of the business module to be migrated as completed without interrupting the entire data migration operation.

[0068] As an embodiment of the present invention, after executing data migration on the target business module, the data migration method may further include: determining whether there is a business module to be migrated that has not executed data migration, and whether the data migration status of the business module on which the business module to be migrated that has not executed data migration depends is that the migration is completed; if so, using the main control process, passing the module unique identifier of the business module to be migrated that has not executed data migration as a parameter to the sub-control process corresponding to the target business module, so as to execute data migration on the module of the business module to be migrated that has not executed data migration; wherein, the sub-control process corresponding to the target business module is the sub-control process that executes data migration on the target business module.

[0069] Suppose that there are two sub-control processes, A and B, which need to perform data migration on the 10 business modules to be migrated, Y1 to Y10, and the migration order is from Y1 to Y10. After using sub-control process A to perform data migration on Y1, the main control process needs to determine whether there are modules from Y2 to Y10 that have not performed data migration, and the data migration status of the business modules that the modules that have not performed data migration depend on is completed. If it is found that Y3 has not performed data migration, and Y1 and Y2, which Y3 depends on, have been migrated, then the main control process can pass the module unique identifier of Y3 as a parameter to sub-control process A, so that A can perform data migration on Y3. In other words, after a sub-control process performs data migration on a business module to be migrated, it is necessary to determine whether there are other business modules to be migrated that require the sub-control process to perform data migration.

[0070] The data migration method of the embodiment of the present invention configures parameter information corresponding to the data migration task, sets database information, dependency relationships between multiple business modules to be migrated, data migration information corresponding to each business module to be migrated, and the number of concurrent sub-control processes, and can automatically and sequentially execute data migration of multiple business modules to be migrated, thereby avoiding the problem of complex data migration scripts in the existing data migration method. It can also concurrently execute data migration of multiple business modules to be migrated through a main control process and multiple sub-control processes, thereby improving the efficiency of data migration, reducing manual intervention, and having a high degree of automation. In addition, the data migration information includes a stored procedure, which satisfies the requirement that the migration of each business module to be migrated is processed through an independent stored procedure. Therefore, if a migration exception occurs in a business module to be migrated, there is no need to interrupt the entire data migration task, thereby further improving the efficiency of data migration. In addition, the data migration information includes a sub-task script and a data verification script corresponding to the sub-task script, thereby ensuring the correctness of data migration. In addition, multi-process concurrent scheduling of data migration tasks is realized through named pipes, thereby accelerating the speed of data migration.

[0071] Figure 4 FIG. 1 is a schematic diagram of the main modules of the data migration device according to an embodiment of the present invention. Figure 4 As shown, the main modules of the data migration device 400 may include: a configuration module 401 , a startup module 402 and a migration module 403 .

[0072] Among them, the configuration module 401 can be used to: receive a data migration task, and configure a plurality of parameter files corresponding to the business modules to be migrated according to the data migration task. Among them, the parameter file may include: database information, dependency relationships between the business modules to be migrated, data migration information corresponding to each business module to be migrated, and the concurrency number of the sub-control process. The startup module 402 can be used to: use the main control process to read the concurrency number of the sub-control process, and start multiple sub-control processes according to the concurrency number of the sub-control process. The migration module 403 can be used to: use the main control process and multiple sub-control processes, according to the dependency relationships between the business modules to be migrated and the data migration information corresponding to each business module to be migrated, combined with the database information, to perform data migration.

[0073] As an embodiment of the present invention, the migration module 403 can also be used to: determine the migration order corresponding to the multiple business modules to be migrated according to the dependency relationship between the multiple business modules to be migrated by using the main control process; use the module unique identifiers of the multiple business modules to be migrated as parameters and pass them into multiple sub-control processes according to the migration order corresponding to the multiple business modules to be migrated by using the main control process; use the sub-control process to query the data migration information corresponding to the target business module according to the module unique identifier of the target business module, and then perform data migration on the target business module according to the data migration information corresponding to the target business module and in combination with the database information. The target business module is the business module to be migrated corresponding to the module unique identifier passed into the sub-control process.

[0074] As an embodiment of the present invention, data migration information includes: stored procedures, subtask scripts, and data verification scripts corresponding to the subtask scripts. Database information includes: source database, destination database, and connection information between the source database and the destination database. And, the migration module 403 can also be used to: call the stored procedure corresponding to the target business module, execute the subtask script contained in the target business module according to the connection information between the source database and the destination database, so as to migrate the data of the target business module from the source database to the destination database; after the subtask script contained in the target business module is executed, execute the data verification script corresponding to the subtask script contained in the target business module; if the verification passes, the data migration status of the target business module is marked as completed, if the verification fails, the data migration status of the target business module is marked as not completed.

[0075] As an embodiment of the present invention, the migration module 403 can also be used to: determine whether there is a business module to be migrated that has not executed data migration, and the data migration status of the business module that the business module to be migrated that has not executed data migration depends on is completed; if so, use the main control process to pass the module unique identifier of the business module to be migrated that has not executed data migration as a parameter to the sub-control process corresponding to the target business module, so as to perform data migration on the module of the business module to be migrated that has not executed data migration. Among them, the sub-control process corresponding to the target business module is the sub-control process that executes data migration on the target business module.

[0076] As an embodiment of the present invention, the migration module 403 may also be used to: after repairing the data migration anomaly existing in the target business module, use the main control process to mark the data migration status of the target business module as completed.

[0077] As an embodiment of the present invention, the startup module 402 can also be used to: use the main control process to call the mkfilo method to create a named pipe, and then cyclically write multiple blank lines of data into the named pipe according to the concurrency number of the sub-control process to initialize the named pipe. The number of data lines of the multiple blank lines of data is the concurrency number of the sub-control process.

[0078] As an embodiment of the present invention, the migration module 403 can also be used to: read multiple blank lines of data in sequence; each time a blank line of data is read, select one business module to be migrated from multiple business modules to be migrated according to the migration order corresponding to the multiple business modules to be migrated; and pass the module unique identifier of the selected business module to be migrated as a parameter into the sub-control process whose process status is idle.

[0079] According to the data migration device of the embodiment of the present invention, parameter information corresponding to the data migration task is configured, database information, dependency relationships between multiple business modules to be migrated, data migration information corresponding to each business module to be migrated, and the number of concurrent sub-control processes are set, so that data migration of multiple business modules to be migrated can be automatically and sequentially executed, avoiding the problem of complex data migration scripts in the existing data migration method, and concurrent execution of data migration of multiple business modules to be migrated can be achieved through the main control process and multiple sub-control processes, thereby improving the efficiency of data migration, reducing manual intervention, and having a high degree of automation; and, the data migration information includes a stored procedure, which satisfies the requirement that the migration of each business module to be migrated is processed through an independent stored procedure, so if a migration exception occurs in a business module to be migrated, there is no need to interrupt the entire data migration task, thereby further improving the efficiency of data migration; in addition, the data migration information includes a sub-task script and a data verification script corresponding to the sub-task script, thereby ensuring the correctness of data migration; and, multi-process concurrent scheduling of data migration tasks is achieved through named pipes, thereby accelerating the speed of data migration.

[0080] Figure 5 An exemplary system architecture 500 is shown to which the data migration method or data migration apparatus according to the embodiment of the present invention can be applied.

[0081] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0082] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Terminal devices 501, 502, 503 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, etc.

[0083] Server 505 can be a server that provides various services, for example, a background management server that provides support when a user uses terminal devices 501, 502, and 503 to migrate data (only as an example); for another example, server 505 can complete the data migration of an embodiment of the present invention.

[0084] It should be noted that the data migration method provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the data migration device is generally disposed in the server 505 .

[0085] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0086] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0087] like Figure 6As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0088] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0089] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.

[0090] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: 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 the present invention, a computer-readable storage medium may 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. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0091] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0092] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor. For example, they may be described as: a processor includes a configuration module, a startup module, and a migration module. The names of these modules do not constitute a limitation on the modules themselves in some cases. For example, the configuration module may also be described as "a module that receives a data migration task and configures a plurality of parameter files corresponding to the business modules to be migrated according to the data migration task."

[0093] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: receiving a data migration task, and configuring a parameter file corresponding to a plurality of business modules to be migrated according to the data migration task, wherein the parameter file includes: database information, dependency relationships between a plurality of business modules to be migrated, data migration information corresponding to each business module to be migrated, and the number of concurrency of sub-control processes; using the main control process to read the number of concurrency of the sub-control process, and starting a plurality of sub-control processes according to the number of concurrency of the sub-control process; using the main control process and a plurality of sub-control processes, according to the dependency relationships between a plurality of business modules to be migrated and the data migration information corresponding to each business module to be migrated, combined with the database information, to perform data migration.

[0094] According to the technical solution of the embodiment of the present invention, the parameter information corresponding to the data migration task is configured, and the database information, the dependency relationship between multiple business modules to be migrated, the data migration information corresponding to each business module to be migrated, and the number of concurrent sub-control processes are set, so that the data migration of multiple business modules to be migrated can be automatically and sequentially executed, avoiding the problem of complex data migration scripts in the existing data migration method. The data migration of multiple business modules to be migrated can also be concurrently executed through the main control process and multiple sub-control processes, thereby improving the efficiency of data migration, reducing manual intervention, and having a high degree of automation; and the data migration information includes a stored procedure, which satisfies the requirement that the migration of each business module to be migrated is processed through an independent stored procedure. Therefore, if a migration exception occurs in a business module to be migrated, there is no need to interrupt the entire data migration task, thereby further improving the efficiency of data migration; in addition, the data migration information includes a sub-task script and a data verification script corresponding to the sub-task script, thereby ensuring the correctness of data migration; and the multi-process concurrent scheduling of the data migration task is realized through a named pipe, thereby speeding up the data migration.

[0095] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A data migration method, characterized in that: include: Receive a data migration task, and configure a plurality of parameter files corresponding to the business modules to be migrated according to the data migration task, wherein the parameter files include: database information, dependency relationships between the plurality of business modules to be migrated, data migration information corresponding to each of the business modules to be migrated, and the number of concurrent sub-control processes; the data migration information includes: stored procedures, sub-task scripts, and data verification scripts corresponding to the sub-task scripts; Using the main control process to read the concurrent number of the sub-control process, and starting multiple sub-control processes according to the concurrent number of the sub-control process; wherein the main control process is used to manage the sub-control process; Using a main control process and a plurality of sub-control processes, according to the dependency relationship between the plurality of to-be-migrated business modules and the data migration information corresponding to each of the to-be-migrated business modules, combined with the database information, data migration is performed, including: Determining, by means of a main control process, a migration order corresponding to the plurality of service modules to be migrated according to dependency relationships between the plurality of service modules to be migrated; Using the main control process, according to the migration order corresponding to the multiple business modules to be migrated, the module unique identifiers of the multiple business modules to be migrated are passed as parameters to the multiple sub-control processes; Using the sub-control process, according to the module unique identifier of the target business module, query the data migration information corresponding to the target business module, and then perform data migration on the target business module according to the data migration information corresponding to the target business module and in combination with the database information; wherein, The target service module is the service module to be migrated corresponding to the module unique identifier passed into the sub-control process.

2. The method according to claim 1, characterized in that The database information includes: a source database, a destination database, and connection information between the source database and the destination database; and, The performing data migration on the target business module according to the data migration information corresponding to the target business module and in combination with the database information includes: Calling the stored procedure corresponding to the target business module, and executing the subtask script included in the target business module according to the connection information between the source database and the target database, so as to migrate the data of the target business module from the source database to the target database; After the subtask script included in the target business module is executed, a data verification script corresponding to the subtask script included in the target business module is executed; If the verification passes, the data migration status of the target business module is marked as completed; if the verification fails, the data migration status of the target business module is marked as incomplete.

3. The method according to claim 2, characterized in that After performing data migration on the target business module, the method further includes: Determine whether there is a to-be-migrated business module for which data migration has not been performed, and whether the data migration status of the business module on which the to-be-migrated business module for which data migration has not been performed is completed; If so, the main control process is used to pass the module unique identifier of the business module to be migrated that has not executed data migration as a parameter to the sub-control process corresponding to the target business module, so as to perform data migration on the module of the business module to be migrated that has not executed data migration; wherein, The sub-control process corresponding to the target business module is a sub-control process that performs data migration on the target business module.

4. The method according to claim 2, characterized in that: After marking the data migration status of the target service module as incomplete migration, the method further includes: After the data migration anomaly existing in the target business module is repaired, the data migration status of the target business module is marked as completed by using the main control process.

5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: The main control process is used to call the mkfilo method to create a named pipe, and then according to the concurrency number of the sub-control process, multiple blank lines of data are cyclically written into the named pipe to initialize the named pipe; wherein, The number of data rows of the plurality of blank rows of data is the concurrent number of the sub-control processes.

6. The method according to claim 5, characterized in that The step of transferring the module unique identifiers of the multiple business modules to be migrated as parameters to the multiple sub-control processes according to the migration order corresponding to the multiple business modules to be migrated includes: Read the multiple blank lines of data in sequence; Each time a blank line of data is read, a business module to be migrated is selected from the multiple business modules to be migrated according to the migration order corresponding to the multiple business modules to be migrated; The module unique identifier of the selected business module to be migrated is used as a parameter and is passed into the sub-control process whose process status is idle.

7. A data migration device, characterized in that: include: A configuration module, configured to receive a data migration task, and configure a plurality of parameter files corresponding to the business modules to be migrated according to the data migration task, wherein the parameter files include: database information, dependency relationships between the plurality of business modules to be migrated, data migration information corresponding to each of the business modules to be migrated, and the number of concurrent sub-control processes; the data migration information includes: a stored procedure, a sub-task script, and a data verification script corresponding to the sub-task script; A startup module, used to read the concurrency number of the sub-control process by using the main control process, and start multiple sub-control processes according to the concurrency number of the sub-control process; wherein the main control process is used to manage the sub-control process; The migration module is used to utilize the main control process and the plurality of sub-control processes to perform data migration according to the dependency relationship between the plurality of business modules to be migrated and the data migration information corresponding to each of the business modules to be migrated, in combination with the database information, including: Determining, by means of a main control process, a migration order corresponding to the plurality of service modules to be migrated according to dependency relationships between the plurality of service modules to be migrated; Using the main control process, according to the migration order corresponding to the multiple business modules to be migrated, the module unique identifiers of the multiple business modules to be migrated are passed as parameters to the multiple sub-control processes; Using the sub-control process, according to the module unique identifier of the target business module, query the data migration information corresponding to the target business module, and then perform data migration on the target business module according to the data migration information corresponding to the target business module and in combination with the database information; wherein, The target service module is the service module to be migrated corresponding to the module unique identifier passed into the sub-control process.

8. The device according to claim 7, characterized in that The database information includes: a source database, a destination database, and connection information between the source database and the destination database; and, The migration module is also used to: Calling the stored procedure corresponding to the target business module, and executing the subtask script included in the target business module according to the connection information between the source database and the target database, so as to migrate the data of the target business module from the source database to the target database; After the subtask script included in the target business module is executed, a data verification script corresponding to the subtask script included in the target business module is executed; If the verification passes, the data migration status of the target business module is marked as completed; if the verification fails, the data migration status of the target business module is marked as incomplete.

9. The device according to claim 8, characterized in that The migration module is also used to: Determine whether there is a to-be-migrated business module for which data migration has not been performed, and whether the data migration status of the business module on which the to-be-migrated business module for which data migration has not been performed is completed; If so, the main control process is used to pass the module unique identifier of the business module to be migrated that has not executed data migration as a parameter to the sub-control process corresponding to the target business module, so as to perform data migration on the module of the business module to be migrated that has not executed data migration; wherein, The sub-control process corresponding to the target business module is a sub-control process that performs data migration on the target business module.

10. The device according to claim 8, characterized in that The migration module is also used to: After the data migration anomaly existing in the target business module is repaired, the data migration status of the target business module is marked as completed by using the main control process.

11. The device according to any one of claims 7 to 10, characterized in that: The startup module is also used for: The main control process is used to call the mkfilo method to create a named pipe, and then according to the concurrency number of the sub-control process, multiple blank lines of data are cyclically written into the named pipe to initialize the named pipe; wherein, The number of data rows of the plurality of blank rows of data is the concurrent number of the sub-control processes.

12. The device according to claim 11 is characterized in that The migration module is also used to: Read the multiple blank lines of data in sequence; Each time a blank line of data is read, a business module to be migrated is selected from the multiple business modules to be migrated according to the migration order corresponding to the multiple business modules to be migrated; The module unique identifier of the selected business module to be migrated is used as a parameter and is passed into the sub-control process whose process status is idle.

13. An electronic device, characterized in that: include: one or more processors; a storage device 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 method according to any one of claims 1 to 6.

14. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Data migration method and device, server and storage medium

    CN108509556A

  • Data migration method and device and computer storage medium

    CN111143331A

  • Data migration system and method

    US20040111726A1