Heterogeneous database migration method and device and electronic equipment

By generating data portraits and automatically parsing and comparing information, migration scripts are automatically generated to realize automated migration of heterogeneous databases, solving the problems of migration complexity and low efficiency in existing technologies, improving migration efficiency and success rate, and reducing costs. .

CN118796794APending Publication Date: 2024-10-18CHINA MOBILE GROUP ZHEJIANG +1
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202410084851.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-19
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

In the existing technology, the migration process of heterogeneous databases is complex and cumbersome, and information errors are prone to occur, resulting in low migration efficiency, high cost, and difficulty in automation, hindering the update and iteration of business applications.

Method used

By generating data portraits, comparing the field types of the source database and the target database, automatically parsing and generating data column mapping patterns and migration evaluation indicators, determining data conversion rules, automatically generating and executing migration scripts, and realizing automated migration of heterogeneous databases.

Benefits of technology

It improves the efficiency and success rate of heterogeneous database migration, reduces manual intervention and costs, supports the update and iteration of business applications, and is suitable for different types of database environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118796794A_ABST
    Figure CN118796794A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a heterogeneous database migration method and device and electronic equipment, belongs to the technical field of data processing, and can realize automatic migration of a heterogeneous database. The method comprises the steps that a data portrait is generated based on the type of a source database and the type of a target database, and the data portrait carries comparison information of a field type used in the source database and a field type supported by the target database and migration evaluation information; based on the data portrait, analyzing a source table in a source database to output a data column mapping mode of a target field corresponding to each source field in a target table corresponding to the source table and output a migration evaluation index corresponding to each source field; determining a data conversion rule for extracting data from a data column of each source field of the source table to a corresponding target field based on a preset conversion strategy and the migration evaluation index and the data column mapping mode corresponding to each source field; and generating and executing a migration script of the source table based on a data conversion rule.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This document relates to the field of data processing technology, and in particular to a heterogeneous database migration method, device and electronic device. Background Art

[0002] The business applications of enterprises and institutions need to be constantly updated and iterated to achieve richer functions and better performance, reduce operating costs, and match high-performance advanced hardware. As the data storage framework, storage scale, performance requirements, and application needs of business applications change, the database supporting business applications will need to be migrated to improve the data processing efficiency of business applications, reduce maintenance costs, and achieve scalability.

[0003] Database migration can be the process of transferring data from a source database to a target database. Currently, operations and maintenance personnel usually use migration tools to export data from a source database used by business applications, and import the data exported from the source database into the target database in an attempt to migrate between databases of the same type. However, in the source database, there are usually a variety of field types used by business applications to record information, and the target database, which is different from the source database type, is difficult to fully support the field types of the source database. Operation and maintenance personnel will need to manually observe and analyze, compare one by one, and write code. The migration work is very complex and cumbersome, and it is easy to have information errors and migration failures. The update and iteration of business applications will also be hindered. Summary of the invention

[0004] The purpose of the embodiments of this specification is to provide a heterogeneous database migration method, device and electronic device to avoid the low migration efficiency caused by manual heterogeneous database migration, thereby realizing automated migration of heterogeneous databases, improving migration efficiency, success rate and cost, and providing support for promoting the update and iteration of business applications.

[0005] In order to achieve the above purpose, the embodiments of this specification adopt the following scheme:

[0006] In a first aspect, a heterogeneous database migration method is provided, comprising:

[0007] Generate a data profile based on the type of the source database and the type of the target database, the data profile carrying comparison information between the field types used in the source database and the field types supported by the target database and migration assessment information;

[0008] Based on the data portrait, a source table in the source database is parsed to output a data column mapping mode of a target field corresponding to each source field in a target table corresponding to the source table and a migration assessment index corresponding to each source field, wherein each data column mapping mode is indicated by the comparison information, the target field is used to mark a migration target position of a data column of the corresponding source field, and the migration assessment index is determined based on the migration assessment information and a matching degree between the data column of each source field and the corresponding data column mapping mode;

[0009] Determine data conversion rules for extracting data from the data columns of each source field of the source table to the corresponding target field based on a preset conversion strategy and migration evaluation indicators and data column mapping modes corresponding to each source field;

[0010] Based on the data conversion rules, a migration script of the source table is generated and executed.

[0011] In a second aspect, a heterogeneous database migration device is provided, comprising:

[0012] A portrait generation module, used to generate a data portrait based on the type of the source database and the type of the target database, wherein the data portrait carries comparison information between the field types used in the source database and the field types supported by the target database and migration evaluation information;

[0013] A portrait parsing module, for parsing a source table in the source database based on the data portrait, so as to output a data column mapping mode of a target field corresponding to each source field in a target table corresponding to the source table and a migration assessment index corresponding to each source field, wherein each data column mapping mode is indicated by the comparison information, the target field is used to mark a migration target position of a data column of the corresponding source field, and the migration assessment index is determined based on the migration assessment information and a matching degree between the data column of each source field and the corresponding data column mapping mode;

[0014] A rule determination module, for determining a data conversion rule for extracting data from a data column of each source field of the source table to a corresponding target field based on a preset conversion strategy and a migration evaluation index and a data column mapping mode corresponding to each source field;

[0015] The migration execution module is used to generate and execute the migration script of the source table based on the data conversion rule.

[0016] According to a third aspect, an electronic device is provided, the electronic device comprising:

[0017] at least one processor;

[0018] a memory connected to the at least one processor;

[0019] The memory stores instructions that can be executed by the at least one processor, and the at least one processor implements the aforementioned method by executing the instructions stored in the memory.

[0020] According to a fourth aspect, a machine-readable storage medium is provided, which stores machine instructions. When the machine instructions are executed on a machine, the machine executes the aforementioned method.

[0021] In the scheme of the embodiment of this specification, the types of source database and target database can determine the multiple field types of the source end and the multiple field types of the target end. The difference in field definition and data characteristics between the source end and the target end and the degree of difficulty in migration can be expressed through data portrait (a portrait that shows the difference in fields and data characteristics of the databases at both ends of the source end and the target end, not a portrait of the database at one end), wherein the difference can be described by the comparison information carried and the degree of difficulty in migration can be described by the migration assessment information carried, thereby automatically forming a measure of data matching between field types, providing a basis for field type selection for the migration of each source field in the source database, without limiting the type of target database. Instead of selecting the type of target database that matches the type of source database, the types of target databases required for the update and iteration of business applications are extensive. Only selecting the type of target database that matches the requirements will limit the migration target database and make it difficult to support the update and iteration of business applications.

[0022] In the scheme of the embodiment of this specification, according to the indication of the comparison information parsed from the data portrait, the data column mapping mode of the source field can be automatically obtained according to the field types matched between the fields of the source database and the target database. The data column mapping mode can specify the method of extracting data. The matching degree between the data column (actual data) of the source field and the data column mapping mode can describe the data loss situation. The matching degree and the migration evaluation information can jointly express the data matching situation between the currently selected field types, so as to evaluate the data matching situation of the field types at both ends of the migration while outputting the data column mapping mode (under the currently selected field type) using the data portrait, and provide the basis of mapping information and evaluation information for the automatic generation of rules and script codes. Instead of using the data portrait to select the target database.

[0023] In the scheme of the embodiment of this specification, the preset conversion strategy can provide a conversion rule that meets the migration requirements, and can automatically determine whether it meets the migration requirements through the data matching (or loss) of the migration evaluation index, so as to decide whether to load the data conversion rules through the output data column mapping mode, and provide instantiated data migration operations between databases through data conversion rules to form the current configuration information of the migration script (including operation instructions), and provide the basis for the current configuration information that meets the migration requirements for the automatic generation and execution of the script. Finally, through the data conversion rules, the script is automatically generated and executed, and the automatic migration of heterogeneous databases is realized without limiting the selection range of the target database, and there is no need for manual intervention in the operation and processing, and there is no need to consider the compatibility between databases, which effectively guarantees the reliability and migration efficiency of data migration between heterogeneous databases, reduces the complexity and cost of data migration, can be applied to the environment of foreign and domestic databases, and brings convenience and guarantee to the transformation of domestic databases.

[0024] Other features and advantages of the embodiments of this specification will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:

[0026] Figure 1 A schematic diagram of an exemplary process of manually migrating a database according to an embodiment of this specification;

[0027] Figure 2 A schematic diagram of the steps of a main method for migrating a heterogeneous database according to an exemplary embodiment of this specification;

[0028] Figure 3 A schematic diagram of an exemplary automatic processing architecture for heterogeneous database migration according to an embodiment of this specification;

[0029] Figure 4 A schematic diagram of an exemplary automatic data profile generation process according to an embodiment of this specification;

[0030] Figure 5 This is a schematic diagram of an exemplary automatic protocol parsing process of an embodiment of this specification;

[0031] Figure 6 This is a schematic diagram of an exemplary automatic rule conversion process of an embodiment of this specification;

[0032] Figure 7 This is a schematic diagram of an exemplary automatic script configuration process of an embodiment of this specification;

[0033] Figure 8 A schematic diagram of an exemplary automatic parallel execution process of an embodiment of this specification;

[0034] Fig. 9 This is a schematic diagram of an exemplary device module of an embodiment of this specification;

[0035] Fig.10 This is a schematic diagram of an exemplary device module of an embodiment of this specification;

[0036] Fig.11 This is a schematic diagram of an exemplary electronic device module of an embodiment of this specification. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical solutions and advantages of this specification clearer, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.

[0038] As mentioned above, in the process of artificial migration, Figure 1 , operation and maintenance personnel can observe and analyze the characteristics of multiple fields in the source table in the source database (source end), and can try to write conversion code for each field (field 1 to n, n is a positive integer) combined with the characteristics of multiple fields in the target table in the target database (target end). However, the mapping and data conversion between the source and target fields depend on the experience of the operation and maintenance personnel. Without limiting the scope of the target database (for example, including domestic databases and foreign open source databases, etc.), it is difficult to cover the characteristics of each database, and multiple fields on the source and target sides are prone to errors during manual comparison. Migration between different types of databases is too complicated and prone to failure. At the same time, when the next migration or different database projects need to be migrated, the conversion code needs to be rewritten. Therefore, migration between different types of databases is very difficult, and the migration cost is too high and the efficiency is too low. Among them, different types of database migration can be called heterogeneous database migration.

[0039] In some possible examples, a migration solution based on database compatibility can be tried. In this migration solution, a profile of the source database is portrayed, and the compatibility of the source database and the target database is determined. Compatibility can be used to indicate whether statements that can be executed normally in the source database can be executed normally in the target database, and to exclude incompatible statements; migration is performed based on object selection operations and compatibility. However, first, the requirements for the target database are too high. The target database needs to support most of the statements of the source database before partial data migration can be performed, and the scope of the target database is limited by profiles and compatibility. Second, the use of object selection operations intervenes in external operations, so it is difficult to migrate automatically without intervention. Third, incompatible statements still require operation and maintenance personnel to compare them one by one, and it is also difficult to migrate automatically without intervention.

[0040] In view of this, the solution of this specification provides a heterogeneous database migration solution, which can migrate between any two different databases, and at the same time, does not require external intervention and intervention, thereby providing support for the update and iteration of business applications. It should be understood that the method provided in this specification can be executed by a device with computing and instruction processing capabilities and communication capabilities, such as a server or electronic device.

[0041] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.

[0042] An embodiment of the present specification provides a heterogeneous database migration method, which can be applied to a migration server. The migration server can have read and write permissions for the source database and the target database, and can perform database read and write operations on the source database and the target database. The migration server can be deployed with a program, and when the program is executed by the migration server, the aforementioned heterogeneous database migration method can be implemented. Among them, the source database and the target database can be any type of database, and the type of the source database is different from that of the target database. The migration server can be one or more servers, which can be a physical server or server instance or container instance with communication capabilities. The hardware of the instance can be a resource instance in a server cluster composed of processor resources and memory resources and having computing and instruction processing functions, such as a cloud server.

[0043] In the embodiments of this specification, automatic data profile generation can be performed. The fields and data features in the source database and the target database can be analyzed to generate data profiles. Figure 2 and Figure 3 The aforementioned heterogeneous database migration method may include:

[0044] S1, based on the type of the source database and the type of the target database, generate a data profile, wherein the data profile carries comparison information between the field types used in the source database and the field types supported by the target database and migration evaluation information.

[0045] In some possible implementations, the optional types of the source database and the target database may include commercial databases, open source databases, and domestic databases. Commercial databases may include databases such as Oracle DB and SQL Server, open source databases may include databases such as MySQL and PostgreSQL, and domestic databases may include databases such as DAMO, GaussDB, PolarDB, OceanBase, and TiDB. The type of the source database may be one of the aforementioned optional types, and the type of the target database may be a different one of the aforementioned optional types.

[0046] The aforementioned data portrait can be a data set of record comparison differences, which is used to provide automatically parseable correspondence (such as the correspondence between the two end tables and fields) and data analysis results (such as complexity tables), rather than selecting a target database. The form of the data set can be specified as needed, for example, it can include structured files, table files, parseable graphs (such as distribution graphs) carrying information on record comparison differences, or parseable graphs mapped to the information (such as a table of numbers represented as a matrix, which can be mapped as a graph), etc.

[0047] The data corresponding to the fields used for recording data in the source database may be the data to be migrated. For example, the source database may be an Oracle database, and the data to be migrated includes user data. The fields corresponding to the user data may include an identity field, an address text field, etc. The field type of the identity field may be a CHAR type, and the field type of the address text field may be a VARCHAR2. The field type supported by the target database may be the field type corresponding to the field definition in the target database. For example, the target database may be a MySQL database, which supports field types such as the CHAR type and the VARCHAR type.

[0048] In some possible examples, before generating the data profile, comparison information may be obtained to provide a basis for migration evaluation. The aforementioned heterogeneous database migration method may include:

[0049] P1, obtain the field types used in the source database and the field types supported by the target database.

[0050] The type of database can be determined based on the field set corresponding to the data recorded in the source database, and the field types covered by the field set can be determined in the field types supported by the source database to reduce the analysis and processing of field types that do not need to participate in the migration process. The data characteristics (parameter definition items) of the field type can be obtained from the development documents, manuals, field type description tables, etc. of the source database and the target database. In addition, the field types supported by the source database can also be used to provide support when other source databases of the same type as the source database need to be migrated. The aforementioned heterogeneous database migration method may include:

[0051] P2, according to the configured field index parameters, compare the field type used in the source database with the field type supported by the target database to obtain comparison information.

[0052] A correspondence can be established between the names of the field types used in the source database and the names of the field types supported by the target database. For example, the names of the field types used in the source database correspond to the names of the field types supported by the target database one by one; and the parameter definition items of the data of each field type constitute (standardized) data features, and a numerical representation of the difference is obtained through one or more target matching algorithms such as string matching, semantic analysis, and numerical analysis. For example, the difference is expressed by the inclusion of the parameter definition items of the field type and the matching degree of the parameter definition items of the field type, forming comparison information with the name pairs of the field type as the index and the field type matching degree and inclusion degree as the difference. The process of obtaining the comparison information can be called field type analysis insight.

[0053] Among them, the parameter definition items may include data format, data length, data interval range, null value (null symbol or specified value / symbol), default value, integrity condition, consistency condition, etc. The field type inclusion degree may indicate the coverage degree of the range of parameter definition items between the source end and the target end. For example, if the data interval range of the field type in the source database belongs to the data interval range of the field type in the target database, then the inclusion degree is the highest at this time; if the data interval range of the field type in the source database and the data interval range of the field type in the target database have an intersection, then the field type inclusion degree is medium at this time; if there is no intersection, then the inclusion degree is the lowest; the inclusion degree may also be represented by a score. The field type matching degree may indicate the matching degree of the parameter definition items between the source end and the target end. For example, if the parameter definition item set of the field type in the source database, such as data format, data length, null value (null symbol or specified value / symbol), default value, etc., is completely the same as the corresponding parameter definition item set of the field type in the target database (each item is consistent), partially the same (there are different parameter definition items), completely different (all items are inconsistent), etc., then a high, medium, or low field type matching degree may be obtained; the field type matching degree may also be represented by a score. In addition to the above-mentioned method of obtaining comparison information, the aforementioned parameter definition items can also be used to form data features, and the matching degree or inclusion degree can be used as a label to use a deep learning algorithm to obtain the matching degree or inclusion degree of each name pair.

[0054] For some possible examples, please combine Figure 4 , the (actual) data features in the source database and the target database may be analyzed to obtain migration assessment information. The aforementioned step S1 may include:

[0055] S101, based on the comparison information, performing data feature comparison analysis on the data in the source database and the sample data in the target database to determine migration assessment information.

[0056] The characteristics of the actual data in the database can jointly represent the behavior of the actual business. For example, the behavior of different businesses such as user subscription, service billing, and platform operation can be represented by data characteristics. The target database can be the database to be used by the business application after this update iteration, and the target database can have sample data. The data of the behavior of a business can be recorded by one or more tables, and the sample data can be distributed in one or more tables in different data layers in the target database. For example, the data layer may include the underlying operation data layer, the transaction detail data layer, the application data layer, etc. The data analysis model / tool ​​interface can be used to aggregate, mine, and feature identify the data in each table in the source database to obtain the data characteristics of each table in the source database. Through the data characteristics of the sample data of each table in the target database, the data characteristics in the source database are compared and analyzed, the data layer of each table in the source database is determined, and the data of each layer is cleaned (for example, damaged and incomplete data are removed), and data precipitation is completed (corresponding relationships are extracted), so that the migration evaluation information can be determined. The migration evaluation information may include the corresponding relationship between the business behavior of the source table in the source database and the target table in the target database, and the corresponding relationship between the source field in the source table and the target field in the target table.

[0057] On the basis of the comparison information, the determined migration assessment information may also include the field type of each source field and each optional field type of each corresponding target field (at this time, the unique matching field type is not specified, and it may be a set of field types), as well as the (migration) complexity table corresponding to the field type of each source field and each optional field type of each corresponding target field, wherein the higher the field type matching and inclusion of the corresponding field types at both ends, the lower the complexity, and the complexity can be determined by testing, fitting formulas, and field type matching and inclusion. The complexity can also be determined by a deep learning algorithm model, which can be obtained by training with the comparison information of the two databases as samples and the set complexity as labels. Therefore, relative to the analysis behavior, the migration correspondence between the tables and fields between the two databases can be automatically established, and the degree of migration difficulty can be determined. This process can be called data comparison.

[0058] After the migration assessment information is determined, a data profile may be determined using a profile characterization model. The aforementioned step S1 may further include:

[0059] S102, inputting the migration assessment information into a portrait characterization model to generate a data portrait between the source database and the target database.

[0060] Among them, the portrait characterization model can be a machine learning algorithm model, the portrait characterization model can be trained based on the sample composed of the set migration evaluation information and the corresponding data portrait label, and the output of the portrait characterization model can be one or more probabilities, each probability can represent the correspondence between the table and the field and the field type matching relationship between the source field and the target field in the target correspondence (the correspondence between each source field in a source table and each target field in a target table), that is, a data portrait, the greater the probability, the higher the possibility of successful migration under the combination, and the data portrait can carry the migration evaluation information and the comparison information corresponding to the migration evaluation information. In addition, the portrait characterization model can also be a decision model, for example, the complexity of the multiple combinations of the correspondence between the table and the field and the matching relationship of each field type are sorted respectively, and it is determined whether the complexity mean in the target combination is lower than the complexity threshold, so as to determine whether the target combination is the optimal data portrait, so as to provide the basis for a parsable data set. It can be understood that the correspondence between the source table and the target table and the correspondence between the source field and the target field can be set in the comparison information, and can also be set in the migration evaluation information, which can be selected according to product needs, testing and use effects. The data profile can be preferably a structured (key-value) file or a table file, etc., to help improve the parsing efficiency.

[0061] In the examples of this manual, please refer to Figure 5 , automatic protocol parsing can be performed. The generated data profile can be used for parsing to analyze the solution information of the automatic migration data matching the source table. The aforementioned heterogeneous database migration method can also include:

[0062] S2, based on the data portrait, parse the source table in the source database to output the data column mapping mode of the target field corresponding to each source field in the target table corresponding to the source table and output the migration evaluation index corresponding to each source field, each data column mapping mode is indicated by the comparison information, the target field is used to mark the migration target position of the data column of the corresponding source field, and the migration evaluation index is determined based on the migration evaluation information and the matching (completeness) degree between the data column of each source field and the corresponding data column mapping mode.

[0063] In some possible implementations, the data profile can provide the correspondence between the source table and the target table and the correspondence between each source field in the source table and each target field in the target table through the comparison information and / or migration assessment information carried. Based on the parsed correspondence, the field type of each source field in the source table can be parsed by using a method (procedure) / function to find a specified field or a method (procedure) / function to match characters. In some possible examples, step S2 may include:

[0064] S201, based on the comparison information parsed in the data portrait, select, from the field types supported by the target database, the field type of the first source field in the source table and the field type of the first target field in the target table corresponding to the field type.

[0065] The field type of the target field corresponding to each source field can be determined one by one according to the inclusion / matching degree of the field type in the comparison information. At this time, the migration plan information of the field type to be verified is obtained, wherein the field type of a source field can correspond one-to-one with the field type of the corresponding target field. The first source field can be any source field, and the terms such as first and second are only used to provide distinguishing information without limiting the order, classification, etc.

[0066] In the current correspondence of field types, it can be determined whether the parameter definition items of the field type of the source field and the field type of the target field match, and based on the matching, a data column mapping mode is selected, and one or more parameter definition items can be selected for matching verification. In a preferred example, this parameter definition item can be preferably a data length, and step S2 can also include:

[0067] S202a: If the data length defined by the field type of the first source field matches the data length defined by the field type of the first target field, determine that the data column mapping mode of the first source field is a direct mapping mode.

[0068] The data column mapping mode can be a mapping mode for extracting the data column (field value set) of the source field to the location of the target field, which can include a mapping method / function, and can include a lossless mapping mode and a lossy mapping mode. In the lossless mapping mode, the target field values ​​in the data columns corresponding to the fields at both ends after migration can be completely consistent, and in the lossy mapping mode, the target field values ​​in the data columns corresponding to the fields at both ends after migration can have partial differences. The lossless mapping mode can be a direct mapping mode, and the lossy mapping mode can be a selective mapping mode.

[0069] For example, the data length (maximum value) defined by the field type of the first source field may be less than or equal to the data length (maximum value) defined by the field type of the first target field. The source database is an Oracle database, the target database is a MySQL database, the first source field takes the VARCHAR2 field type, and the second target field takes VARCHAR. At this time, the data length (maximum value) defined by the VARCHAR2 field type of the first source field may be less than the data length (maximum value) defined by the VARCHAR field type of the second target field. The data column mapping mode of the first source field may be a direct mapping mode, and the field name of the first source field itself may be output, indicating a direct mapping mode, and the data migrated to the first target field is automatically marked as unchanged. Further, the aforementioned step S2 may also include:

[0070] S203a, determining a first matching degree between the data column of the first source field and the direct mapping mode, and outputting a migration evaluation index based on the migration evaluation information and the first matching degree.

[0071] For example, the first source field can still be VARCHAR2 field type, and the second target field can be VARCHAR. The actual data in the data column of the first source field and the direct mapping mode can be analyzed, and the integrity of each field value in the data column of the first source field after migration can be reflected by the first matching degree. At this time, the first matching degree can be 100%. Through the first matching degree and the complexity in the migration evaluation information, the migration evaluation index can be output. The migration evaluation index can be the loss value or success rate of the source field. The complexity can be used as a weighting coefficient w1. The loss degree x1=1-first matching degree is taken to weight x1, and the loss value w1x1 of the first source field can be obtained. As shown in Table 1, the first matching degree is represented by integrity.

[0072] Table 1 Output table of migrating VARCHAR2 field type to VARCHAR field type

[0073] Mapping Mode Output Source Field Complexity 0 Completeness (first match) 100% Loss value 0

[0074] When the output mark only contains the field name of the source field, the current mapping mode represents the direct mapping mode, and the success rate is 100%. Based on the aforementioned step S201, the aforementioned step S2 may also include:

[0075] S202b: If the field length defined by the field type of the first source field does not conform to the field length defined by the field type of the first target field, and the data column of the first source field allows interception operation or correction operation, then determine that the data column mapping mode of the first source field is a selective mapping mode.

[0076] For example, the data length (maximum value) defined by the field type of the first source field can be greater than the data length (maximum value) defined by the field type of the first target field. The source database is a MySQL database, the target database is an Oracle database, the first source field takes the VARCHAR field type, and the second target field takes the VARCHAR2 field type. At this time, the data length (maximum value) defined by the VARCHAR field type of the first source field can be greater than the data length (maximum value) defined by the VARCHAR field type of the second target field.

[0077] In a preferred example, it is possible to determine whether the actual field value in the data column of the first source field is greater than the data length defined by the field type of the first target field, thereby determining whether a direct mapping mode can be used to improve the data integrity after migration, wherein, if the actual field values ​​are not greater than the data length defined by the field type of the first target field, the output table is consistent with the aforementioned Table 1 (or the complexity in Table 1 is adjusted to 1).

[0078] Further, if the data column of the first source field allows the interception operation, the data column mapping mode of the first source field may be a selective mapping mode.

[0079] S203b: Determine a second matching degree between the data column of the first source field and the selective mapping mode, and output a migration evaluation index based on the migration evaluation information and the second matching degree.

[0080] At this time, it can be specifically an interception mapping mode, and an interception operation method / function with the field name of the first source field as an input parameter can be output, indicating an interception mapping mode. The data automatically marked as migrated to the first target field will be intercepted. The intercepted data and interception length can be configured according to the needs, tests and usage effects of the business application. In some possible scenarios, for the user address field, data representing the house number and street information can be intercepted, as shown in Table 2.

[0081] Table 2 Output table of migration from VARCHAR field type to VARCHAR2 field type

[0082] Mapping Mode Output CUT(source field) Complexity 2 Completeness (second degree of matching) 100% Loss value 0

[0083] In Table 2, CUT (source field) indicates that the current mapping mode is the interception mapping mode, and the data migrated to the first target field will be intercepted, where if 2 of the 100 data are still too long after interception, the integrity is 98%, the loss value is 0.04, and the success rate is 99.96%. Further, if the data column of the first source field allows correction operations, the data column mapping mode of the first source field can be a selective mapping mode, which can be specifically a correction mapping mode, and can output a correction operation method / function with the field name of the first source field as an input parameter, indicating a correction mapping mode, automatically marking the data migrated to the first target field for correction, and the correction data and correction range can be configured according to the needs, testing and use effects of business applications. In some possible scenarios, for business measurement fields, correction operations can be performed through normalization, standardization and other methods, as shown in Table 3.

[0084] Mapping Mode Output DevCorr(source field) Complexity m Completeness (second degree of matching) M% Loss value (1-M%)m

[0085] In Table 3, DevCorr (source field) indicates that the current mapping mode is the correction mapping mode, and m and M are real numbers. In some possible scenarios, the comprehensive source table loss value can be output at the table granularity:

[0086]

[0087] In this formula, is the loss value of a source table, and can also reflect the migration success rate of the source table, w1, w2, ..., w p is the complexity corresponding to each source field in the source table, x1, x2, ..., x p is the loss degree corresponding to each source field in the source table, and p is the number of source fields in the source table. The loss value of the source database can be further obtained:

[0088]

[0089] In this formula, The loss value of the source database can also reflect the migration success rate of the source database, where q is the number of source tables in the source database. The loss values ​​of the source tables and source databases can be used to verify the loss value / success rate of the above-mentioned migration plan information. For example, if the loss value is less than or equal to the specified loss threshold and the success rate is greater than or equal to the specified success rate threshold, then proceed to the subsequent steps. If the loss value is greater than the specified loss threshold and the success rate is less than the specified success rate threshold, then the field type correspondence between the fields in the two end tables can be excluded from this analysis and the field type correspondence can be re-determined. It should be noted that each mapping mode can be directly used to traverse and match a source field, and one of the aforementioned mapping modes can be selected using the optimal (high) integrity and (low) complexity, without the need to use the field type parameter definition item to select the data column mapping mode. In addition, the calculation method of the above-mentioned weights, loss values, and success rates is optional and is not the only implementation method. The calculation method can be selected and designed according to needs and test results. For example, the weight can be jointly constructed by the inverse of complexity and completeness, and the success rate can be determined by taking the conformity of each field value in the data column with the parameter definition item (if the data column fully conforms to 1 item, it is recorded as +1) as the measurement value.

[0090] In the examples of this manual, please refer to Figure 6 , automatic rule conversion can be performed. The above migration scheme information can be verified and converted using a preset conversion strategy. The above heterogeneous database migration method can also include:

[0091] S3, based on the preset conversion strategy and the migration evaluation index and data column mapping mode corresponding to each source field, determine the data conversion rules for extracting data from the data column of each source field of the source table to the corresponding target field.

[0092] In some possible implementations, the preset conversion strategy may include threshold judgment of the migration evaluation index of the source field to determine whether it meets the full match condition. Any data conversion rule may be a file carrying instruction information. When the full match condition is met, it can be determined as a direct extraction rule. The direct extraction rule can be used to indicate the code for combining / loading the data column data (each field value) of the source field through the data column mapping mode (which can be a data column mapping mode determined above) and the data migration operation instruction (the script to which the code is finally mapped can apply the data column mapping mode to the corresponding data while extracting the data, and then write it into the target database). The direct extraction rule can be output as a configuration file for a corresponding source field. When the full match condition is not met, it can be determined as a selective conversion rule. The selective conversion rule can be used to indicate the corresponding relationship and data column mapping mode of the adjustment field type, and the code for combining / loading the data column of the source field is extracted through the adjusted data column mapping mode and the data migration operation instruction.

[0093] The data migration operation instructions may include the read operation instructions of the source database and the write operation instructions of the target database, and may also include database identity authentication instructions, deletion operation instructions, etc. The migration evaluation indicators may select the aforementioned complexity and integrity (the first matching degree and the second matching degree), or may select the loss value or the success rate. In some possible examples, step S3 may include:

[0094] S301, if the migration evaluation indicator corresponding to the second source field indicates a field type match, then determine that the data conversion rule of the second source field is a direct extraction rule, and the direct extraction rule is used to extract the data column of the second source field to the second target field corresponding to the second source field in the target table through the data column mapping mode corresponding to the second source field.

[0095] Among them, the second source field can be any source field. For example, if the complexity corresponding to the second source field is less than or equal to the complexity threshold and the matching degree (completeness) is greater than or equal to the matching threshold, then the migration evaluation index corresponding to the second source field indicates that the field type matches, which can be regarded as meeting the complete match condition; if the complexity corresponding to the second source field is greater than the complexity threshold or the matching degree (completeness) is less than the matching threshold, then the migration evaluation index corresponding to the second source field indicates that the field type does not match, which can be regarded as not meeting the complete match condition. In addition, the loss value and threshold, the success rate and threshold can also be used to determine whether the complete match condition is met.

[0096] In the case where the migration evaluation indicator corresponding to the second source field meets the complete matching condition, the corresponding rule can be determined to be a direct extraction rule. Further, the aforementioned step S3 can also include:

[0097] S302: If the migration evaluation indicator corresponding to the second source field indicates that the field type does not match, determine the data conversion rule for the second source field based on the first set of field types supported by the source database and the second set of field types supported by the target database.

[0098] Among them, at least the field type of the second source field can be used in the first set, and other field types supported by the data column of the second source field can also be used to provide more field type selections for the target field in the target database to obtain a migration evaluation indicator with better performance. For example, the aforementioned selective conversion rule may include a removal symbol conversion rule, and the aforementioned step S302 may include:

[0099] S321, if the second set is a superset of the first set, the field type of the second target field is maintained and the data conversion rule of the second source field is determined to be a symbol removal conversion rule, wherein the symbol removal conversion rule is used to remove special symbols of the field values ​​in the data column of the second source field, and extract the removed data column to the second target field through the data column mapping mode corresponding to the second source field.

[0100] The second set is a superset of the first set, which can indicate that the field on the target side has enough space to store all the data of the field on the source side. If the incomplete match is not caused by insufficient space, the field type correspondence relationship can be unchanged, and the current rule is determined to be a symbol removal conversion rule to indicate that the special symbols in the data column of the second source field are removed by calling a special symbol removal method, wherein the special symbols can be removed from the field values ​​in the data column of the second source field that meet the data length definition and are not empty in the field type of the second target field, and indicate that the removed data column is extracted to the second target field through the data column mapping mode corresponding to the second source field. The data processing operation before extracting data can be the configuration information of the preprocessing code for extracting data, or it can be an indication of the migration server currently performing the preprocessing operation (the migration server processes and converts the data column of the second source field to meet the complete match condition). In addition, in addition to removing special symbols, field values ​​(default values, default text, etc.) that do not carry actual user information can also be removed, which can be considered based on actual product characteristics, testing and usage effects. Further, the aforementioned selective conversion rule can also include a reselection conversion rule, and the aforementioned step S302 can include:

[0101] S322: If the first set is a superset of the second set, the data conversion rule of the second source field is determined to be a reselection conversion rule, and the reselection conversion rule is used to reselect the field type of the second target field from the second set and to redetermine the corresponding data column mapping mode, and by redetermining the corresponding data column mapping mode, the data column of the second source field is extracted to the second target field.

[0102] Among them, the first set is a superset of the second set, which can indicate that the field of the target end does not have enough space to store all the data of the field of the source end. It can be determined that the corresponding relationship of the field type needs to be adjusted, and the current rule is determined to be a reselection conversion rule. The reselection conversion rule can indicate iterative conversion of the field type to perform the adjustment of the field type of the second source field in the first set or the adjustment of the field type of the target field corresponding to the field type of the second source field in the second set. After adjusting the corresponding relationship of the field type, the data column mapping mode can be obtained again. At this time, if the lossless mapping mode can be used, it is used first. The reselection conversion rule can also indicate that the data column of the second source field is extracted to the second target field by re-determining the corresponding data column mapping mode. If the corresponding relationship of the conversion field type is not successfully adjusted, the data column of the second source field can be corrected until it meets the success rate threshold, the corresponding relationship of the field type is obtained, and the process jumps to step S301, or the data column of the second source field is lossily intercepted to meet the parameter definition item of the re-determined field type of the second target field. In addition to using a superset to compare two sets, subsets can also be used for comparison. As mentioned above, based on the migration plan information, automatic data verification and determination of data conversion plans can be achieved.

[0103] In the examples of this manual, please refer to Figure 7 , automatic configuration and script execution (automatic script processing) can be performed. The aforementioned heterogeneous database migration method may also include:

[0104] S4: Generate and execute a migration script for the source table based on the data conversion rule.

[0105] In some possible implementations, the data conversion rules carry configuration instruction information that can instantiate data migration operations, and the data conversion rules corresponding to each source table in the source database can be obtained, and the migration script is generated based on each source table. The aforementioned step S4 may include:

[0106] S401, extracting each source field from the source table, and generating script configuration information through each source field and corresponding data conversion rules;

[0107] S402 , semantically analyzing the script configuration information, and translating the script configuration information after the semantic analysis to generate a migration script for the source table.

[0108] In the source database, all fields are taken out in units of each source table, and configuration information is generated through the corresponding conversion rules. After the configuration information is generated, semantic analysis is performed with the source table as the granularity. If the semantic analysis (judged by calling the analysis interface) fails, the part of the fields that failed the analysis is returned to step S3, and the configuration information is regenerated after switching the data conversion rules, and the semantic analysis is continued. If the analysis fails again, the above steps are re-executed until the semantic analysis is completely passed, and the grammatical translation is performed in the translation environment to generate the migration script. Among them, the conversion rule generates the migration script in a table-level rotation manner. After configuring a certain concurrency, the set maximum concurrency number will always be maintained. Each item is immediately aggregated after completion, and the next table is added to the scheduling task to quickly generate an automated migration script. The migration script includes relevant connection information, such as host information, database information, table information, structure information, corresponding relationship information, etc. of the source and target ends. The migration script also includes: code for instantiating data migration operations, such as the field type conversion method, preprocessing method, and data column mapping mode corresponding to the source end to the target end indicated by the data conversion rule. The semantic analysis interface can verify the code semantics of the configuration information to further improve the overall migration success rate of the source database.

[0109] In some possible examples, to further improve data migration efficiency, please refer to Figure 8 , the aforementioned step S4 may also include:

[0110] S403: Execute migration scripts of multiple source tables in the source database in parallel.

[0111] The migration server may include multiple processors or a single multi-core high-performance processor. When executing the migration scripts of multiple source tables of the source database, multiple processors (q) and global system memory may be used to support the execution of the migration scripts of each source table.

[0112] In the embodiments of the present specification, by analyzing the database types of the source and target ends, a parsable data portrait is generated, and the corresponding relationship between the field types of the databases at both ends is obtained by parsing the portrait, and the complexity and integrity of each column migration, the data column mapping mode are parsed, so as to determine the success rate of the migration of the entire table and the entire database, and provide field-level migration solution information. Through automatic rule conversion, iterative type conversion and correction methods, corresponding conversion rules are generated, and conversion solution information of the field value of the field can be provided on the basis of verification. Configuration information is generated through conversion rules, and then through iteration of semantic analysis, and finally through grammatical translation, a migration script is generated and executed to complete the migration of heterogeneous databases. There is no need for manual comparison, intervention in configuration correspondence, and no need to limit the migration scope of the database. It supports most existing traditional databases, open source databases, and domestic databases, and also supports custom database types.

[0113] An embodiment of this specification provides a heterogeneous database migration device under the same inventive concept as the above embodiment. Fig. 9 , the apparatus 900 may include:

[0114] A portrait generation module 901 is used to generate a data portrait based on the type of the source database and the type of the target database, wherein the data portrait carries comparison information between the field types used in the source database and the field types supported by the target database and migration assessment information;

[0115] A portrait parsing module 902 is used to parse the source table in the source database based on the data portrait, so as to output a data column mapping mode of a target field corresponding to each source field in a target table corresponding to the source table and a migration assessment index corresponding to each source field, wherein each data column mapping mode is indicated by the comparison information, the target field is used to mark the migration target position of the data column of the corresponding source field, and the migration assessment index is determined based on the migration assessment information and the matching degree between the data column of each source field and the corresponding data column mapping mode;

[0116] A rule determination module 903 is used to determine a data conversion rule for extracting data from the data column of each source field of the source table to the corresponding target field based on a preset conversion strategy and a migration evaluation index and a data column mapping mode corresponding to each source field;

[0117] The migration execution module 904 is used to generate and execute the migration script of the source table based on the data conversion rule.

[0118] Optionally, the device may further include: an acquisition module 905, wherein the acquisition module 905 is used to:

[0119] Acquire the field types used in the source database and the field types supported by the target database;

[0120] According to the configured field index parameters, the field type used in the source database is compared with the field type supported by the target database to obtain comparison information.

[0121] Optionally, based on the type of the source database and the type of the target database, a data profile is generated, including:

[0122] Based on the comparison information, performing data feature comparison analysis on the data in the source database and the sample data in the target database to determine migration assessment information;

[0123] The migration assessment information is input into a portrait characterization model to generate a data portrait between the source database and the target database, wherein the portrait characterization model is trained based on a sample consisting of the set migration assessment information and corresponding data portrait labels.

[0124] Optionally, based on the data portrait, a source table in the source database is parsed to output a data column mapping mode of a target field corresponding to each source field in a target table corresponding to the source table and output a migration evaluation index corresponding to each source field, including:

[0125] Based on the comparison information parsed in the data portrait, selecting, from the field types supported by the target database, a field type of the first source field in the source table corresponding to a field type of the first target field in the target table;

[0126] If the data length defined by the field type of the first source field matches the data length defined by the field type of the first target field, determining that the data column mapping mode of the first source field is a direct mapping mode;

[0127] A first matching degree between the data column of the first source field and the direct mapping mode is determined, and a migration evaluation index is output based on the migration evaluation information and the first matching degree.

[0128] Optionally, based on the data portrait, a source table in the source database is parsed to output a data column mapping mode of a target field corresponding to each source field in a target table corresponding to the source table and a migration evaluation index corresponding to each source field, further comprising:

[0129] If the field length defined by the field type of the first source field does not conform to the field length defined by the field type of the first target field, and the data column of the first source field allows a truncation operation or a deflection operation, determining that the data column mapping mode of the first source field is a selective mapping mode;

[0130] A second matching degree between the data column of the first source field and the selective mapping mode is determined, and a migration evaluation index is output based on the migration evaluation information and the second matching degree.

[0131] Optionally, based on a preset conversion strategy and a migration assessment index and a data column mapping mode corresponding to each source field, determining a data conversion rule for extracting data from a data column of each source field of the source table to a corresponding target field includes:

[0132] If the migration assessment indicator corresponding to the second source field indicates that the field type matches, determining that the data conversion rule of the second source field is a direct extraction rule, the direct extraction rule is used to extract the data column of the second source field into the second target field corresponding to the second source field in the target table through the data column mapping mode corresponding to the second source field;

[0133] If the migration assessment indicator corresponding to the second source field indicates that the field type does not match, a data conversion rule for the second source field is determined based on a first set of field types supported by the source database and a second set of field types supported by the target database.

[0134] Optionally, determining the data conversion rule of the second source field based on a first set of field types supported by the source database and a second set of field types supported by the target database includes:

[0135] If the second set is a superset of the first set, the field type of the second target field is maintained and the data conversion rule of the second source field is determined to be a symbol removal conversion rule, wherein the symbol removal conversion rule is used to remove special symbols of field values ​​in the data column of the second source field, and extract the removed data column to the second target field through the data column mapping mode corresponding to the second source field;

[0136] If the first set is a superset of the second set, the data conversion rule of the second source field is determined to be a reselection conversion rule, and the reselection conversion rule is used to reselect the field type of the second target field from the second set and redetermine the corresponding data column mapping mode, and by redetermining the corresponding data column mapping mode, the data column of the second source field is extracted to the second target field.

[0137] Optionally, based on the data conversion rule, generating and executing a migration script of the source table includes:

[0138] Extract each source field from the source table, and generate script configuration information through each source field and corresponding data conversion rules;

[0139] Performing semantic analysis on the script configuration information, and translating the script configuration information after the semantic analysis to generate a migration script for the source table;

[0140] Migration scripts of multiple source tables in the source database are executed in parallel.

[0141] An embodiment of this specification provides an electronic device under the same inventive concept as the above embodiment, and the electronic device may include: at least one processor; a memory connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the at least one processor implements the method in the above embodiment by executing the instructions stored in the memory. Please refer to Fig.11 , provides an exemplary electronic device, whose internal structure diagram can be shown as Fig.11 As shown, it can be a server, an industrial computer, a user device, a terminal device, a microcontroller, etc. The electronic device includes a processor A01, a network interface A02, and a memory connected by a bus. Among them, the processor A01 of the electronic device is used to provide computing, instruction processing and control capabilities. The memory of the electronic device includes a memory A03 and a non-volatile storage medium A04. The non-volatile storage medium A04 stores an operating system B01 and a computer program B02. The memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 in the non-volatile storage medium A04. The network interface A02 of the electronic device is used to communicate with the network. When the computer program B02 is executed by the processor A01, the method in the aforementioned embodiment is implemented.

[0142] In one embodiment of the present specification, when the computer program B02 is executed by the processor A01, the implemented method may include:

[0143] Generate a data profile based on the type of the source database and the type of the target database, the data profile carrying comparison information between the field types used in the source database and the field types supported by the target database and migration assessment information;

[0144] Based on the data portrait, a source table in the source database is parsed to output a data column mapping mode of a target field corresponding to each source field in a target table corresponding to the source table and a migration assessment index corresponding to each source field, wherein each data column mapping mode is indicated by the comparison information, the target field is used to mark a migration target position of a data column of the corresponding source field, and the migration assessment index is determined based on the migration assessment information and a matching degree between the data column of each source field and the corresponding data column mapping mode;

[0145] Determine data conversion rules for extracting data from the data columns of each source field of the source table to the corresponding target field based on a preset conversion strategy and migration evaluation indicators and data column mapping modes corresponding to each source field;

[0146] Based on the data conversion rules, a migration script of the source table is generated and executed.

[0147] One embodiment of the present specification provides a machine-readable storage medium under the same inventive concept as the aforementioned embodiment, storing machine instructions. When the machine instructions are executed on a machine, the machine executes the method in the aforementioned embodiment. The machine may include a computer and a device with communication, computing and instruction processing capabilities.

[0148] In one embodiment of the present specification, when the machine instruction is executed on a machine, the method executed by the machine may include:

[0149] Generate a data profile based on the type of the source database and the type of the target database, the data profile carrying comparison information between the field types used in the source database and the field types supported by the target database and migration assessment information;

[0150] Based on the data portrait, a source table in the source database is parsed to output a data column mapping mode of a target field corresponding to each source field in a target table corresponding to the source table and a migration assessment index corresponding to each source field, wherein each data column mapping mode is indicated by the comparison information, the target field is used to mark a migration target position of a data column of the corresponding source field, and the migration assessment index is determined based on the migration assessment information and a matching degree between the data column of each source field and the corresponding data column mapping mode;

[0151] Determine data conversion rules for extracting data from the data columns of each source field of the source table to the corresponding target field based on a preset conversion strategy and migration evaluation indicators and data column mapping modes corresponding to each source field;

[0152] Based on the data conversion rules, a migration script of the source table is generated and executed.

[0153] The term "carrying" means at least existence, including, etc., rather than being limited to only containing, only existing. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of this specification can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of this specification can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0154] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0155] In short, the above description is only a preferred embodiment of this specification and is not intended to limit the protection scope of this specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included in the protection scope of this specification.

[0156] The systems or modules described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer.

[0157] Machine-readable storage media can be computer storage media, which can include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0158] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0159] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

Claims

1. A heterogeneous database migration method, It is characterized in that include: Generate a data profile based on the type of the source database and the type of the target database, the data profile carrying comparison information between the field types used in the source database and the field types supported by the target database and migration assessment information; Based on the data portrait, a source table in the source database is parsed to output a data column mapping mode of a target field corresponding to each source field in a target table corresponding to the source table and a migration assessment index corresponding to each source field, wherein each data column mapping mode is indicated by the comparison information, the target field is used to mark a migration target position of a data column of the corresponding source field, and the migration assessment index is determined based on the migration assessment information and a matching degree between the data column of each source field and the corresponding data column mapping mode; Determine data conversion rules for extracting data from the data columns of each source field of the source table to the corresponding target field based on a preset conversion strategy and migration evaluation indicators and data column mapping modes corresponding to each source field; Based on the data conversion rules, a migration script of the source table is generated and executed.

2. The heterogeneous database migration method according to claim 1, It is characterized in that Before generating the data profile based on the type of the source database and the type of the target database, the method further includes: Acquire the field types used in the source database and the field types supported by the target database; According to the configured field index parameters, the field type used in the source database is compared with the field type supported by the target database to obtain comparison information.

3. The heterogeneous database migration method according to claim 2, It is characterized in that The generating of the data profile based on the type of the source database and the type of the target database includes: Based on the comparison information, performing data feature comparison analysis on the data in the source database and the sample data in the target database to determine migration assessment information; The migration assessment information is input into a portrait characterization model to generate a data portrait between the source database and the target database, wherein the portrait characterization model is trained based on a sample consisting of the set migration assessment information and corresponding data portrait labels.

4. The heterogeneous database migration method according to claim 1, It is characterized in that The method of parsing the source table in the source database based on the data portrait to output a data column mapping mode of a target field corresponding to each source field in a target table corresponding to the source table and outputting a migration evaluation index corresponding to each source field includes: Based on the comparison information parsed in the data portrait, selecting, from the field types supported by the target database, a field type of the first source field in the source table corresponding to a field type of the first target field in the target table; If the data length defined by the field type of the first source field matches the data length defined by the field type of the first target field, determining that the data column mapping mode of the first source field is a direct mapping mode; A first matching degree between the data column of the first source field and the direct mapping mode is determined, and a migration evaluation index is output based on the migration evaluation information and the first matching degree.

5. The heterogeneous database migration method according to claim 4, It is characterized in that The step of parsing the source table in the source database based on the data portrait to output a data column mapping mode of a target field corresponding to each source field in a target table corresponding to the source table and outputting a migration evaluation index corresponding to each source field also includes: If the field length defined by the field type of the first source field does not conform to the field length defined by the field type of the first target field, and the data column of the first source field allows a truncation operation or a deflection operation, determining that the data column mapping mode of the first source field is a selective mapping mode; A second matching degree between the data column of the first source field and the selective mapping mode is determined, and a migration evaluation index is output based on the migration evaluation information and the second matching degree.

6. The heterogeneous database migration method according to claim 1, It is characterized in that The step of determining data conversion rules for extracting data from the data columns of each source field of the source table to the corresponding target field based on the preset conversion strategy and the migration evaluation index and data column mapping mode corresponding to each source field includes: If the migration assessment indicator corresponding to the second source field indicates that the field type matches, determining that the data conversion rule of the second source field is a direct extraction rule, the direct extraction rule is used to extract the data column of the second source field into the second target field corresponding to the second source field in the target table through the data column mapping mode corresponding to the second source field; If the migration assessment indicator corresponding to the second source field indicates that the field type does not match, a data conversion rule for the second source field is determined based on a first set of field types supported by the source database and a second set of field types supported by the target database.

7. The heterogeneous database migration method according to claim 6, It is characterized in that The step of determining a data conversion rule for the second source field based on a first set of field types supported by the source database and a second set of field types supported by the target database includes: If the second set is a superset of the first set, the field type of the second target field is maintained and the data conversion rule of the second source field is determined to be a symbol removal conversion rule, wherein the symbol removal conversion rule is used to remove special symbols of field values ​​in the data column of the second source field, and extract the removed data column to the second target field through the data column mapping mode corresponding to the second source field; If the first set is a superset of the second set, the data conversion rule of the second source field is determined to be a reselection conversion rule, and the reselection conversion rule is used to reselect the field type of the second target field from the second set and redetermine the corresponding data column mapping mode, and by redetermining the corresponding data column mapping mode, the data column of the second source field is extracted to the second target field.

8. The heterogeneous database migration method according to claim 1, It is characterized in that The step of generating and executing the migration script of the source table based on the data conversion rule includes: Extract each source field from the source table, and generate script configuration information through each source field and corresponding data conversion rules; Performing semantic analysis on the script configuration information, and translating the script configuration information after the semantic analysis to generate a migration script for the source table; Migration scripts of multiple source tables in the source database are executed in parallel.

9. A heterogeneous database migration device, It is characterized in that include: A portrait generation module, used to generate a data portrait based on the type of the source database and the type of the target database, wherein the data portrait carries comparison information between the field types used in the source database and the field types supported by the target database and migration evaluation information; A portrait parsing module, for parsing a source table in the source database based on the data portrait, so as to output a data column mapping mode of a target field corresponding to each source field in a target table corresponding to the source table and a migration assessment index corresponding to each source field, wherein each data column mapping mode is indicated by the comparison information, the target field is used to mark a migration target position of a data column of the corresponding source field, and the migration assessment index is determined based on the migration assessment information and a matching degree between the data column of each source field and the corresponding data column mapping mode; A rule determination module, for determining a data conversion rule for extracting data from a data column of each source field of the source table to a corresponding target field based on a preset conversion strategy and a migration evaluation index and a data column mapping mode corresponding to each source field; The migration execution module is used to generate and execute the migration script of the source table based on the data conversion rule.

10. An electronic device, It is characterized in that The electronic device comprises: at least one processor; a memory connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the at least one processor implements the method of any one of claims 1 to 8 by executing the instructions stored in the memory.

Citation Information

Cited By

  • Software ecological migration method and system based on intelligent analysis

    CN119903048A

  • Data comparison method

    CN120470002A

  • Method for comparing data integrity and consistency after database migration backup

    CN120561111A

  • Database migration post-backup data integrity and consistency comparison method

    CN120561111B