A database migration method, device and medium for a heterogeneous database
By automatically extracting and matching SQL statements from the source database to generate a migration compatibility assessment set, the problem of manual adaptation in traditional heterogeneous database migration is solved, achieving efficient and stable database migration and SQL optimization, and improving migration success rate and system performance.
Patent Information
- Application Number
- CN202411417851.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2044-10-11
AI Technical Summary
Traditional heterogeneous database migration relies on manual checks of application-level compatibility, without considering SQL execution performance, leading to compatibility issues that affect migration efficiency and system performance.
By automatically extracting the original SQL statements from the source database, performing rule matching checks based on the current statement rule information of the target migration database, generating a migration compatibility evaluation set, and generating a migration compatibility optimization reference file, the automated migration between the source database and the target migration database is achieved.
It significantly reduces the tediousness and error-proneness of manual investigation, improves the accuracy and efficiency of migration, ensures that database performance is not affected, reduces the risk of migration failure, optimizes SQL statements, and improves the migration success rate and system stability.
Smart Images

Figure CN119396799B_ABST
Abstract
Claims
1. A database migration method for heterogeneous databases, characterized in that, The method includes: Obtain database migration requirement information, wherein the database migration requirement information includes current business information, target migration database information, and source database information; Based on the database migration requirement information, the data table structure and business data in the source database are automatically migrated, and based on the source database information, SQL statements are extracted to determine multiple original SQL statements corresponding to the source database. Based on the target migration database information, the corresponding current statement rule information is determined, and rule matching checks are performed on the multiple original SQL statements according to the current statement rule information to identify multiple risky SQL statements and generate a migration compatibility assessment set. The migration compatibility evaluation set is used to generate a migration compatibility optimization reference file, and the database migration between the source database and the target migration database is realized based on the migration compatibility optimization reference file. Based on the current statement rule information, rule matching checks are performed on the multiple original SQL statements to identify multiple risky SQL statements, thereby generating a migration compatibility assessment set, specifically including: The multiple original SQL statements are parsed using a preset syntax analyzer to extract the original statement information of each original SQL statement. Based on the current statement rule information, the original statement information of each SQL statement is matched and checked to identify multiple risky SQL statements and determine the risk rule corresponding to each risky SQL statement; The risk level of each risky SQL statement is determined by the risk rules corresponding to each risky SQL statement and the pre-set risk level information. Based on the multiple risky SQL statements, the risk rules corresponding to each risky SQL statement, and the risk level corresponding to each risky SQL statement, the migration compatibility assessment set is generated. Using the aforementioned migration compatibility evaluation set, a migration compatibility optimization reference file is generated, specifically including: Identify multiple risky SQL statements in the migration compatibility assessment set and the risk rules corresponding to each risky SQL statement; Based on the risk rules corresponding to each risky SQL statement and the current statement rule information, generate a suggested SQL statement corresponding to the risky SQL statement; Generate a migration compatibility optimization reference file using several of the suggested SQL statements.
2. The database migration method for heterogeneous databases according to claim 1, characterized in that, Based on the database migration requirements, the data table structure and business data in the source database will be automatically migrated, specifically including: Based on the source database information in the database migration requirement information, a corresponding database driver is matched to establish a connection with the source database based on the database driver. By connecting to the source database, the objects in the source database are traversed to determine the metadata of each object, so as to construct a source database profile corresponding to the source database. Based on the source database profile, the data table structure is extracted to determine the DDL statement corresponding to the data table structure. The DDL statement is then executed in the pre-built target migration database to create a data table structure identical to that of the source database, thereby achieving automatic migration of the data table structure. Obtain the current business information from the database migration requirement information, and determine the business data migration time information based on the current business scenario information, wherein the business data migration time information includes at least one migration time node and the migration time window corresponding to the migration time node; Based on the business data migration time information, the migration of full data and incremental data is carried out respectively.
3. A database migration method for heterogeneous databases according to claim 2, characterized in that, Based on the current business scenario information, the business data migration time information is determined, specifically including: Based on the historical business peak information and historical user activity time information in the current business scenario information, at least one reference continuous time interval is determined. Collect historical load data from business systems to determine multiple historical load metrics. The system load of the business system is analyzed by using the multiple historical load index information to determine the periodic load change information of the business system. The periodic load change information includes multiple consecutive time intervals of low load corresponding to low load and multiple time intervals of high load corresponding to high load. Obtain the data volume information to be migrated in the source database, and determine the reference migration time corresponding to the source database based on the data volume to be migrated and the reference load information of the business system; Based on the periodic load change information, at least one load trough interval is determined by taking the intersection of the at least one reference continuous time interval and the trough continuous time interval. The business data migration time information is determined by the reference migration duration and the at least one load trough interval.
4. A database migration method for heterogeneous databases according to claim 2, characterized in that, Based on the business data migration time information, the migration of full data and incremental data is performed separately, specifically including: Obtain a full data snapshot from the source database and perform a full data migration of the business data; Obtain the binary operation file of the source database after the migration time node; The binary operation file is parsed to extract multiple DML operation statements located after the migration time node; The multiple DML operation statements are replayed in the target migration database to synchronize incremental data after the migration time point.
5. A database migration method for heterogeneous databases according to claim 1, characterized in that, Based on the source database information, SQL statements are extracted to determine multiple original SQL statements corresponding to the source database, specifically including: Based on the source database information, the source project corresponding to the source database is determined, and a scan is performed on the source project to obtain the configuration file of the framework corresponding to the source database; Key nodes are extracted from the configuration file, and multiple original SQL statements corresponding to the source database are extracted using a pre-set regular expression parsing method.
6. A database migration method for heterogeneous databases according to claim 1, characterized in that, Based on the target migration database information, the corresponding current statement rule information is determined, specifically including: Obtain the current database version information corresponding to the target migration database from the target migration database information; By matching the database file of the target migration database with the execution rules of the initial SQL statement corresponding to the target migration database, the corresponding initial SQL statement checking rules are determined. Based on the current database version information, determine the new SQL statement checking rules, and input the new SQL statement checking rules in a custom way to determine the corresponding database restriction rules for the target migration database; Obtain the current business information corresponding to the target migration database from the target migration database information, and customize the business restriction rules based on the current business information to determine the business definition rules; The current statement rule information is determined using the database restriction rules and the business definition rules.
7. A database migration device for heterogeneous databases, characterized in that, The device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method as described in any one of claims 1-6.
8. A non-volatile computer storage medium storing computer-executable instructions, characterized in that, The computer-executable instructions are configured to perform the method as described in any one of claims 1-6.
Citation Information
Patent Citations
Database migration evaluation method and device, storage medium and computer equipment
CN111258989A
Data migration method and device, storage medium and electronic equipment
CN115328891A