Data migration method applied to localization of database

By determining the standard time point in the process of localization of the database, migrating the existing data, and using CDC functions and message middleware to migrate incremental data, the compatibility and incremental migration problems of existing domestic database migration methods are solved, and efficient Secure database migration.

CN119474045APending Publication Date: 2025-02-18HARBIN TIANYUAN PETROCHEM ENG DESIGN CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311002662.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-09
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

There is compatibility problem with the existing domestic database migration method, making it difficult to migrate abnormal database objects independently, and does not support incremental migration, resulting in cumbersome migration of historical data, unable to achieve smooth replacement and massive data migration, and it is difficult to ensure data security and integrity. .

Method used

By determining the standard time point, determining the tabular structure and stock data of the source database based on the time point, building a target database table, and migrating the stock data to the target database. Enable the library-level CDC function and table-level CDC function of the source database, obtain incremental data, and migrate the incremental data to the target database through the message middleware.

Benefits of technology

It realizes rapid, correct, efficient and smooth migration of database structure, content and system, improves data management efficiency, ensures data security and integrity, and supports the migration of stock and incremental data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119474045A_ABST
    Figure CN119474045A_ABST
Patent Text Reader

Abstract

The invention discloses a data migration method applied to database localization, and belongs to the field of data migration, and the method comprises the following steps: determining a standard time point, and determining a table structure and stock data of a source database based on the standard time point; constructing a target database table based on the table structure, and migrating the stock data to the target database table; starting a library-level CDC function and a table-level CDC function of the source database, and obtaining incremental data; and analyzing the incremental data, pushing the analyzed incremental data to message middleware, and migrating the incremental data to the target database table based on the message middleware. According to the data migration method provided by the invention, the problem of data migration of the domestic database is solved, migration of incremental data is supported, smooth migration of the database structure, content and system thereof can be quickly, correctly and efficiently realized, the data management efficiency is improved, and the data security is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to a data migration method for localization of a database, and belongs to the field of data migration. Background Art

[0002] At present, "domestic operating systems" and "domestic databases" are gradually being recognized in important industries. In order to promote the exploration of safe and controllable software technology products and strengthen the information security construction of various industries, many domestic enterprises such as oil depots have begun to explore the transformation of the original IT systems, and the demand for domestic databases is becoming increasingly strong. New systems directly use domestic operating systems and domestic databases, but many projects that are already in operation and will continue to use the system will involve the issue of database historical data migration during the localization process.

[0003] With the development and application requirements of the national computer operating system localization and technical application software, in order to accelerate the localization of software to help accelerate information technology upgrades and localization transformation, some existing platform software such as crude oil early warning platform software can no longer meet its application and data security requirements. It is necessary to replace the platform operating system, database and software technical language and migrate data, and quickly adopt domestic operating systems to replace traditional Windows series operating systems, and adopt domestic databases to replace traditional Microsoft SQlServer series databases, so as to avoid the "bottleneck" problems faced by the platform in key technologies and applications and eliminate potential data security risks.

[0004] In the process of migration of existing platform software, in addition to the localization of the software platform writing language, the database must also be localized. Since a large amount of historical data has been generated in the background after the platform software has been used for a long time, the integrity and authenticity of the historical data must be guaranteed during the migration of the platform. At present, the migration method of domestic databases mostly uses the provided migration tools for automated migration. Among them, the tools can only be used for migration of source databases with high compatibility with the tools; the database object mapping relationship is usually encapsulated inside the tool and cannot be read. When the migration fails, it is difficult to independently migrate the views, packages, stored procedures, and functions that may have exceptions; at the same time, most of them do not support incremental migration. Other existing methods for migrating historical data during localization are cumbersome and cannot achieve smooth replacement and migration of massive data. In addition, it is difficult to ensure the security, integrity, validity, and accurate connection of historical data with new data during data migration. Summary of the invention

[0005] The purpose of this application is to provide a data migration method applied to database localization, which solves the problem of data migration in domestic databases, supports the migration of existing and incremental data, and can quickly, correctly and efficiently realize the smooth migration of database structure, content and its system, thereby improving data management efficiency and ensuring data security.

[0006] To achieve the above objectives, the first aspect of the present application provides a data migration method for localization of a database, comprising:

[0007] Determine a standard time point, and determine a table structure and stock data of a source database based on the standard time point, wherein the stock data is read-only historical static data before the standard time point;

[0008] Constructing a target database table based on the table structure;

[0009] Migrating the stock data to the target database table;

[0010] Enable the database-level CDC function and table-level CDC function of the source database, and obtain incremental data, where the incremental data is the data changed after the standard time point;

[0011] The incremental data is parsed and pushed to the message middleware, and the incremental data is migrated to the target database table based on the message middleware.

[0012] In one embodiment, determining the table structure of the source database based on the standard time point includes:

[0013] All table structure definition statements and sequence definition statements of the source database before the standard time point are used as the table structure of the source database.

[0014] In one implementation, constructing a target database based on the table structure includes:

[0015] Exporting the table structure definition statement and the sequence definition statement from the source database;

[0016] The table structure definition statement and the sequence definition statement are converted respectively according to the definition syntax of the target database to generate a target database table structure definition statement and a target database sequence definition statement;

[0017] Importing the target database table structure definition statement into the target database;

[0018] Based on the target database sequence definition statement, the sequence is imported into the target database to obtain the target database table.

[0019] In one embodiment, the step of importing the sequence into the target database further comprises:

[0020] An initial value of the sequence is set in the target database, and a sequence is reserved at the starting point of the initial value of the sequence to meet the sequence usage requirements of the data generated during the data migration process.

[0021] In one embodiment, migrating the stock data to the target database table includes:

[0022] Exporting stock data from the source database, wherein the format of the stock data is a sql file;

[0023] Parse the insert statement in the SQL file, convert the incompatible fields in the SQL file to be compatible, and get a new SQL file;

[0024] Import the new sql file into the target database table.

[0025] In one implementation, the source database is SQL Server; enabling the library-level CDC function and the table-level CDC function of the source database and acquiring incremental data includes:

[0026] By using the data monitoring mechanism of SQL Server itself, the library-level CDC function and the table-level CDC function are enabled respectively to obtain the system table, and the incremental data is obtained based on the system table.

[0027] In one embodiment, parsing the incremental data and pushing the parsed incremental data to a message middleware, and migrating the incremental data to the target database table based on the message middleware includes:

[0028] Parse the incremental data into messages in JSON format, and push the messages in JSON format to the message queue of the message middleware;

[0029] Reparse the messages in the message queue into SQL statements, execute the parsed SQL statements in the target database table, and complete the migration of the incremental data.

[0030] The second aspect of the present application provides a data migration system for database localization, including:

[0031] A first acquisition module is used to determine a standard time point, and determine a table structure and stock data of a source database based on the standard time point, wherein the stock data is read-only historical static data before the standard time point;

[0032] A table construction module, used for constructing a target database table based on the table structure;

[0033] An existing data migration module, used for migrating the existing data to the target database table;

[0034] The second acquisition module is used to enable the library-level CDC function and the table-level CDC function of the source database and acquire incremental data, wherein the incremental data is the data changed after the standard time point;

[0035] The incremental data migration module is used to parse the incremental data and push the parsed incremental data to the message middleware, and migrate the incremental data to the target database table based on the message middleware.

[0036] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the first aspect or any one of the embodiments of the first aspect when executing the computer program.

[0037] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the first aspect or any implementation of the first aspect are implemented.

[0038] As can be seen from the above, the present application provides a data migration method for database localization. It does not need to change the historical data of the original database, effectively guarantees the authenticity, integrity and validity of the historical data, and effectively connects with the new data generated by the system operation, so as to avoid data loss and redundant data, accurately connect the old and new data, and use the original operating system normally. The incremental data is transferred synchronously until the localized software is switched normally, so as to achieve a smooth switch without user response and difference. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0040] Figure 1 A flowchart of a data migration method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0042] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0043] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, the singular forms "a", "an" and "the" are intended to include plural forms unless the context clearly indicates otherwise.

[0044] The following is a clear and complete description of the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0045] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present application. Therefore, the present application is not limited to the specific embodiments disclosed below.

[0046] Embodiment 1

[0047] The present application embodiment provides a data migration method for localization of databases, such as Figure 1 As shown, the method includes:

[0048] S100 determines a standard time point, and determines a table structure and stock data of a source database based on the standard time point, wherein the stock data is read-only historical static data before the standard time point;

[0049] In one embodiment, the data migration method is applied in a distributed environment including a server cluster, multiple data collection programs, and a mobile client program to transfer data stored in a traditional Microsoft SQL Server 2014 database to a postgresql V8 R5 database. Figure 1 The original data source in the example is SQL Server 2014 database. The original system is a platform software running on the operating system Window Server 2016, the database SQL Server, and the software technology language .Net. The target database ( Figure 1 The domestic data source in the article is the postgresql V8R5 database.

[0050] Optionally, determining the table structure of the source database based on the standard time point includes:

[0051] All table structure definition statements and sequence definition statements of the source database before the standard time point are used as the table structure of the source database.

[0052] S200 constructs a target database table based on the table structure;

[0053] Optionally, constructing a target database based on the table structure includes:

[0054] Exporting the table structure definition statement and the sequence definition statement from the source database;

[0055] The table structure definition statement and the sequence definition statement are converted respectively according to the definition syntax of the target database to generate a target database table structure definition statement and a target database sequence definition statement; wherein the target database table structure conversion is to convert the source database structure into the target database structure according to the target database type, involving table definition, table field type adaptation, index adaptation, stored procedure conversion, etc.

[0056] Importing the target database table structure definition statement into the target database;

[0057] Based on the target database sequence definition statement, the sequence is imported into the target database to obtain the target database table,

[0058] In one embodiment, a certain time point is selected as the standard time point 1, and the database data before the standard time point 1 is the stock data, that is, the read-only historical static data that is stable and unchanged for the original system. Use the query database table construction method to export all the table structure definition statements of the source database according to the standard time point 1 of the source database, and generate them in text format, parse and verify the definitions of all tables, create and convert the target data table according to the target database definition syntax, generate the target database table structure definition statement, and import the converted table structure definition statement into the target database to complete the conversion of the source database to the target database table structure. Before and after this step, the localized system does not switch, and the original system still reads and writes from the original data source.

[0059] In one embodiment, the standard time point 1 is also used as the time point for migrating the database sequence, and the sequence definition statement before the standard time point 1 is exported from the source database, and the sequence definition statement is parsed and converted, converted according to the target database definition syntax, and a target database sequence definition statement is generated, the target database sequence definition statement is executed, and the sequence is imported into the target database.

[0060] In one embodiment, after the sequence is imported into the target database, it is necessary to set the sequence initial value in the target database. To ensure the normal progress of subsequent migration work, sufficient sequence is reserved at the starting point of the sequence initial value to meet the sequence usage requirements of the data generated during the data migration process.

[0061] S300: Migrate the stock data to the target database table;

[0062] Optionally, migrating the stock data to the target database table includes:

[0063] Exporting stock data from the source database, wherein the format of the stock data is a sql file;

[0064] Parse the insert statement in the SQL file, convert the incompatible fields in the SQL file to be compatible, and get a new SQL file;

[0065] Import the new sql file into the target database table.

[0066] In one embodiment, after the migration operation is defined according to S200, the table data records before the standard time point 1 in step S200 are exported from the source database, and the format of the exported data records is sql format. Then the sql file is parsed, all insert statements are selected, and incompatible fields are converted to be compatible to form a new insert sql file suitable for the target database. Finally, the converted sql script statement is imported into the target database and executed. After execution, it is successfully completed, that is, the migration of the stock data is completed.

[0067] In one implementation, when the stock data of the original system is imported into the target database, the data is cleaned and converted through an ETL extraction tool and falls into the target database.

[0068] S400: Enable the database-level CDC function and the table-level CDC function of the source database, and obtain incremental data, wherein the incremental data is the data changed after the standard time point;

[0069] Optionally, the source database is SQL Server; enabling the library-level CDC function and the table-level CDC function of the source database and obtaining incremental data includes:

[0070] Using SQL Server's own data monitoring mechanism, we enable the library-level CDC function and the table-level CDC function respectively, obtain the system table, and obtain incremental data based on the system table. After the migration of the stock data is completed, the incremental data is automatically obtained and synchronized through the CDC function. At this time, the original system is still used to perform read and write operations from the original data source, or the domestic system is used to read data from the domestic data source.

[0071] In one implementation, based on the stock data migration completed in S300, the automatic migration of incremental data generated after the standard time point 1 is performed, which specifically includes the following steps:

[0072] Step 1: Enable library-level CDC:

[0073] USE<database_name>

[0074] GO

[0075] EXEC sys.sp_cdc_enable_db

[0076] GO

[0077] After the above statement is executed, it will<database_name> Create the following six system tables in the "System Table" under the database:

[0078] dbo.systranschemas

[0079] cdc.change_tables

[0080] cdc.index_columns

[0081] cdc.captured_columns

[0082] cdc.lsn_time_mapping

[0083] cdc.ddl_history

[0084] Use the following statement to verify whether SQL Server library-level CDC is successfully enabled. If 1 is returned, it means it is enabled:

[0085] select is_cdc_enabled from sys.databases where name='<database_name> ';

[0086] Step 2: Enable table-level CDC:

[0087] EXEC sys.sp_cdc_enable_table

[0088] @source_schema = N'dbo',

[0089] @source_name=N'table_name',

[0090] @capture_instance=NULL,

[0091] @role_name=NULL,

[0092] @supports_net_changes=0,

[0093] After completing steps 1 and 2, a system table named "table_name_CT" will be automatically generated in the "system table" under the database_name database. One business table corresponds to one system table. Depend on step 1 to verify whether the SQLServer table-level CDC is enabled in step 2. Specifically, execute the following query statement. If the execution result returns 1, it means that the table-level CDC function has been enabled for the table. If the return result is not 1, re-execute step 1 until the table-level CDC function is successfully enabled:

[0094] CDCSELECT is_tracked_by_cdc FROM sys.tables WHERE name='<table_name> '

[0095] Step 3: Get incremental data

[0096] When adding, modifying, or deleting table data, the table_name_CT table can capture the changed data as incremental data.

[0097] S500 parses the incremental data and pushes the parsed incremental data to the message middleware, and migrates the incremental data to the target database table based on the message middleware.

[0098] In one embodiment, parsing the incremental data and pushing the parsed incremental data to a message middleware, and migrating the incremental data to the target database table based on the message middleware includes:

[0099] Parse the incremental data into messages in JSON format, and push the messages in JSON format to the message queue of the message middleware;

[0100] Reparse the messages in the message queue into SQL statements, execute the parsed SQL statements in the target database table, and complete the migration of the incremental data. In the process of incremental data migration, the original system can be used to read and write from the original data source according to actual business needs, or the domestic system can be used to read data from the domestic data source until the incremental data migration is completed. After the migration is completed, the original system and the original data source are deactivated, and data is only read from the domestic data source through the domestic system, so as to achieve a smooth transition of the business system database replacement and uninterrupted system use.

[0101] In one implementation, the changed data is obtained by monitoring the CT table, and the data change type (addition, modification or deletion) is inferred according to the CT table data operation type (operation), and the changed data is assembled into json format and pushed to the message middleware (rabbitmq);

[0102] Among them, the newly added data is _$operation=2; the modified data is _$operation=3 (before modification) and _$operation=4 (after modification); and the deleted data is _$operation=1.

[0103] For messages in JSON format in the message queue, they are re-parsed into SQL statements according to the data format of the target database, and the parsed SQL statements are executed in the target database.

[0104] Through the above operations, you can complete the database migration.

[0105] As can be seen from the above, the embodiment of the present application provides a data migration method for database localization. It does not need to change the historical data of the original database, effectively guarantees the authenticity, integrity and validity of the historical data, and effectively connects with the new data generated by the system operation, so as to avoid data loss and redundant data, accurately connect the old and new data, and use the original operating system normally. The incremental data is transferred synchronously until the localized software is switched normally, so as to achieve a smooth switch without user response and difference.

[0106] Embodiment 2

[0107] The embodiment of the present application provides a data migration system for database localization, the system comprising: a first acquisition module, a table construction module, a stock data migration module, a second acquisition module and an incremental data migration module;

[0108] The first acquisition module is used to determine a standard time point, and determine the table structure and stock data of the source database based on the standard time point, wherein the stock data is read-only historical static data before the standard time point;

[0109] The table construction module is used to construct a target database table based on the table structure;

[0110] The stock data migration module is used to migrate the stock data to the target database table;

[0111] The second acquisition module is used to enable the library-level CDC function and the table-level CDC function of the source database and acquire incremental data, wherein the incremental data is the data changed after the standard time point;

[0112] The incremental data migration module is used to parse the incremental data and push the parsed incremental data to the message middleware, and migrate the incremental data to the target database table based on the message middleware.

[0113] As can be seen from the above, the data migration system provided by the embodiment of the present application for database localization does not need to change the historical data of the original database, effectively guarantees the authenticity, integrity and validity of the historical data, and effectively connects with the new data generated by the operation of the system, so as to avoid data loss and redundant data, accurately connect the old and new data, and use the original operating system normally. The incremental data is transferred synchronously until the localized software is switched normally, so as to achieve a smooth switch without user response and difference.

[0114] Embodiment 3

[0115] An embodiment of the present application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the memory is used to store software programs and modules, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory and the processor are connected via a bus. Specifically, the processor implements any step in the first embodiment above by running the computer program stored in the memory.

[0116] It should be understood that in the embodiments of the present application, the processor referred to may be a central processing unit (CPU), and the processor may also be 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. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0117] The memory may include a read-only memory, a flash memory, and a random access memory, and provides instructions and data to the processor. A part or all of the memory may also include a nonvolatile random access memory.

[0118] It can be seen from the above that the electronic device provided in the embodiment of the present application implements the data migration method as described in Example 1 by running a computer program. There is no need to change the historical data of the original database, effectively ensuring the authenticity, integrity and validity of the historical data, and at the same time effectively connecting with the new data generated by the operation of the system, so as to avoid data loss and redundant data, accurately connect the old and new data, use the original operating system normally, and transfer the incremental data synchronously until the domestic software is switched normally, so as to achieve a smooth switch without user response and difference.

[0119] It should be understood that the above-mentioned integrated module / unit, if implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on such an understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the above-mentioned computer program includes computer program code, and the above-mentioned computer program code can be in source code form, object code form, executable file or some intermediate form. The above-mentioned computer-readable medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the above-mentioned computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction.

[0120] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

[0121] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the above-mentioned device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0122] It should be noted that the methods and detailed examples provided in the above embodiments can be combined with the devices and equipment provided in the embodiments, and references can be made to each other, and no further details will be given.

[0123] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0124] In the embodiments provided in the present application, it should be understood that the disclosed apparatus / terminal equipment and method can be implemented in other ways. For example, the apparatus / equipment embodiments described above are only illustrative, for example, the division of the above modules or units is only a logical function division, and in actual implementation, other division methods can be used, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0125] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A data migration method applied to database localization, characterized in that: include: Determine a standard time point, and determine a table structure and stock data of a source database based on the standard time point, wherein the stock data is read-only historical static data before the standard time point; Constructing a target database table based on the table structure; Migrating the stock data to the target database table; Enable the database-level CDC function and table-level CDC function of the source database, and obtain incremental data, where the incremental data is the data changed after the standard time point; The incremental data is parsed and pushed to the message middleware, and the incremental data is migrated to the target database table based on the message middleware.

2. The data migration method according to claim 1, characterized in that: The determining of the table structure of the source database based on the standard time point comprises: All table structure definition statements and sequence definition statements of the source database before the standard time point are used as the table structure of the source database.

3. The data migration method according to claim 2, characterized in that: The constructing a target database based on the table structure comprises: Exporting the table structure definition statement and the sequence definition statement from the source database; The table structure definition statement and the sequence definition statement are converted respectively according to the definition syntax of the target database to generate a target database table structure definition statement and a target database sequence definition statement; Importing the target database table structure definition statement into the target database; Based on the target database sequence definition statement, the sequence is imported into the target database to obtain the target database table.

4. The data migration method according to claim 3, characterized in that: After importing the sequence into the target database, the step further includes: An initial value of the sequence is set in the target database, and a sequence is reserved at the starting point of the initial value of the sequence to meet the sequence usage requirements of the data generated during the data migration process.

5. The data migration method according to any one of claims 1 to 4, characterized in that: The migrating the stock data to the target database table includes: Exporting stock data from the source database, wherein the format of the stock data is a sql file; Parse the insert statement in the SQL file, convert the incompatible fields in the SQL file to be compatible, and get a new SQL file; Import the new sql file into the target database table.

6. The data migration method according to any one of claims 1 to 4, characterized in that: The source database is SQL Server; enabling the library-level CDC function and the table-level CDC function of the source database and obtaining incremental data includes: By using the data monitoring mechanism of SQL Server itself, the library-level CDC function and the table-level CDC function are enabled respectively to obtain the system table, and the incremental data is obtained based on the system table.

7. The data migration method according to claim 6, characterized in that: The parsing of the incremental data and pushing the parsed incremental data to the message middleware, and migrating the incremental data to the target database table based on the message middleware comprises: Parse the incremental data into messages in JSON format, and push the messages in JSON format to the message queue of the message middleware; Reparse the messages in the message queue into SQL statements, execute the parsed SQL statements in the target database table, and complete the migration of the incremental data.

8. A data migration system applied to database localization, characterized in that: include: A first acquisition module is used to determine a standard time point, and determine a table structure and stock data of a source database based on the standard time point, wherein the stock data is read-only historical static data before the standard time point; A table construction module, used for constructing a target database table based on the table structure; An existing data migration module, used for migrating the existing data to the target database table; The second acquisition module is used to enable the library-level CDC function and the table-level CDC function of the source database and acquire incremental data, wherein the incremental data is the data changed after the standard time point; The incremental data migration module is used to parse the incremental data and push the parsed incremental data to the message middleware, and migrate the incremental data to the target database table based on the message middleware.

9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.