Data migration method, system and device

By parallel transmission and splitting tables between multiple servers, the problem of low efficiency of existing data migration is solved, and an efficient and accurate data migration process is realized, reducing manual errors and transmission time.

CN118885459APending Publication Date: 2024-11-01CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410932484.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

Existing data migration methods are inefficient in complex customer channel systems and are difficult to meet timeliness requirements, especially when multi-table data migration, the transmission time consumes due to the limitations of a single server and the large amount of data, and manual operation is prone to errors.

Method used

By transmitting data in parallel between multiple servers, using export instructions and splitting table technology, large tables are divided into multiple small tables, exported and imported in parallel, and using shell commands and configuration scripts to ensure data type consistency and improve data migration Accuracy and efficiency.

Benefits of technology

It significantly shortens the data migration time, improves the efficiency of data migration, reduces manual errors, and ensures the accuracy and reliability of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885459A_ABST
    Figure CN118885459A_ABST
Patent Text Reader

Abstract

The invention provides a data migration method, system and device, is applied to the technical field of data processing, and is used for improving the efficiency of data migration. The system comprises N first servers, a second server, a third server and a fourth server, a first database is deployed on the second server, and a second database is deployed on the fourth server; the method comprises the following steps: the first server sends an export instruction to the second server; the second server obtains at least one table corresponding to the first server from the first database according to the export instruction; the first server exports the at least one table, distributes the at least one table into at least one transmission file, initiates a transmission request to a third server, and transmits the at least one transmission file to the third server in parallel; and the third server imports the at least one transmission file into the second database of the fourth server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Data migration is an important part of the localization transformation task, and being able to efficiently complete data migration is the key to maintaining business continuity. However, due to the complexity of customer channel systems, the huge amount of data, and the large number of tables involved in data migration, the efficiency of serial file transmission on a single server is low, making it difficult to meet the timeliness requirements of complex data migration.

[0003] Therefore, how to optimize the data migration method and improve the efficiency of data migration is a current research hotspot. Summary of the invention

[0004] The present application provides a data migration method, system and device for improving the efficiency of data migration.

[0005] In a first aspect, an embodiment of the present application provides a data migration method, which is applied to a first server and includes:

[0006] Sending an export instruction to a second server, where the first database is deployed, the export instruction is used to instruct the second server to obtain at least one table from the first database, where the table name of the at least one table corresponds to the table name specified by the first server; the export instruction includes a list of table names corresponding to the first server;

[0007] exporting at least one table from a second server;

[0008] dividing the at least one table into at least one transmission file, wherein the total amount of data of the table in each transmission file is less than a preset amount;

[0009] A transmission request is initiated to a third server, a response to the transmission request is received from the third server, and at least one transmission file is transmitted to the third server in parallel; wherein the transmission request is used to indicate that at least one transmission file is transmitted to the third server.

[0010] In this solution, the first server sends an export instruction to the second server, so that the second server obtains at least one table corresponding to the first server, and then the first server can export at least one table corresponding to the first server, which can improve the accuracy of data migration. The at least one table is then grouped according to the total amount of data to obtain at least one transfer file. By importing at least one transfer file in parallel, the import time can be shortened, thereby improving the efficiency of data migration.

[0011] Optionally, sending an export instruction to the second server includes:

[0012] Send the export instruction to the second server at the set time.

[0013] In this method, the first server executes the task at the set time without manual input of execution instructions, which can save time when manually triggering the export command and avoid errors that may be caused by manual input errors, thereby improving the efficiency of data migration.

[0014] Optionally, the export instruction is also used to indicate at least one of the following: obtaining a table containing preset fields in the first database; horizontally splitting a table in the first database whose data volume is greater than a first threshold, and obtaining a table after horizontal splitting; horizontal splitting refers to splitting a table whose data volume is greater than the first threshold into multiple tables with the same structure, and the first threshold is the maximum data volume of a single table allowed by the second database; splitting a table in the first database that meets the preset conditions, and obtaining at least one table after splitting; dividing multiple first-category data tables in the first database into n parts on average, obtaining one table from the n parts, and saving the remaining n-1 parts, and the data volume of the first-category data table is less than a second threshold; and dividing multiple second-category data tables in the first database on average into m parts, obtaining one table from the m parts, and saving the remaining m-1 parts, and the data volume of the second-category data table is greater than the second threshold; wherein m and n are positive integers, and m is greater than n; or, obtaining one table from the K parts of the split table, the K parts of the table are of the same type, and K is a positive integer.

[0015] In this method, the export instruction can instruct the first database to split the tables in the first database to obtain tables of the type corresponding to each first server, which can improve the accuracy of data migration. Splitting the tables in the first database reduces the amount of data exported to the tables on the first server, which can reduce the time consumption of data transmission and thereby improve the efficiency of data migration.

[0016] Optionally, at least one table includes multiple tables, and dividing the at least one table into at least one transmission file includes: dividing the multiple tables into at least two transmission files, and the difference in data volume between any two transmission files in the at least two transmission files is less than a preset difference.

[0017] In this method, if at least one table includes multiple tables, the multiple tables are evenly divided into at least two transfer files, so that each transfer file can be imported as simultaneously as possible during parallel import, thereby saving waiting time and improving the efficiency of data migration.

[0018] Optionally, dividing at least one table into at least one transmission file includes: generating a shell command for file transmission based on the at least one table; splitting the shell command into at least one shell subcommand; and storing a table corresponding to each subcommand in the at least one subcommand into a transmission file.

[0019] In this method, at least one table is grouped through a shell command, and the splitting method is simple and fast, which can increase the speed of dividing at least one table into at least one transmission file, and further improve the efficiency of data migration.

[0020] Optionally, generating a shell command for file transfer based on at least one table includes: sorting the identifiers of at least one table from large to small or from small to large according to the data volume of the table, and generating a shell command according to the sorted list.

[0021] In this method, at least one table is sorted according to the amount of data, so that at least one table can be evenly grouped according to the amount of data, so that the amount of data in each transmission file is close, and the import is completed as simultaneously as possible, thereby saving waiting time and improving the efficiency of data migration.

[0022] Optionally, after exporting at least one table from the second server, the method further includes: outputting an export completion message, where the export completion message is used to indicate that the first server has completed exporting the table of the first database.

[0023] In this method, after receiving at least one table from the first database, the first server outputs an export completion message to prompt the technician that the export of the table of the first database has been completed, so that the technician can confirm the export situation and issue the transmission instruction in time, thereby improving the efficiency of data migration.

[0024] Optionally, the method further includes: sending an import script to a third server; wherein the import script is used to receive at least one transmission file from the first server.

[0025] Optionally, the first database and the second database can store different types of data, and the method further includes: sending a configuration script to a third server; wherein the configuration script is used to convert the data type of the table in the transmission file transmitted to the third server into the data type that can be stored in the second database.

[0026] In this method, since the first database and the second database can store different types of data, the problem of inconsistent data types in the two databases can be solved by exporting the data of at least one table in the second server as a data file.

[0027] Optionally, the method further includes: sending at least one shell subcommand in parallel to a third server, so that the third server verifies whether the table of at least one received transmission file is consistent with the table in the shell subcommand.

[0028] In this method, a shell command for file transfer is sent to a third server, so that before the third server imports at least one table into the second database, it first confirms whether the table of at least one received transfer file is consistent with the table in the transfer shell subcommand, thereby avoiding missing data tables or transmission anomalies during the transmission process, which may lead to anomalies in the subsequent import process, and can further improve the reliability of the present application.

[0029] In a second aspect, an embodiment of the present application provides a data migration method, which is applied to a second server, where a first database is deployed, including:

[0030] receiving an export instruction from each of the N first servers, the export instruction being used to instruct the second server to obtain at least one table from the first database, the table name of the at least one table corresponding to the table name specified by the first server, the export instruction comprising a list of table names corresponding to the first servers; wherein the table name specified by each of the N first servers corresponds to the table name of a table in the first database, and N is a positive integer;

[0031] According to the export instruction sent by each first server, at least one table corresponding to each first server is obtained.

[0032] In this solution, according to the table name specified by each of the N first servers, the table corresponding to the table name specified by each first server is obtained from the first database, so that the tables in the first database are exported by the N first servers respectively, which can reduce the amount of data exported by each server and reduce the time spent in exporting the tables of the first database, thereby improving the efficiency of data migration.

[0033] Optionally, according to the export instruction sent by each first server, at least one table corresponding to each first server is obtained, and at least one of the following items is also included: obtaining a table containing preset fields in the first database; horizontally splitting the table in the first database whose data volume is greater than the first threshold, and obtaining the table after horizontal splitting; horizontal splitting refers to splitting the table whose data volume is greater than the first threshold into multiple tables with the same structure, and the first threshold is the maximum data volume of a single table allowed by the second database; splitting the table in the first database that meets the preset conditions, and obtaining at least one table after splitting; dividing multiple first-category data tables in the first database into n parts on average, obtaining one table in the n parts, saving the remaining n-1 parts, and the data volume of the first-category data table is less than the second threshold; and dividing multiple second-category data tables in the first database on average into m parts, obtaining one table in the m parts, saving the remaining m-1 parts, and the data volume of the second-category data table is greater than the second threshold; wherein m and n are positive integers, and m is greater than n, and m plus n is less than N; or, obtaining one table in the K parts of the split table, the K parts of the table are of the same type, and K is a positive integer.

[0034] In a third aspect, an embodiment of the present application provides a data migration method, which is applied to a third server, including:

[0035] receiving a transmission request from a first server; receiving a transmission instruction, and responding to the transmission request of the first server according to the transmission instruction; the transmission instruction is used to instruct receiving at least one transmission file transmitted by the first server, and the transmission request is used to instruct the first server to transmit at least one transmission file to a third server;

[0036] Using an import script, receiving at least one transmission file from each of N first servers; N is a positive integer;

[0037] Using a configuration script, converting a data type of a table in at least one transmission file that does not conform to a data type that can be stored in a second database of the fourth server;

[0038] At least one transport file is imported into the second database.

[0039] In this method, the efficiency of data migration can be improved by receiving at least one transmission file from each of N first servers in parallel; and the reliability of this application can be improved by using a configuration script to convert tables that do not meet the storable data types of the second database.

[0040] Optionally, the method also includes: receiving a configuration script and / or an import script from each of the N first servers, wherein the configuration script is used to convert the data type of the table in the transmission file transmitted to the third server into a data type that can be stored in the second database; and the import script is used to receive at least one transmission file from the first server.

[0041] Optionally, the method also includes: receiving at least one shell subcommand from each of the N first servers, the at least one shell subcommand being generated by at least one table of each first server; verifying whether the table in the at least one shell subcommand of each first server is consistent with the table in the transmission file received from each first server, and if not, outputting a transmission abnormality alarm.

[0042] Optionally, the method further includes: receiving a total amount of data imported into the table in the second database from a fourth server;

[0043] Verifying whether the total amount of data in the table of at least one received transmission file is consistent with the total amount of data in the table imported into the second database;

[0044] If they are inconsistent, an export exception alarm will be output.

[0045] In this method, it is checked whether the total amount of data imported into the table in the second database is consistent with the total amount of data in the table to be imported. If they are inconsistent, an export exception alarm is output to facilitate technicians to check whether import errors occur, which can improve the reliability of this application.

[0046] In a fourth aspect, an embodiment of the present application provides a data migration method, which is applied to a fourth server, where a second database is deployed, including:

[0047] At least one transmission file is received from a third server, and the at least one transmission file is imported into the second database.

[0048] Optionally, before importing at least one transmission file into the second database, the method further includes: clearing data in the second database.

[0049] In this method, before importing at least one table of the transmission file into the second database, the data in the second database is cleared first, so as to facilitate the subsequent determination of whether the import is successful by detecting whether the amount of imported data matches the amount of received data, thereby improving the reliability of this application.

[0050] Optionally, the method further includes: sending the total amount of data of the table imported into the second database to the third server, so that the third server verifies whether the total amount of data of the table of at least one received transmission file is consistent with the total amount of data of the table imported into the second database.

[0051] In a fifth aspect, an embodiment of the present application provides a data migration system, including:

[0052] N first servers, each of the N first servers is used to execute the first aspect or any optional implementation of the first aspect;

[0053] A second server, used to execute the second aspect or any optional implementation manner of the second aspect;

[0054] A third server, used to execute the third aspect or any optional implementation manner of the third aspect;

[0055] A fourth server is used to execute the fourth aspect or any optional implementation of the fourth aspect.

[0056] In a sixth aspect, an embodiment of the present application provides a data migration device, applied to a first server, comprising:

[0057] The transceiver module is used to: send an export instruction to a second server, where the first database is deployed, and the export instruction is used to instruct the second server to obtain at least one table from the first database, where the table name of the at least one table corresponds to the table name specified by the first server; the export instruction includes a list of table names corresponding to the first server; and export at least one table from the second server;

[0058] A processing module, configured to: divide the at least one table into at least one transmission file, wherein the total amount of data in the table of each transmission file is less than a preset amount;

[0059] The transceiver module is also used to: initiate a transmission request to a third server, receive a response to the transmission request from the third server, and transmit at least one transmission file to the third server in parallel; wherein the transmission request is used to indicate that at least one transmission file is transmitted to the third server.

[0060] Optionally, when sending the export instruction to the second server, the transceiver module is used to: send the export instruction to the second server at a set time.

[0061] Optionally, the export instruction is also used to indicate at least one of the following: obtaining a table containing preset fields in the first database; horizontally splitting a table in the first database whose data volume is greater than a first threshold, and obtaining a table after horizontal splitting; horizontal splitting refers to splitting a table whose data volume is greater than the first threshold into multiple tables with the same structure, and the first threshold is the maximum data volume of a single table allowed by the second database; splitting a table in the first database that meets the preset conditions, and obtaining at least one table after splitting; dividing multiple first-category data tables in the first database into n parts on average, obtaining one table from the n tables, saving the remaining n-1 tables, and the data volume of the first-category data table is less than a second threshold; and dividing multiple second-category data tables in the first database on average into m parts, obtaining one table from the m tables, saving the remaining m-1 tables, and the data volume of the second-category data table is greater than the second threshold; wherein m and n are positive integers, and m is greater than n; or, obtaining one table from the K split tables, the K tables are of the same type, and K is a positive integer.

[0062] Optionally, at least one table includes multiple tables, and when the processing module divides the at least one table into at least one transmission file, it is used to: divide the multiple tables into at least two transmission files, and the difference in data volume between any two transmission files in the at least two transmission files is less than a preset difference.

[0063] Optionally, when dividing at least one table into at least one transmission file, the processing module is used to: generate a shell command for file transfer based on at least one table; split the shell command into at least one shell sub-command; and store the table corresponding to each sub-script in at least one sub-script into a transmission file.

[0064] Optionally, when generating a shell command for file transfer based on at least one table, the processing module is used to: sort the identifier of at least one table from large to small or from small to large according to the data size of the table, and generate a shell command according to the sorted list.

[0065] Optionally, after exporting at least one table from the second server, the transceiver module is further used to: output an export completion message, where the export completion message is used to indicate that the first server has completed the export of the table of the first database.

[0066] Optionally, the transceiver module is further used to: send an import script to a third server; wherein the import script is used to receive at least one transmission file from the first server.

[0067] Optionally, the first database and the second database can store different types of data, and the transceiver module is also used to: send a configuration script to the third server; wherein the configuration script is used to convert the data type of the table in the transmission file transmitted to the third server into the data type that can be stored in the second database.

[0068] Optionally, the transceiver module is further used to: send at least one shell subcommand in parallel to a third server, so that the third server verifies whether the table of at least one transmission file received is consistent with the table in the at least one shell subcommand.

[0069] In a seventh aspect, an embodiment of the present application provides a data migration device, which is applied to a second server, and a first database is deployed on the second server, including:

[0070] A transceiver module, configured to: receive an export instruction from each of the N first servers, the export instruction being used to instruct the second server to obtain at least one table from the first database, the table name of the at least one table corresponding to the table name specified by the first server, the export instruction comprising a list of table names corresponding to the first servers; wherein the table name specified by each of the N first servers corresponds to the table name of a table in the first database, and N is a positive integer;

[0071] The processing module is used to: obtain at least one table corresponding to each first server according to the export instruction sent by each first server.

[0072] Optionally, when the processing module obtains at least one table corresponding to each first server according to the export instruction issued by each first server, it is used for at least one of the following: obtaining a table containing preset fields in the first database; horizontally splitting the table in the first database whose data volume is greater than the first threshold value, and obtaining the table after the horizontal split; horizontal splitting refers to splitting the table whose data volume is greater than the first threshold value into multiple tables with the same structure, and the first threshold value is the maximum data volume of a single table allowed by the second database; splitting the table in the first database that meets the preset conditions, and obtaining at least one table after the split; dividing multiple first-category data tables in the first database into n parts on average, obtaining one table from the n parts, saving the remaining n-1 parts, and the data volume of the first-category data table is less than the second threshold; and dividing multiple second-category data tables in the first database on average into m parts, obtaining one table from the m parts, saving the remaining m-1 parts, and the data volume of the second-category data table is greater than the second threshold; wherein m and n are positive integers, and m is greater than n; or, obtaining one table from the K parts of the split table, the K parts of the table are of the same type, and K is a positive integer.

[0073] In an eighth aspect, an embodiment of the present application provides a data migration device, which is applied to a third server, including:

[0074] The transceiver module is used to: receive a transmission request from a first server; receive a transmission instruction, and respond to the transmission request of the first server according to the transmission instruction; the transmission instruction is used to instruct to receive at least one transmission file transmitted by the first server, and the transmission request is used to instruct the first server to transmit at least one transmission file to a third server; use an import script to receive at least one transmission file from each of N first servers; N is a positive integer;

[0075] A processing module, configured to: use a configuration script to convert a data type of a table in at least one transmission file that does not conform to a data type that can be stored in a second database of a fourth server;

[0076] The transceiver module is further used to: import at least one transmission file into the second database.

[0077] Optionally, the transceiver module is also used to: receive a configuration script and / or an import script from each of the N first servers, wherein the configuration script is used to convert the data type of the table in the transmission file transmitted to the third server into a data type that can be stored in the second database; and the import script is used to receive at least one transmission file from the first server.

[0078] Optionally, the transceiver module is also used to: receive at least one shell subcommand from each of the N first servers, where the at least one shell subcommand is generated by at least one table of each first server; the processing module is also used to: verify whether the table in at least one shell subcommand of each first server is consistent with the table in the transmission file received from each first server, and if not, output a transmission abnormality alarm.

[0079] Optionally, the transceiver module is also used to: receive the total amount of data of the table imported into the second database from the fourth server; the processing module is also used to: verify whether the total amount of data of the table of at least one received transmission file is consistent with the total amount of data of the table imported into the second database; if inconsistent, output an import abnormality alarm.

[0080] In a ninth aspect, an embodiment of the present application provides a data migration device, which is applied to a fourth server, and a second database is deployed on the fourth server, including:

[0081] The transceiver module is used to: receive at least one transmission file from a third server;

[0082] A processing module is used to: import the at least one transmission file into the second database.

[0083] Optionally, before the processing module imports the at least one transmission file into the second database, the method further includes: clearing the data in the second database.

[0084] Optionally, the transceiver module is also used to: send the total amount of data of the table imported into the second database to the third server, so that the third server can verify whether the total amount of data of the table of at least one received transmission file is consistent with the total amount of data of the table imported into the second database.

[0085] In the tenth aspect, an embodiment of the present application provides an electronic device, comprising at least one processor, which is used to execute a computer program stored in a memory, so that the method in the first aspect or any optional implementation of the first aspect, the second aspect or any optional implementation of the second aspect, the third aspect or any optional implementation of the third aspect, or the fourth aspect or any optional implementation of the fourth aspect is implemented.

[0086] In the eleventh aspect, an embodiment of the present application provides a computer-readable storage medium, which is used to store instructions. When the instructions are executed, the method in the first aspect or any optional implementation of the first aspect or the second aspect or any optional implementation of the second aspect or the third aspect or any optional implementation of the third aspect or the fourth aspect or any optional implementation of the fourth aspect is implemented.

[0087] In the twelfth aspect, an embodiment of the present application provides a computer program product, including a computer program code. When the computer program code is run on a computer, the method as described in the first aspect or any optional implementation of the first aspect, the second aspect or any optional implementation of the second aspect, the third aspect or any optional implementation of the third aspect, or the fourth aspect or any optional implementation of the fourth aspect is implemented.

[0088] The technical effects or advantages of one or more technical solutions provided in the second to twelfth aspects of the embodiments of the present application can be correspondingly explained by the technical effects or advantages of one or more corresponding technical solutions provided in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0089] Figure 1 An example diagram of a data migration system provided in an embodiment of the present application;

[0090] Figure 2 An example diagram of an application scenario provided in an embodiment of the present application;

[0091] Figure 3 An example diagram of a physical device provided in an embodiment of the present application;

[0092] Figure 4 A flow chart of a data migration method provided in an embodiment of the present application;

[0093] Figure 5 A structural diagram of a data migration device provided in an embodiment of the present application;

[0094] Figure 6 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0095] In the technical solution of this application, the collection, dissemination, and use of data are in compliance with the requirements of relevant national laws and regulations.

[0096] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0097] The technical solution of the present application is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present application and the specific features in the embodiments are detailed descriptions of the technical solution of the present application, rather than limitations on the technical solution of the present application. In the absence of conflict, the embodiments of the present application and the technical features in the embodiments can be combined with each other.

[0098] The following is an introduction to some professional terms involved in the embodiments of this application:

[0099] Horizontal table splitting: refers to distributing the row data of a table into different tables or databases according to certain rules. The structure of each table is exactly the same, but the data sets stored are different. In this way, the amount of data can be dispersed, the amount of data in a single table can be reduced, and the parallel processing capability and query performance can be improved.

[0100] Splitting a table vertically: This means reorganizing the table structure and splitting a large table into multiple tables based on the relevance of columns. This can reduce the storage capacity of a single table and improve query performance.

[0101] It should be understood that "multiple" in the description of the embodiment of the present application refers to two or more. "First", "second" etc. in the embodiment of the present application are used to distinguish different objects, rather than to describe a specific order. The term "and / or" in the embodiment of the present application is merely a kind of association relationship describing associated objects, indicating that three relationships may exist, for example, A and / or B, which may represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "includes" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. The module in the embodiment of the present application refers to a part with independent functions in a software system.

[0102] The following are some technical features involved in this application:

[0103] According to the rules for the transformation and construction of the localization maturity of financial business scenarios, the business systems of banks also need to complete the localization transformation. For example, the customer channel operation and maintenance system, which is an important basic business system in the banking field, can provide data push services for the bank's automatic teller machines, queuing machines and other equipment. The main businesses include equipment clearing and cash adding, passbook withdrawals at self-service terminals, electronic password locks at self-service terminals, real-time number taking at queuing machines, appointment number taking functions, and the function of queuing machines pushing queuing information to customers, which also need technical transformation.

[0104] The process of localization transformation involves migrating the tables in the original database (first database) to the new database (second database). However, due to the complexity of the customer channel operation and maintenance system and the huge amount of data, the number of tables involved in the data migration process is large, and the data migration has the following pain points:

[0105] Using a single server for data migration is limited by the CPU and input or output (I / O) resources of the single server. It takes a long time to transfer a large data table (for example, 1TB), which greatly squeezes the data migration time and affects the normal business processing of customers.

[0106] For example, the original database uses Oracle database, and the new database uses a domestic database (such as TDSQL database). When using the data migration tool provided by Oracle database to directly migrate data, both the source database and the target database must be Oracle databases. In the process of migrating data from Oracle database to TDSQL database, the data migration tool provided by Oracle database (such as expdp, impdp) cannot be used to migrate the same database, which has great limitations.

[0107] The exported data files are compressed before transmission, which takes a long time to compress. The operating system has a limit on the size of a single compressed file, which generally cannot exceed 2G. In addition, some servers (such as the third server) do not support file transmission in the form of folders.

[0108] There is some data that does not need to be migrated repeatedly, such as some large tables with a data volume exceeding 2G (or other thresholds), and the data in the table one year ago has been pushed to the data warehouse for storage, so there is no need to migrate the table;

[0109] The length of table fields of some large tables in the original database exceeds the maximum length allowed by the new database, or the index length exceeds the maximum length allowed by the new database index, and cannot be directly migrated.

[0110] Currently, data migration mostly uses a single machine to transfer files serially, which has low transmission efficiency and cannot meet the timeliness requirements of complex data migration. It is necessary to manually execute file export commands, confirm the completion of file transfer, and manually start the file import program. If there are multiple servers executing import and export tasks at the same time, the efficiency is low and errors are prone to occur. In addition, most data migrations can only support the migration of entire tables.

[0111] In view of this, an embodiment of the present application provides a data migration method, system and device, which sets a scheduled task on N first servers so that the N first servers send export instructions to the second server at a predetermined time, and the second server splits and groups several tables in the first database, and each first server exports at least one table corresponding to the first server from the second server, which can improve the data migration efficiency; the first server performs secondary grouping on at least one received table, divides it into at least one transmission file, and transmits at least one transmission file in parallel to a third server, which can further improve the data migration efficiency, and at least one table can be evenly divided into at least one transmission file according to the amount of data, so as to facilitate the simultaneous import of at least one transmission file imported in parallel, reduce waiting time, and thus improve data migration efficiency; finally, the third server imports at least one transmission file into the second database of the fourth server to realize the migration of the table in the first database to the second database.

[0112] The data migration solution provided in the embodiment of the present application can be applied to various data migration scenarios, including but not limited to the above-mentioned example of migrating from an Oracle database to a TDSQL database.

[0113] See also Figure 1 , is an example diagram of a data migration system provided in an embodiment of the present application, the system includes N first servers, second servers, third servers and fourth servers, a first database is deployed on the second server, a second database is deployed on the fourth server, and N is a positive integer.

[0114] The N first servers are used to export the table in the first database and transmit it to the third server.

[0115] The second server is used to obtain a table corresponding to each first server from a table in the first database.

[0116] For example, in a banking business scenario, the first database may be: Figure 2 The database of the customer channel operation and maintenance system shown in the figure, usually, the data sources of the customer channel operation and maintenance system may include ATMs and various deployed self-service terminals (i.e., self-service clusters), such as electronic banking, bank queuing machines, etc.; the customer channel operation and maintenance system is used for the management and parameter maintenance of self-service terminals, report query on the operating status of self-service terminals, and other services, and the amount of table data stored is huge.

[0117] The third server is used for: receiving the instruction of the technician to obtain the corresponding table from the first server and importing it into the second database of the fourth server.

[0118] The fourth server is used to import the table sent by the third server into the second database.

[0119] For example, taking the business scenario of a bank as an example, Figure 3 An example of a physical device architecture for a data migration system is provided. Figure 3 The first database in the customer channel operation and maintenance system can be an open database; servers 1 to 12 (i.e., 12 first servers) can be self-service cluster servers that serve as data sources for the customer channel operation and maintenance system, such as online transaction clusters, self-service channel management clusters, queuing machine clusters, serial number clusters, overseas clusters, etc. Different clusters are responsible for collecting different customer information and processing different businesses. It can be understood that Figure 3 The servers and databases in the example are only possible examples. In actual applications, other clusters of the above five clusters can be deployed or other servers can be deployed, or other types of databases can be used. The number of first servers can also be adjusted according to actual needs. The embodiments of the present application do not limit this.

[0120] It can be understood that the above is only an example scenario of data migration provided in an embodiment of the present application, and the data migration method provided in an embodiment of the present application can also be applied to other data migration scenarios.

[0121] See also Figure 4 , which is a data migration method provided in an embodiment of the present application, can be applied to Figure 3 In the data migration system shown, the first server is any first server among N first servers, and the method includes S101 to S107:

[0122] S101. A first server sends an export instruction to a second server, and the second server receives the export instruction.

[0123] Among them, the first database is deployed on the second server, and the export instruction is used to instruct the second server to obtain at least one table from the first database, and the table name of at least one table corresponds to the table name specified by the first server; the export instruction includes a list of table names corresponding to the first server.

[0124] Understandably, Figure 4 The method shown is only based on one first server as an example, and may actually include N first servers, where N is a positive integer, for example Figure 3 The data migration system shown includes 12 first servers. Accordingly, the second server will receive the export instruction sent by each of the N first servers.

[0125] In a possible embodiment, the first server sends an export instruction to the second server at a set time.

[0126] Exemplarily, a scheduled task is set on each of the N first servers, and the scheduled task is used to instruct each server to send an export instruction to the second server at a set time.

[0127] Optionally, at a set time, a technician sends an instruction message to each first server, so that the first server sends an export instruction to the first database.

[0128] Optionally, the time set on each first server is the same, for example, a crontab command is used to set a scheduled task on each first server, so that each server sends an export instruction to the second server at the same time, and the export tasks on each server are executed in parallel, which can fully utilize the CPU and memory resources of the first server, i.e., the application service, and reduce the waiting time of the export process, thereby improving the efficiency of data migration.

[0129] It is understandable that when setting a scheduled task on the first server, it is necessary to ensure that the path or other identifier of the second server is stored on the first server, or the path or other identifier of the second server is included in the export instruction;

[0130] Moreover, the export instruction of the embodiment of the present application is improved on the basis of the export tool (sqluldr2) of the first database, so that the export instruction can support both horizontal splitting of the data table and vertical splitting of the data table. Therefore, the first server also needs to have the execution permission of sqluldr2, and also needs to confirm that the configuration environment of the sqluldr2 tool is normal and the environment variable settings are normal.

[0131] In addition, before the export is performed, it is also necessary to confirm whether the storage capacity of the storage space of the second database can satisfy the storage of the tables in the first database.

[0132] S102: The second server obtains at least one table corresponding to the first server according to the export instruction sent by the first server.

[0133] Exemplarily, the second server searches and obtains the table corresponding to the first server in the first database according to the identifier of the type of the table corresponding to the first server in the export instruction of each first server.

[0134] In a possible embodiment, the method for obtaining at least one table corresponding to the first server specifically includes at least one of the following:

[0135] 1. Obtain a table containing preset fields in the first database.

[0136] Exemplarily, the preset field may be a clob field. Since a table containing a clob field must be split into multiple segments of 4,000 characters in length for export, data loss can be avoided and the correctness of the business logic can be ensured. The export command for a table containing a clob field is different from the export command for a table not containing a clob field, that is, different scripts are called to perform the export. Therefore, a table containing a clob field can be exported separately by a corresponding first server.

[0137] 2. Perform horizontal splitting on the table in the first database whose data volume is greater than the first threshold, and obtain the table after the horizontal splitting;

[0138] Horizontal splitting refers to splitting a table whose data volume is greater than a first threshold into multiple tables with the same structure. The first threshold is the maximum data volume of a single table allowed by the second database.

[0139] For example, if the total field length or index length of the table in the first database exceeds the maximum length of a single table allowed by the second database, the table needs to be split and then exported. The table can be split into multiple tables with the same structure through horizontal splitting. The total field length or index length of each horizontally split table is less than the maximum length of a single table allowed by the second database, and the horizontally split table is exported by a corresponding first server.

[0140] For example, if a table stores data for a year, the data in the table can be split by month, into 12 tables storing monthly data, and these 12 tables can be exported, or only the more important tables among the 12 tables can be exported. The above are just some examples, and are not limited to these.

[0141] 3. Split the tables in the first database that meet the preset conditions, and obtain at least one split table.

[0142] For example, a table is split horizontally. If a table contains many uncommon fields or fields with greatly different data types, the uncommon fields or fields with greatly different data types in the table can be stored in one table, and the commonly used fields or fields with less different data types can be stored in another table. When exporting, both tables can be exported, or only the table storing commonly used fields can be exported according to actual conditions.

[0143] Or you can split the table vertically. For example, if a table named dev_info contains more than 200 fields and the total length of the fields exceeds the maximum length of 65535 allowed by the TSSQL database, you can split the table vertically into three tables: dev_info_first, dev_info_second, and dev_info_third. Export these three tables, or only export the more important tables among the three tables. The above are just some examples, and are not limited to these.

[0144] 4. Divide the multiple first-category data tables in the first database into n parts on average, obtain one of the n parts, and save the remaining n-1 parts; and divide the multiple second-category data tables in the first database into m parts on average, obtain one of the m parts, and save the remaining m-1 parts; or,

[0145] Get one of the K split tables, where the K tables are of the same type, and K is a positive integer;

[0146] The data volume of the first type of data table is less than the second threshold, and the data volume of the second type of data table is greater than the second threshold; wherein m and n are positive integers, m is greater than n, and m plus n is less than N.

[0147] Exemplarily, m is greater than n, that is, the number of shares into which a table with a data volume less than the second threshold is divided is less than the number of shares into which a table with a data volume greater than the second threshold is divided. In this way, the amount of data in each share can be close, that is, the amount of data in the table allocated to each first server is close. The second threshold is less than the first threshold, and the second threshold can be set according to actual conditions, and m and n can also be set according to actual conditions; K can be m or n, that is, a second-category data table can be obtained from m second-category data tables, or a first-category data table can be obtained from n first-category data tables.

[0148] In a possible example, the export instruction of one of the N first servers includes an instruction to divide the multiple first-category data tables into n parts on average, and the export instructions of the n first servers including the first server include an instruction to obtain one of the n tables; that is, the first database divides the multiple first-category data tables into n parts on average, and each part is exported by one of the n first servers;

[0149] Similarly, the export instructions of one of the N first servers include an instruction to divide multiple second-category data tables into m parts on average, and the export instructions of the m first servers including the first server include an instruction to obtain one of the m tables; that is, after the first database divides the multiple second-category data tables into m parts on average, each part is exported by one of the m first servers.

[0150] For example, the export instruction sent by the first server 1 to the first database is used to instruct that the first category data table is divided into two equal parts, and the first server 1 exports one of the two first category data tables; the export instruction sent by the first server 2 to the first database is used to instruct to obtain one of the two first category data tables, and the first server 2 exports it; similarly, the export instruction sent by the first server 3 to the first database is used to instruct that the second category data table is divided into seven equal parts, and the first server 3 exports one of the seven second category data tables, and the export instructions sent by the first servers 4 to 9 to the first database are used to instruct to obtain each of the seven second category databases, and the first servers 4 to 9 export them respectively.

[0151] In another possible example, n first servers among N first servers simultaneously (i.e., at a set time) send an export instruction to the first database to instruct to obtain one of the first-category data tables, and the first database determines to divide the first-category data table into n parts on average according to the number n of the export instructions received within a preset time period, and each of the n parts is exported by the n first servers respectively;

[0152] Similarly, the export instructions sent by m of the N first servers to the first database at the same time (i.e., at a set time) are used to instruct the acquisition of one copy of the second category data table. The first database determines to divide the second category data table into m copies on average based on the number m of the export instructions received within a preset time period, and each of the m copies is exported by the m first servers respectively.

[0153] For example, if two of the N first servers send export instructions to the first database to instruct to obtain one of the first-category data tables, then n is 2. If there are 20 first-category data tables, each of the two copies includes 10 first-category data tables, and the two copies are exported by the corresponding two first servers respectively. If seven of the N first servers send export instructions to the first database to instruct to obtain one of the second-category data tables, then m is 7. If there are 28 second-category data tables, each of the seven copies includes 2 second-category data tables, and the seven copies are exported by the corresponding seven servers respectively.

[0154] It is understandable that even if N first servers send export instructions to the first database at the same time, there may be different transmission delays during the instruction transmission process. Therefore, the first database can count the export instructions received within a preset time period to avoid missing export instructions due to transmission delays.

[0155] In a possible example, N first servers are Figure 2Taking the 12 servers in the example, a table containing a preset field (such as a clob field) can be exported by one of the 12 servers, a table after horizontal splitting can be exported by one of the 12 servers, at least one table obtained after splitting the table that meets the preset conditions can be exported by one of the 12 servers, a first type of data table can be exported by two of the 12 servers, and a second type of data table can be exported by seven of the 12 servers; in this way, the amount of data exported from each server can be made as close as possible without too much difference.

[0156] Optionally, the second server can store the tables corresponding to each first server obtained from the first database in different folders respectively, for example, store the table containing the clob field in the gz_clob folder, store the horizontally split table in the gz_split folder, store the table split according to preset conditions in the gz_where folder, store n tables in gz_1-gz_n folders respectively, and store m tables in gz_n+1-gz_n+m folders respectively. This can avoid confusion caused by a large number of table types and a large number of tables, and can facilitate each first server to export the corresponding table.

[0157] The above are only possible examples and are not limited to them.

[0158] Optionally, before exporting the tables in the first database, the tables in the first database may be screened to select tables that meet the export conditions, and then exported according to various export instructions.

[0159] Exemplarily, each export instruction also includes an export condition. After the second server obtains at least one table corresponding to each first server according to each export instruction, it filters out a table that meets the export condition from at least one table according to the export instruction, and the corresponding first server exports the table that meets the export condition; or, after the second server filters out all tables that meet the export condition according to the export condition, it obtains a table corresponding to each first server from the tables that meet the export condition according to each export instruction.

[0160] Export conditions, for example: only obtain tables that have not been exported in the first database, and tables that have been exported in the data migration task before the current data migration task do not need to be exported; or obtain tables that have not been exported within a preset time period (for example, tables that have not been exported within a year), or do not obtain unimportant or infrequently used tables stored in the first database, and such tables do not need to be exported. In this way, the amount of data migration can be reduced and the efficiency of data migration can be improved.

[0161] The above are only some possible examples, and the export conditions can be determined according to the actual situation.

[0162] S103: The first server exports at least one table from the second server.

[0163] Exemplarily, each of the N first servers exports at least one table corresponding to each first server from the second server.

[0164] In a possible embodiment, after acquiring at least one table corresponding to the first server, the second server sends a prompt message to the first server, and after receiving the prompt message, the first server exports the at least one table.

[0165] S104: The first server divides the received at least one table into at least one transmission file.

[0166] The total amount of data in the table of each transferred file is less than the preset amount.

[0167] Exemplarily, if at least one table includes multiple tables, the multiple tables are divided into at least two transmission files, and the difference in data volume between the at least two transmission files is less than a preset difference. In this way, the data volume of each transmission file is similar, so that when at least one transmission file is subsequently imported in parallel, the import can be completed at the same time, saving the waiting time of the import process.

[0168] Specifically, a shell command for file transfer is generated based on at least one table, the shell command is split into at least one shell subcommand, and the table corresponding to each subcommand in the at least one shell subcommand is stored in a transfer file. In this way, when the number of at least one table is huge, it is convenient to group the at least one table, improve the speed of grouping the at least one table into the at least one transfer file, and further improve the efficiency of data migration.

[0169] Optionally, when generating a shell command for file transfer based on at least one table, the at least one table may be sorted from small to large or from large to small according to data size, and a shell command for file transfer may be generated according to the sorted list.

[0170] In this way, it is convenient to evenly group at least one table according to the data volume, so that the data volume in each transfer file is close, and the import is completed as simultaneously as possible, thereby saving waiting time and improving the efficiency of data migration.

[0171] The above is only a possible example, and the embodiment of the present application does not limit the specific grouping method.

[0172] S105: The first server initiates a transmission request to the third server, and the third server receives the transmission request.

[0173] The transmission request is used to instruct the first server to transmit at least one transmission file to the third server.

[0174] Exemplarily, after packaging at least one transmission file, the first server initiates a transmission request to the third server. After receiving the transmission request, the third server needs to wait for verification and instructions from a technician to avoid file transmission errors.

[0175] S106: The third server receives the transmission instruction.

[0176] The transmission instruction is used to instruct receiving at least one transmission file transmitted by the first server.

[0177] Exemplarily, a transmission instruction is received from a technician. Specifically, the data migration system may include a monitoring module, the monitoring module is used to monitor the data transmission status between the first server, the second server, the third server and the fourth server in real time, after detecting that the first server has completed the export of at least one table of the first database, the monitoring module sends an export completion message to the technician, or after the first server has completed the export of at least one table of the first database, the first server outputs an export completion message, the export completion message is used to indicate that the first server has completed the export of the table of the first database;

[0178] After receiving the export completion message or checking the export log to confirm that at least one table on the first server is correct, the technician inputs a transmission instruction to the third server.

[0179] In this way, it can be ensured that at least one table of the first database exported by the first server is correct, thereby improving the accuracy of data migration, avoiding more subsequent import errors, and improving the efficiency of data migration.

[0180] S107: The third server responds to the transmission request of the first server according to the transmission instruction, and the first server receives the response of the third server to the transmission request.

[0181] Optionally, the method steps S105 to S107 may also be that after the first server packages at least one transmission file, a technician verifies and confirms that at least one transmission file is correct, and after receiving the transmission instruction from the technician, the first server initiates a transmission request to the third server, and after receiving a response to the transmission request from the third server, the first server transmits the at least one transmission file to the third server.

[0182] S108: The first server transmits at least one transmission file to the third server in parallel, and the third server receives the at least one transmission file from the first server.

[0183] Exemplarily, the third server receives at least one transmission file from the first server using an import script.

[0184] For example, the transmission commands are executed in parallel in a multi-threaded manner to download at least one transmission file of each of the N first servers to the third server, so as to speed up the file transmission.

[0185] In a possible embodiment, the at least one transmission file not only includes at least one transmission file obtained by the first server in the current data export task, but may also include at least one transmission file obtained by the first server in the data export task before the current data export task.

[0186] It can be understood that since the third server needs to respond to the transmission request of the first server and obtain at least one transmission file after receiving the transmission instruction from the technician, the technician's transmission instruction can be issued after the first server has executed the data export task multiple times, that is, the first server sends multiple export instructions to the second server, and the first server exports at least one batch of tables from the second server and divides at least one table received in each batch into at least one transmission file. Only then does the first server receive the transmission instruction from the third server. At this time, the at least one transmission file transmitted to the third server includes the transmission files obtained when executing multiple data export tasks.

[0187] In a possible example, the first server packages and compresses each transmission file in at least one transmission file, and sends the obtained at least one compressed package in parallel to a third server. The third server receives the at least one compressed package and decompresses the at least one compressed package to obtain at least one transmission file.

[0188] Optionally, the first server may also agree on an encryption method with the third server. The first server encrypts at least one obtained compressed package and sends the at least one encrypted compressed package to the third server in parallel. The third server receives the at least one encrypted compressed package and decrypts and decompresses the at least one encrypted compressed package according to the agreed encryption method to obtain at least one transmission file.

[0189] S109: The third server uses a configuration script to convert data types of tables in at least one transmission file that do not conform to data types that can be stored in the second database.

[0190] Exemplarily, since the first database and the second database can store different types of data, before importing the table exported from the first database (i.e., the table in at least one transmission file) into the second database, it is necessary to convert the data type of the table in at least one transmission file that does not conform to the data type that can be stored in the second database.

[0191] In a possible embodiment, if a data migration task has been executed before the current data migration task and the data migration task is also to migrate the table in the first database to the second database, that is, the first server has sent the configuration script and the import script to the third server, and the third server has stored the configuration script and the import script, then the third server can call the locally stored configuration script and import script.

[0192] In another possible embodiment, the current data migration task is executed for the first time, or the configuration script and import script are not stored in the third server, then the first server sends the import script and configuration script to the third server, and the third server receives the import script and configuration script from the first server.

[0193] Optionally, if the first database and the second database can store the same type of data, or the data type of the table involved in the data migration is the same as the data type that can be stored in the second database, the first server may only send the import script to the third server.

[0194] S110. The third server imports at least one transmission file to the fourth server, and the fourth server receives the at least one transmission file.

[0195] S111. The fourth server imports at least one transmission file into the second database.

[0196] Specifically, the first database is an Oracle database and the second database is TDSQL. Before importing, the technician needs to use the export keyword in the data migration log to determine that at least one transfer file of the batch has been transferred and the transfer is correct, and it is necessary to ensure that the parameter "local_infile" (that is, the import switch of the database) of the second database is turned on. When importing, the import commands for tables containing clob or blob fields and tables without clob or blob fields are different; if half-character problems occur, the iconv command needs to be used for special processing, and the imported data is processed using the LOAD DATALOCAL INFILE method. The import command for the vertically split table (that is, the table split in accordance with the preset conditions) remains unchanged, and the table obtained by horizontal splitting will remain in the form of multiple tables after import.

[0197] In this solution, the first server sends an export instruction to the second server, and exports at least one table corresponding to the first server from the first database of the second server, which can improve the accuracy of data migration, and the export of the tables of the first database is performed in parallel by N first servers, which can shorten the export time and thus improve the efficiency of data migration; each first server then groups the at least one table according to the total amount of data to obtain at least one transfer file, and transfers the at least one transfer file to the third server by parallel import, which can shorten the import time and further improve the efficiency of data migration; the third server converts the table that does not meet the storable data type of the second database according to the configuration script, and imports at least one transfer file into the second database of the fourth server, which can improve the reliability of this application.

[0198] In a possible design, the embodiment of the present application further provides a verification method, including:

[0199] The first server sends at least one shell subcommand to the third server, and the third server receives at least one shell subcommand from the first server;

[0200] At least one shell subcommand is generated based on at least one table of the first server. The third server verifies whether the table in the shell subcommand is consistent with the table of the transmission file received from the first server. If they are inconsistent, a transmission abnormality alarm log is output, and a technician confirms whether there is an abnormality in the transmission.

[0201] Exemplarily, in order to save computing resources and time, it may be possible to verify whether the number of tables in the shell subcommand is consistent with the number of tables in the transmission file received by the third server from the first server.

[0202] In this way, before the third server imports the received transmission file into the second database, it first checks whether the received transmission file is complete, thereby avoiding subsequent import errors caused by incomplete transmission files being received.

[0203] In one possible design, the verification method also includes: the fourth server sends the total amount of data of the table imported into the second database to the third server, and the third server receives the total amount of data of the table imported into the second database from the fourth server; the third server verifies whether the total amount of data of the table received from at least one transmission file is consistent with the total amount of data of the table imported into the second database; if inconsistent, outputs an import abnormality alarm.

[0204] For example, if there is an inconsistency, the third server outputs an import abnormality alarm, and a technician confirms whether an abnormality occurs, so as to ensure that the table received by the third server is successfully imported.

[0205] Optionally, a pre-stored verification script may be used to verify whether the date field of the received table matches the date field of the table imported into the second database, so as to determine whether the import is successful.

[0206] Optionally, you can also check the import log of the second database to determine whether the import is successful.

[0207] In a possible design, before the fourth server imports the at least one received transmission file into the second database, it is also necessary to clear the data in the second database.

[0208] It can be understood that in order to facilitate the subsequent third server to verify whether the total amount of data in the table imported into the second database is consistent with the total amount of data in the received table, it is necessary for the fourth server to clear the data in the second database before executing the import, for example, using the truncate table command to clean up the data in the second database, or to drop the table in the second database and then rebuild it. The embodiment of the present application does not limit this.

[0209] The method provided by the embodiment of the present application is introduced above, and the device provided by the embodiment of the present application is introduced below.

[0210] Based on the same technical concept, an embodiment of the present application provides a data migration device, which includes a module / unit / means for executing the above method embodiment. The module / unit / means can be implemented by software, or by hardware, or the corresponding software can be implemented by hardware.

[0211] See also Figure 5 The device 500 may include a transceiver module 501 and a processing module 502, and the transceiver module 501 and the processing module 502 cooperate to execute part or all of the operations executed by the first server or the second server or the third server in the above embodiment.

[0212] Exemplarily, when the apparatus 500 is applied to the first server,

[0213] The transceiver module 501 is used to: send an export instruction to a second server, where the first database is deployed, and the export instruction is used to instruct the second server to obtain at least one table from the first database, where the table name of the at least one table corresponds to the table name specified by the first server; the export instruction includes a list of table names corresponding to the first server; and export at least one table from the second server;

[0214] The processing module 502 is used to: divide the at least one table into at least one transmission file, and the total amount of data in the table of each transmission file is less than a preset amount;

[0215] The transceiver module 501 is also used to: initiate a transmission request to a third server, receive a response to the transmission request from the third server, and transmit at least one transmission file to the third server in parallel; wherein the transmission request is used to indicate that at least one transmission file is transmitted to the third server.

[0216] Exemplarily, when the apparatus 500 is applied to a second server, and a first database is deployed on the second server,

[0217] The transceiver module 501 is used to: receive an export instruction from each of the N first servers, the export instruction is used to instruct the second server to obtain at least one table from the first database, the table name of the at least one table corresponds to the table name specified by the first server, and the export instruction includes a list of table names corresponding to the first servers; wherein the table name specified by each of the N first servers corresponds to the table name of a table in the first database, and N is a positive integer;

[0218] The processing module 502 is used to obtain at least one table corresponding to each first server according to the export instruction sent by each first server.

[0219] Exemplarily, when the apparatus 500 is applied to a third server,

[0220] The transceiver module 501 is used to: receive transmission requests from N first servers; receive transmission instructions, and respond to the transmission requests of the N first servers according to the transmission instructions; the transmission instructions are used to instruct to receive at least one transmission file transmitted by the first server, and the transmission request is used to instruct the first server to transmit at least one transmission file to the third server; use the import script to receive at least one transmission file from each of the N first servers; N is a positive integer;

[0221] The processing module 502 is used to: use the configuration script to convert the data type of the table in the at least one transmission file that does not conform to the data type that can be stored in the second database of the fourth server

[0222] The transceiver module 501 is further used to: import at least one transmission file into the second database.

[0223] Exemplarily, when the apparatus 500 is applied to a fourth server, and a second database is deployed on the fourth server,

[0224] The transceiver module 501 is used to: receive at least one transmission file from a third server;

[0225] The processing module 502 is used to: import the at least one transmission file into the second database.

[0226] It should be understood that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.

[0227] Based on the same technical concept, see Figure 6 The embodiment of the present application further provides an electronic device 600, including:

[0228] At least one processor 601; and a communication interface 603 that is communicatively connected to the at least one processor 601; the at least one processor 601 executes instructions stored in the memory 602, so that the electronic device 600 executes the method steps performed by the first server or the second server or the third server in the above method embodiment through the communication interface 603.

[0229] Optionally, the memory 602 is located outside the electronic device 600 .

[0230] Optionally, the electronic device 600 includes the memory 602, the memory 602 is connected to the at least one processor 601, and the memory 602 has instructions that can be executed by the at least one processor 601. Figure 6 The dashed lines indicate that the memory 602 is optional for the electronic device 600 .

[0231] The at least one processor 601 and the memory 602 may be coupled via an interface circuit or may be integrated together, which is not limited here.

[0232] The specific connection medium between the at least one processor 601, the memory 602 and the communication interface 603 is not limited in the embodiment of the present application. Figure 6 In the embodiment, at least one processor 601, a memory 602 and a communication interface 603 are connected via a bus 604. Figure 6 The connection between other components is only for schematic illustration and is not intended to be limiting. The bus part may be an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 It is represented by only one thick line, but it does not mean that there is only one bus or one type of bus.

[0233] It should be understood that the processor mentioned in the embodiments of the present application can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented by software, the processor can be a general-purpose processor implemented by reading software code stored in a memory.

[0234] Exemplarily, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0235] It should be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which acts as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DirectRambus RAM, DR RAM).

[0236] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, the memory (storage module) can be integrated into the processor.

[0237] It should be noted that the memory described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0238] Based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium, which is used to store instructions. When the instructions are executed, the computer executes the method steps executed by any device in the above method embodiments.

[0239] Based on the same technical concept, an embodiment of the present application also provides a computer program product, including computer program code. When the computer program code is executed on a computer, the method steps executed by any device in the above method embodiment are implemented.

[0240] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0241] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0242] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0243] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0244] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A data migration method, applied to a first server, characterized in that: include: Sending an export instruction to a second server, where a first database is deployed, the export instruction is used to instruct the second server to obtain at least one table from the first database, where a table name of the at least one table corresponds to a table name specified by the first server; the export instruction includes a list of table names corresponding to the first server; exporting the at least one table from the second server; dividing the at least one table into at least one transmission file, wherein the total amount of data in the table of each transmission file is less than a preset amount; Initiate a transmission request to a third server, receive a response to the transmission request from the third server, and transmit the at least one transmission file to the third server in parallel; wherein the transmission request is used to indicate that the at least one transmission file is to be transmitted to the third server.

2. The method according to claim 1, characterized in that The first server sends an export instruction to the second server, including: The export instruction is sent to the second server at a set time.

3. The method according to claim 1, characterized in that The export instruction is further used to indicate at least one of the following: Obtaining a table containing preset fields from the first database; Performing horizontal splitting on a table in the first database whose data volume is greater than a first threshold, and obtaining the table after the horizontal splitting; the horizontal splitting refers to splitting the table whose data volume is greater than the first threshold into multiple tables with the same structure, and the first threshold is the maximum data volume of a single table allowed by the second database; Splitting the tables in the first database that meet the preset conditions, and obtaining at least one split table; Divide multiple first-category data tables in the first database into n parts on average, obtain one of the n parts, save the remaining n-1 parts, and the amount of data in the first-category data tables is less than a second threshold; and divide multiple second-category data tables in the first database into m parts on average, obtain one of the m parts, save the remaining m-1 parts, and the amount of data in the second-category data tables is greater than the second threshold; wherein m and n are positive integers, and m is greater than n; or, Get a table from the K split tables, where the K tables are of the same type, and K is a positive integer.

4. The method according to claim 1, characterized in that The at least one table includes a plurality of tables, and the dividing the at least one table into at least one transmission file includes: The multiple tables are divided into at least two transmission files, and the difference in data amount between any two transmission files in the at least two transmission files is less than a preset difference value.

5. The method according to claim 1, characterized in that The dividing the at least one table into at least one transmission file comprises: Generate a shell command for file transfer based on the at least one table; Splitting the shell command into at least one shell subcommand; The table corresponding to each subcommand in the at least one subcommand is stored in a transmission file.

6. The method according to claim 5, characterized in that The step of generating a shell command for file transfer based on the at least one table comprises: The identifiers of the at least one table are sorted from large to small or from small to large according to the data amount of the table, and a shell command is generated according to the sorted list.

7. The method according to claim 1, characterized in that After exporting at least one table from the second server, the method further comprises: An export completion message is output, where the export completion message is used to indicate that the first server has completed exporting the table of the first database.

8. The method according to claim 1, characterized in that The method further comprises: An import script is sent to the third server, wherein the import script is used to receive at least one transmission file from the first server.

9. The method according to claim 8, characterized in that The first database and the second database can store different types of data; the method further includes: A configuration script is sent to the third server; wherein the configuration script is used to convert the data type of the table in the transmission file transmitted to the third server into the data type that can be stored in the second database.

10. The method according to claim 6, characterized in that The method further comprises: The at least one shell subcommand is sent in parallel to the third server, so that the third server verifies whether the table of the at least one transmission file received is consistent with the table in the shell subcommand.

11. A data migration method, applied to a second server, wherein a first database is deployed on the second server, characterized in that: include: receiving an export instruction from each of the N first servers, the export instruction being used to instruct the second server to obtain at least one table from the first database, the table name of the at least one table corresponding to the table name specified by the first server, the export instruction comprising a list of table names corresponding to the first server; wherein the table name specified by each of the N first servers corresponds to the table name of a table in the first database, and N is a positive integer; According to the export instruction sent by each first server, at least one table corresponding to each first server is obtained.

12. The method according to claim 11, characterized in that The step of acquiring at least one table corresponding to each first server according to the export instruction sent by each first server further includes at least one of the following: Obtaining a table containing preset fields from the first database; Performing horizontal splitting on a table in the first database whose data volume is greater than a first threshold, and obtaining the table after the horizontal splitting; the horizontal splitting refers to splitting the table whose data volume is greater than the first threshold into multiple tables with the same structure, and the first threshold is the maximum data volume of a single table allowed by the second database; Splitting the tables in the first database that meet the preset conditions, and obtaining at least one split table; Divide multiple first-category data tables in the first database into n parts on average, obtain one table from the n parts, save the remaining n-1 parts, and the amount of data in the first-category data tables is less than a second threshold; and divide multiple second-category data tables in the first database into m parts on average, obtain one table from the m parts, save the remaining m-1 parts, and the amount of data in the second-category data tables is greater than the second threshold; wherein m and n are positive integers, and m is greater than n, and m plus n is less than N; or, Get a table from the K split tables, where the K tables are of the same type, and K is a positive integer.

13. A data migration method, applied to a third server, characterized in that: include: receiving a transmission request from the first server, wherein the transmission request is used to instruct the first server to transmit the at least one transmission file to the third server; receiving a transmission instruction, and responding to the transmission request of the first server according to the transmission instruction; the transmission instruction is used to instruct receiving at least one transmission file transmitted by the first server; Using an import script, receiving at least one transmission file from each of N first servers; N is a positive integer; Using a configuration script, converting the data type of a table in the at least one transmission file that does not conform to the data type that can be stored in the second database of the fourth server; The at least one transmission file is imported into the second database.

14. The method according to claim 13, characterized in that The method further comprises: Receive a configuration script and / or an import script from each of the N first servers, wherein the configuration script is used to convert the data type of the table in the transmission file transmitted to the third server into a data type that can be stored in the second database; and the import script is used to receive at least one transmission file from the first server.

15. The method according to claim 13, characterized in that The method further comprises: Receiving at least one shell subcommand from each first server of the N servers, wherein the at least one shell subcommand is generated by at least one table of each first server; Check whether a table in at least one shell subcommand of each first server is consistent with a table in a transmission file received from each first server, and if they are inconsistent, output a transmission abnormality alarm.

16. The method according to any one of claims 13 to 15, characterized in that: The method further comprises: receiving a total amount of data imported into the table in the second database from the fourth server; Verifying whether the total amount of data in the table of at least one received transmission file is consistent with the total amount of data in the table imported into the second database; If they are inconsistent, an import exception alarm will be output.

17. A data migration method, applied to a fourth server, wherein a second database is deployed on the fourth server, characterized in that: include: At least one transmission file is received from a third server, and the at least one transmission file is imported into the second database.

18. The method according to claim 17, characterized in that Before importing the at least one transmission file into the second database, the method further comprises: Clear the data in the second database.

19. The method according to claim 17, characterized in that The method further comprises: The total amount of data imported into the table in the second database is sent to the third server, so that the third server verifies whether the total amount of data in the table of at least one received transmission file is consistent with the total amount of data in the table imported into the second database.

20. A data migration system, characterized in that: include: N first servers, each of the N first servers being configured to execute the method according to any one of claims 1 to 10; A second server, configured to execute the method according to any one of claims 11 to 12; A third server, configured to execute the method according to any one of claims 13 to 16; A fourth server, used to execute the method as described in any one of claims 17-19.

21. A data migration device, applied to a first server, characterized in that: include: a transceiver module, configured to: send an export instruction to a second server, wherein a first database is deployed on the second server, wherein the export instruction is used to instruct the second server to obtain at least one table from the first database, wherein the table name of the at least one table corresponds to the table name specified by the first server; and the export instruction includes a list of table names corresponding to the first server; exporting the at least one table from the second server; A processing module, configured to: divide the at least one table into at least one transmission file, wherein the total amount of data in the table of each transmission file is less than a preset amount; The transceiver module is also used to: initiate a transmission request to a third server, receive a response to the transmission request from the third server, and transmit the at least one transmission file to the third server in parallel; wherein the transmission request is used to indicate that the at least one transmission file is to be transmitted to the third server.

22. A data migration device, applied to a second server, wherein a first database is deployed on the second server, characterized in that: include: a transceiver module, configured to: receive an export instruction from each of the N first servers, wherein the export instruction is used to instruct the second server to obtain at least one table from the first database, wherein the table name of the at least one table corresponds to the table name specified by the first server, and the export instruction includes a list of table names corresponding to the first server; The table name specified by each of the N first servers corresponds to the table name of a table in the first database; N is a positive integer; The processing module is used to: obtain at least one table corresponding to each first server from the first database according to the export instruction sent by each first server.

23. A data migration device, applied to a third server, characterized in that: include: The transceiver module is used to: receive transmission requests from N first servers, wherein the transmission requests are used to instruct the first servers to transmit the at least one transmission file to the third server; Receive a transmission instruction, and respond to the transmission requests of the N first servers according to the transmission instruction; the transmission instruction is used to instruct to receive at least one transmission file transmitted by the first server; use the import script to receive at least one transmission file from each of the N first servers; N is a positive integer; A processing module, configured to: use a configuration script to convert data types of tables in the at least one transmission file that do not conform to data types that can be stored in the second database of the fourth server; The transceiver module is also used to: import the at least one transmission file into the second database.

24. A data migration device, applied to a fourth server, wherein a second database is deployed on the fourth server, characterized in that: include: A transceiver module, used to: receive at least one transmission file from the third server; A processing module is used to: import the at least one transmission file into the second database.

25. An electronic device, characterized in that: The electronic device comprises at least one processor, and the at least one processor is used to implement the method according to any one of claims 1 to 10, the method according to any one of claims 11 to 12, the method according to any one of claims 13 to 16, or the method according to any one of claims 17 to 19 when executing a computer program stored in a memory.

26. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store instructions, and when the instructions are executed, the method according to any one of claims 1 to 10, the method according to any one of claims 11 to 12, the method according to any one of claims 13 to 16, or the method according to any one of claims 17 to 19 is implemented.

27. A computer program product, characterized in that The computer program product comprises: a computer program code, which, when executed on a computer, enables the computer to execute the method as claimed in any one of claims 1 to 10, the method as claimed in any one of claims 11 to 12, the method as claimed in any one of claims 13 to 16, or the method as claimed in any one of claims 17 to 19.