Data table migration method and device, equipment and medium

By automating the acquisition and parsing of database information, verifying and renaming data tables, the problem of low efficiency in traditional database migration is solved, achieving efficient and accurate data table migration.

CN120910023APending Publication Date: 2025-11-07CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511057796.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-28
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

Traditional database migration methods rely on manual operations, resulting in low migration efficiency and a high risk of errors, especially in the financial and healthcare industries, which affects project progress and system quality.

Method used

By automating the acquisition of original database information, parsing configuration files, verifying the existence and structure of data tables, renaming and performing compatibility processing, and finally migrating data tables in the target database, human error is reduced.

Benefits of technology

It improves the efficiency of data table migration in the database, ensures the accuracy and consistency of the migration process, and avoids migration failures caused by human error.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120910023A_ABST
    Figure CN120910023A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of cloud storage, is suitable for the financial field and the medical field, and discloses a data table migration method, device, equipment and medium, and the method comprises the following steps: obtaining the name of an original database, a connection character string and a configuration file of a to-be-migrated data table, and analyzing the configuration file of the to-be-migrated data table to obtain a data table to be migrated; obtaining a table name and a table owner of the to-be-migrated data table; connecting the original database according to the connection character string of the original database, generating a table existence verification statement through the table name and the table owner of the to-be-migrated data table, and verifying the validity of the to-be-migrated data table according to the generated table existence verification statement; renaming the to-be-migrated data table in the target database according to a preset naming rule and performing compatibility processing; the migration instruction of the data table is generated in the target database, and the compatible data table to be migrated is migrated into the target database according to the generated migration instruction, so that the migration efficiency of the data table is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of cloud storage, and is suitable for the financial field and the medical field, and in particular relates to a data table migration method, device, equipment and medium. BACKGROUND

[0002] In the project development process, in order to upgrade the system or reduce the operation and maintenance cost, it is often necessary to migrate the data table in the database. In this process, the developer usually needs to manually arrange the related information of the data table in the database, and copy the converted information to the target database. Especially in the financial industry and the medical industry, this process is particularly important. For example, in the sales scene of complex products such as financial investment insurance and annuity insurance, the complete migration of the data table is crucial to ensure the accuracy of customer information, transaction records and policy data. In the medical scene, with the popularity of online health insurance, million medical insurance and other products, insurance companies are facing the processing needs of massive customer data and high concurrency claims, and the stable migration of the database table is directly related to the claims efficiency and customer experience.

[0003] However, the traditional database migration method mainly relies on manual operation, and the developer needs to manually arrange the definition, constraint, index and other structure information of each data table to complete the migration work. This process is complex and tedious, and is prone to migration failure due to human error or operation error, thereby affecting the project progress and system quality. Therefore, in large-scale data table migration, the method of relying on manual arrangement of migration table information is not only inefficient, but also has a high risk of error.

[0004] Therefore, how to improve the migration efficiency of the data table in the database is a technical problem to be solved. SUMMARY

[0005] The present application provides a data table migration method, device, equipment and medium to solve the technical problem of how to improve the migration efficiency of the data table in the database.

[0006] In a first aspect, the present application provides a data table migration method, comprising:

[0007] Obtaining the name of the original database, the connection string and the configuration file of the data table to be migrated, and parsing the configuration file of the data table to be migrated to obtain the table name and table owner of the data table to be migrated;

[0008] According to the connection string of the original database, the original database is connected, a table existence verification statement is generated through the table name and table owner of the data table to be migrated, and the validity of the data table to be migrated is verified according to the generated table existence verification statement;

[0009] extract structured information of the to-be-migrated data table that passes the validity verification, wherein the structured information of the to-be-migrated data table at least includes table structure, table synonym and table index of the to-be-migrated data table;

[0010] rename the to-be-migrated data table in the target database according to a preset naming rule, and perform compatibility processing on the renamed to-be-migrated data table based on the structured information of the to-be-migrated data table;

[0011] generate a migration instruction of the data table in the target database, and migrate the compatibility-processed to-be-migrated data table to the target database according to the generated migration instruction.

[0012] In a second aspect, the present application provides a data table migration device, comprising:

[0013] The obtaining module is configured to obtain a name and a connection string of the original database and a configuration file of the to-be-migrated data table, and parse the configuration file of the to-be-migrated data table to obtain a table name and a table owner of the to-be-migrated data table.

[0014] The verifying module is configured to connect the original database according to the connection string of the original database, generate a table existence verification statement through the table name and the table owner of the to-be-migrated data table, and verify the validity of the to-be-migrated data table according to the generated table existence verification statement.

[0015] The extracting module is configured to extract structured information of the to-be-migrated data table that passes the validity verification, wherein the structured information of the to-be-migrated data table at least includes table structure, table synonym and table index of the to-be-migrated data table.

[0016] The processing module is configured to rename the to-be-migrated data table in the target database according to a preset naming rule, and perform compatibility processing on the renamed to-be-migrated data table based on the structured information of the to-be-migrated data table.

[0017] The migration module is configured to generate a migration instruction of the data table in the target database, and migrate the compatibility-processed to-be-migrated data table to the target database according to the generated migration instruction.

[0018] In a third aspect, the present application provides a computer 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 above-mentioned data table migration method when executing the computer program.

[0019] In a fourth aspect, the present application provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program implements the steps of the above-mentioned data table migration method when executed by a processor.

[0020] The aforementioned data table migration method, apparatus, device, and medium, in their implemented scheme, allows the client to obtain the name of the original database, the connection string, and the configuration file of the data table to be migrated. The configuration file is then parsed to obtain the table name and owner. The client connects to the original database using the connection string, generates a table existence verification statement based on the table name and owner, and verifies the validity of the data table to be migrated. The structured information of the data table that passes the validity verification is extracted. This structured information includes at least the table structure, table synonyms, and table indexes. The data table to be migrated is renamed in the target database according to a preset naming rule, and compatibility processing is performed on the renamed data table based on its structured information. Finally, a migration instruction is generated in the target database, and the compatible data table is migrated to the target database according to the generated migration instruction. In this invention, when migrating data tables, the original database name, connection string, and configuration file of the data table to be migrated can be automatically obtained. The table name and table owner information of the data table in the configuration file are parsed, and the data table to be migrated is automatically identified by the table name and table owner information. This effectively reduces the number of steps in data table migration, avoids errors caused by manual operation, and improves the migration efficiency of data tables in the database. Attached Figure Description

[0021] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 This is a schematic diagram of an application environment for a data table migration method according to an embodiment of the present invention;

[0023] Figure 2 This is a flowchart illustrating a data table migration method according to an embodiment of the present invention;

[0024] Figure 3 yes Figure 2 A schematic diagram of a specific implementation method for step S10;

[0025] Figure 4 yes Figure 2 A schematic diagram of a specific implementation method for step S20;

[0026] Figure 5 yes Figure 2 A schematic diagram of a specific implementation method for step S30;

[0027] Figure 6 is Figure 2 a specific implementation flowchart of step S40 in the method;

[0028] Figure 7 is a structural schematic diagram of a data table migration device in an embodiment of the present application;

[0029] Figure 8 is a structural schematic diagram of a computer device in an embodiment of the present application;

[0030] Figure 9 is another structural schematic diagram of a computer device in an embodiment of the present application. DETAILED DESCRIPTION

[0031] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.

[0032] The data table migration method provided by the embodiments of the present application can be applied in an application environment such as Figure 1 Figure 1 ​FIG. 1 is a schematic diagram of an application environment of a data table migration method according to an embodiment of the present application; wherein a client communicates with a server through a network. The server can obtain a name of an original database, a connection string, and a configuration file of a data table to be migrated through the client, parse the configuration file of the data table to be migrated, and obtain a table name and a table owner of the data table to be migrated. The server connects the original database according to the connection string of the original database, generates a table existence verification statement according to the table name and the table owner of the data table to be migrated, and verifies validity of the data table to be migrated according to the generated table existence verification statement. The server extracts structured information of the data table to be migrated that passes the validity verification, wherein the structured information of the data table to be migrated at least includes a table structure, a table synonym, and a table index of the data table to be migrated. The server renames the data table to be migrated in a target database according to a preset naming rule, and performs compatibility processing on the renamed data table to be migrated based on the structured information of the data table to be migrated. The server generates a migration instruction of the data table in the target database, and migrates the compatibility-processed data table to be migrated to the target database according to the generated migration instruction. In the present application, when the data table is migrated, the original database name, the connection string, and the configuration file of the data table to be migrated can be automatically obtained, and the table name and the table owner information of the data table in the configuration file can be parsed. The data table to be migrated can be automatically identified through the table name and the table owner information, the steps of the data table migration are effectively reduced, the errors of manual operation are avoided, and the migration efficiency of the data table in the database is improved. The present application will be described in detail below through specific embodiments.

[0033] Referring to FIG. 1, Figure 2 Figure 2 FIG. 2 is a schematic diagram of a flow of a data table migration method according to an embodiment of the present application, which specifically includes the following steps:

[0034] S10: obtaining a name of an original database, a connection string, and a configuration file of a data table to be migrated, and parsing the configuration file of the data table to be migrated to obtain a table name and a table owner of the data table to be migrated. In the present embodiment, the database connection information and the configuration file of the data table to be migrated are automatically extracted, and manual operation is reduced. The table name and the owner of the data table are obtained by parsing the configuration file, the data table to be migrated can be clearly identified, the information of different data tables is avoided to be confused, and the accuracy of subsequent migration operations is ensured. Specifically, as shown in Figure 3 Figure 3 FIG. 3 is a schematic diagram of a specific implementation flow of step S10, which specifically includes the following steps S11-S13:

[0035] ​​S11: read the configuration file of the to-be-migrated data table, wherein the configuration file contains identification information of at least one to-be-migrated data table. Specifically, in the embodiment of the present application, the information of the to-be-migrated data table is centrally managed through the configuration file, which can support batch reading of the identification information of multiple tables and improve the efficiency of data table migration. For example, in a financial scenario, when an insurance company migrates customer policy table, product configuration table and other data tables, all to-be-migrated data tables can be selected through the configuration file, and the migration task can be quickly constructed. In a medical scenario, a medical insurance platform needs to migrate hospitalization record table, drug directory table, online consultation record table and other information, and the to-be-migrated data tables can be specified in batches through the configuration file, so that unified operation can be performed on the to-be-migrated medical data.

[0036] S12: parse the identification information in the configuration file of the to-be-migrated data table to obtain the table name and table owner of the to-be-migrated data table. Specifically, in the embodiment of the present application, the table name and table owner of each data table can be quickly extracted through parsing operation, which can provide basic data for subsequent database connection, verification and migration operation. For example, in a financial scenario, in a bank system with multi-department cooperation, different tables are managed by different table owners, and through automatic parsing of the owner information, cross-owner operation errors can be avoided.

[0037] S13: character legality check is performed on the table name and table owner of the to-be-migrated data table, and the table name and table owner of the to-be-migrated data table that do not meet the standard are filtered out. Specifically, in the embodiment of the present application, through the character legality check, it can be ensured that the migration operation is only performed on the data table with legal naming, and the execution failure of the migration script caused by special characters, spaces, reserved words and the like can be avoided. The data table that does not meet the standard is filtered out to prevent syntax errors or logical confusion after migration to the target database. For example, in a bank system, there may be tables containing Chinese symbols in the old system, which can be automatically excluded after verification, so that errors can be avoided when the data table is migrated to the target database.

[0038] S20: connect the original database according to the connection string of the original database, generate a table existence verification statement according to the table name and table owner of the to-be-migrated data table, and verify the validity of the to-be-migrated data table according to the generated table existence verification statement. In the embodiment of the present application, by verifying whether the to-be-migrated data table exists, migration failure caused by problems such as non-existent table, damaged or unmatched table structure can be avoided, and smooth migration operation can be ensured. Specifically, as shown in Figure 4 Figure 4 is a specific implementation flowchart of step S20, specifically comprising steps S21-S23:

[0039] ​S21: generating a verification statement for querying whether the to-be-migrated data table exists based on the table structure features of the original database. Specifically, in the embodiment of the present application, the verification statement in the corresponding syntax format can be generated according to the table structure features of different databases, so as to realize the compatibility of multiple databases. The dynamic generation mechanism of the verification statement can make the data table migration process more automatic and modular.

[0040] S22: establishing a connection between the original database and the to-be-migrated data table according to the connection string of the original database, and executing the verification statement for querying whether the to-be-migrated data table exists in the established connection. Specifically, in the embodiment of the present application, the connection is dynamically established through the connection string, so as to ensure that the database is accessible before migration, and to discover connection configuration errors or database failure problems in time. The verification statement is executed in the connection, so as to directly determine whether the table exists, and to quickly discover the table missing problem before the migration operation, thereby avoiding invalid operations and script errors. For example, a certain financial group needs to migrate the customer transaction data of multiple provincial branches every day, and the original database of each provincial branch can be automatically connected and verified in the batch processing process, so as to avoid data discontinuity caused by omission or connection errors.

[0041] S23: if the to-be-migrated data table exists in the original database, it is determined that the to-be-migrated data table is valid, otherwise, it is determined that the to-be-migrated data table is invalid. By verifying the invalid or incorrectly configured table name, the execution exception caused by the non-existent table can be prevented. For example, in the process of data migration of a bank system, some tables have been abandoned but are still in the configuration. By verifying the existence of the table, the invalid table can be automatically identified, and only the core data tables such as customer assets and transaction flow are migrated.

[0042] S30: extracting the structured information of the to-be-migrated data table whose validity verification is passed, wherein the structured information of the to-be-migrated data table at least includes the table structure, the table synonym and the table index of the to-be-migrated data table. In the embodiment of the present application, detailed structure information is obtained, so that the target database can make necessary adjustments according to the information, ensure that the data table in the target database is compatible with the original database, and avoid compatibility problems after migration. Specifically, as shown in Figure 5 , Figure 5 is a specific implementation flowchart of step S30, specifically including steps S31-S34:

[0043] S31: Extract field information of the to-be-migrated data table, wherein the field information of the to-be-migrated data table at least includes a field name, a data type, a length, a constraint rule and a default value. Specifically, in the embodiment of the present application, the character information such as the field name, the data type, the length, the constraint rule and the default value of the to-be-migrated data table is extracted, so that the structure of the target database table can be consistent with that of the original table, and the problem of mismatching or type error after migration can be avoided. For example, in the process of data migration of a bank system, the fields of a financial transaction table are integer type, floating point type or date type, and it is necessary to ensure that the field information of the to-be-migrated data table is consistent with that of the target system, so as to avoid data formatting error, which leads to billing error or query failure.

[0044] S32: Extract synonym information related to the to-be-migrated data table from a synonym metadata table of the original database, and associate the extracted synonym information with the to-be-migrated data table. Specifically, in the embodiment of the present application, the synonym in the database is usually an alias or a reference of the data table, and if the synonym is not processed during migration, the system after migration may not be able to correctly identify or reference the data table. For example, in a financial system, a customer account information table may be accessed by multiple modules through synonyms, and if these synonyms are not processed during migration, the target database will cause queries that rely on synonyms, which seriously affects data access and business processing.

[0045] S33: Query index metadata in the original database to generate table index information of the to-be-migrated data table. Specifically, in the embodiment of the present application, the index metadata in the original database is extracted, which can help to migrate the original index structure to the target database and retain query performance. For example, in the process of data migration of a bank system, retaining these indexes during migration can ensure that the query of user transaction history can still be quickly responded, and the performance problem after migration can be avoided.

[0046] S34: Integrate the field information of the to-be-migrated data table, the associated synonym information and the table index information into structured information of the to-be-migrated data table. Specifically, in the embodiment of the present application, after the field information, the synonym information and the index information are integrated into structured information, the target database can be provided with complete table building structure, and it is ensured that all elements can be correctly migrated and rebuilt. For example, when a financial data warehouse is constructed, after the field information, the synonym and the index are integrated into structured information, the structured information can be directly used to create a new data warehouse table, and the efficiency of data table migration is improved.

[0047] S40: rename the to-be-migrated data table in the target database according to a preset naming rule, and perform compatibility processing on the renamed to-be-migrated data table based on the structured information of the to-be-migrated data table. In the embodiment of the present application, the to-be-migrated data table is renamed according to the preset naming rule, so that consistent naming specifications can be maintained in the target database, which not only improves the maintainability of the database, but also facilitates the later management and query. The compatibility processing on the renamed data table can ensure that the data table can normally operate in the new database environment even if the naming of the data table changes. Specifically, as shown in Figure 6 Figure 6 is a specific implementation flowchart of step S40, specifically including steps S41-S43 as follows:

[0048] S41: rename the to-be-migrated data table according to the table name of the to-be-migrated data table and the naming specification of the target database. Specifically, in the embodiment of the present application, different databases can have different naming rules, and renaming the data table can ensure that the naming rules of the target database are followed, avoiding errors caused by non-standard naming.

[0049] S42: check whether there is a naming conflict in the to-be-migrated data table, and if there is a conflict, add a unique identifier to the renamed to-be-migrated data table. Specifically, in the embodiment of the present application, there can be a data table with the same name in the target database during the migration process. By adding a unique identifier to the conflicting table, it can be ensured that each table after migration has a unique identifier, avoiding the problem of duplicate names in the target database.

[0050] S43: perform compatibility verification on the structured information of the to-be-migrated data table and the target database, and perform format conversion on the data table incompatible with the target database. Specifically, in the embodiment of the present application, the structure of the data table can be different between different database systems. Compatibility verification can ensure that the data type, field length and other constraint conditions of the data table in the original database are consistent with those in the target database during the data table migration process, thereby avoiding errors such as data loss or type mismatch after migration. For example, in the financial scenario, when the data is migrated from the old database to the new system in the bank system, there can be a problem of incompatible data type or field length. Through compatibility verification and format conversion, it can be ensured that each field in the data table can be correctly migrated.

[0051] S50: generate a migration instruction of the data table in the target database, and migrate the compatibility-processed to-be-migrated data table to the target database according to the generated migration instruction. In the embodiment of the present application, the generated data table migration instruction can efficiently perform the migration operation, while ensuring the accurate migration of the structure and data of the data table, avoiding the situation of data loss, duplication or inconsistency during the migration process. ​

[0052] S51: generating a table creation statement of the target database according to the structured information of the compatible processed to-be-migrated data table. Specifically, in the embodiment of the present application, the table creation statement of the target database is automatically generated based on the compatible processed structured information, which reduces the errors of manually writing the table creation statement and improves the table creation efficiency. For example, when migrating the transaction data table of the financial system from the old database to the new database, by generating the table creation statement compatible with the target database, it can be ensured that the structure of the data table is correctly created in the target database, and migration failure caused by the table creation statement not meeting the specification can be avoided.

[0053] S52: converting the data in the to-be-migrated data table into a compatible format of the target database according to the preset data table migration rule, and generating a data table migration instruction. Specifically, in the embodiment of the present application, different data types or data formats may be used in the original database and the target database during the data table migration process. By converting the data into a format compatible with the target database, data loss or errors caused by inconsistent formats can be avoided.

[0054] S53: executing the table creation statement and the data migration instruction of the target database in the target database, if the execution is successful, returning a state of successful data table migration; if the execution fails, generating log information of data table migration error. Specifically, in the embodiment of the present application, after executing the table creation statement and the data migration instruction in the target database, the execution result feedback can be obtained immediately. If the migration is successful, it can be confirmed that the data table has been correctly migrated; if it fails, the error can be captured in time and logs can be generated for subsequent troubleshooting. For example, in the financial scenario, when migrating the transaction data of the bank system from the old database to the new database, if the migration instruction execution fails, the system will generate error information according to the log, indicating the specific reason, and the developer can quickly repair the problem and re-migrate according to the error log.

[0055] In an embodiment of the present application, after the compatible processed to-be-migrated data table is migrated into the target database according to the generated migration instruction, the method further comprises: performing consistency checking on the number of rows and the value of the key field of the compatible processed to-be-migrated data table in the target database; releasing the temporary storage resource occupied during the execution of the data table migration, and generating a data table migration report including the migration time, data volume and checking result. Specifically, in the embodiment of the present application, a large amount of storage resource may be temporarily occupied to save the intermediate data during the migration process during the data table migration process. After the migration is completed, timely releasing the temporary storage resource can ensure the effective use of system resources and prevent the waste of storage space. For example, the transaction data migration in a financial system usually involves a large number of transaction records and strict compliance requirements. The generated migration report can record the migration time, data volume and checking result, which can help the audit team to understand whether the migration process meets the compliance requirements. If the migration report shows that the data volume is inconsistent with the expected or the checking fails, the auditor can track and handle the problem according to the report. For example, after the bank account information table is migrated, the system generates a migration report showing that the migration time is 30 minutes, the migration data volume is 500,000, and the checking result shows that the number of rows and the value of the key field are consistent. If the report shows that the data is inconsistent, the administrator can further investigate according to the report.

[0056] It can be seen that in the above scheme, when the data table is migrated, the configuration file of the original database name, the connection string and the to-be-migrated data table can be automatically obtained, and the table name and the table owner information of the data table in the configuration file are parsed. The data table to be migrated is automatically identified through the table name and the table owner information, which effectively reduces the steps of data table migration, avoids the mistakes of manual operation, and improves the migration efficiency of the data table in the database.

[0057] It should be understood that the size of the serial number of each step in the above embodiment does not mean the order of execution. The execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.

[0058] In an embodiment, a data table migration device is provided, which corresponds to the data table migration method in the above embodiment. As shown in FIG. 7, Figure 7 Figure 7 is a structural schematic diagram of the data table migration device in an embodiment of the present application. The data table migration device comprises an acquisition module 71, a verification module 72, an extraction module 73, a processing module 74 and a migration module 75. The functions of each module are described in detail as follows:

[0059] The acquisition module is configured to acquire the name of the original database, the connection string and the configuration file of the to-be-migrated data table, and parse the configuration file of the to-be-migrated data table to obtain the table name and the table owner of the to-be-migrated data table.​

[0060] a verification module, configured to connect the original database according to a connection string of the original database, generate a table existence verification statement according to a table name and a table owner of the to-be-migrated data table, and verify validity of the to-be-migrated data table according to the generated table existence verification statement;

[0061] an extraction module, configured to extract structured information of the to-be-migrated data table that passes the validity verification, wherein the structured information of the to-be-migrated data table at least includes a table structure, a table synonym, and a table index of the to-be-migrated data table;

[0062] a processing module, configured to rename the to-be-migrated data table in the target database according to a preset naming rule, and perform compatibility processing on the renamed to-be-migrated data table based on the structured information of the to-be-migrated data table;

[0063] a migration module, configured to generate a migration instruction of the data table in the target database, and migrate the to-be-migrated data table that has undergone the compatibility processing to the target database according to the generated migration instruction.

[0064] In an embodiment, the obtaining module 71 is specifically configured to:

[0065] read a configuration file of the to-be-migrated data table, wherein the configuration file contains identification information of at least one to-be-migrated data table;

[0066] parse the identification information in the configuration file of the to-be-migrated data table to obtain a table name and a table owner of the to-be-migrated data table;

[0067] perform character legality verification on the table name and the table owner of the to-be-migrated data table, and filter out non-standardly named table names and table owners in the to-be-migrated data table.

[0068] In an embodiment, the verification module 72 is specifically configured to:

[0069] generate a verification statement for querying whether the to-be-migrated data table exists based on a table structure feature of the original database;

[0070] establish a connection between the original database and the to-be-migrated data table according to a connection string of the original database, and execute the verification statement for querying whether the to-be-migrated data table exists in the established connection;

[0071] if the to-be-migrated data table exists in the original database, it is determined that the to-be-migrated data table is valid, otherwise, it is determined that the to-be-migrated data table is invalid.

[0072] In an embodiment, the extraction module 73 is specifically configured to:

[0073] extract field information of the to-be-migrated data table, wherein the field information of the to-be-migrated data table at least includes a field name, a data type, a length, a constraint rule, and a default value;

[0074] extract synonym information related to the to-be-migrated data table from a synonym metadata table of the original database, and associate the extracted synonym information with the to-be-migrated data table;

[0075] query index metadata in the original database to generate table index information of the to-be-migrated data table;

[0076] integrate the field information of the to-be-migrated data table, the associated synonym information, and the table index information into structured information of the to-be-migrated data table.

[0077] In an embodiment, the processing module 74 is specifically configured to:

[0078] rename the to-be-migrated data table according to a table name of the to-be-migrated data table and a naming specification of the target database;

[0079] check whether a naming conflict exists in the to-be-migrated data table, and add a unique identifier to the to-be-migrated data table after renaming if a conflict exists;

[0080] perform compatibility verification on the structured information of the to-be-migrated data table and the target database, and perform format conversion on a data table incompatible with the target database.

[0081] In an embodiment, the migration module 75 is specifically configured to:

[0082] generate a table creation statement of the target database according to the structured information of the to-be-migrated data table after compatibility processing;

[0083] convert data in the to-be-migrated data table into a compatible format of the target database according to a preset data table migration rule, and generate a data table migration instruction;

[0084] execute the table creation statement and the data migration instruction of the target database in the target database, and return a state of successful data table migration if the execution is successful;

[0085] generate log information of data table migration error if the execution fails.

[0086] In an embodiment, the data table migration apparatus is further configured to:

[0087] perform consistency verification on a number of rows and key field values of the to-be-migrated data table after compatibility processing in the target database;

[0088] Release the temporary storage resource occupied when performing data table migration, and generate a data table migration report including migration time, data volume and check result.

[0089] The application provides a data table migration device, which can automatically obtain a configuration file of an original database name, a connection string and a data table to be migrated when performing data table migration, parse table name and table owner information of the data table in the configuration file, automatically identify the data table to be migrated through the table name and the table owner information, effectively reduce the steps of data table migration, avoid the mistakes of manual operation, and improve the migration efficiency of the data table in the database.

[0090] The specific limitation of the data table migration device can be referred to the limitation of the data table migration method in the above, and will not be described here. Each module in the data table migration device can be realized by software, hardware and a combination thereof in whole or in part. The above modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to the above modules.

[0091] In one embodiment, a computer device is provided, which can be a server, and an internal structure diagram thereof can be as shown in Figure 8 Figure 8 is a structural schematic diagram of the computer device in one embodiment of the application. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. The computer program is executed by the processor to implement the functions or steps of the server side of the data table migration method.

[0092] In one embodiment, a computer device is provided, which can be a client, and an internal structure diagram thereof can be as shown in Figure 9 Figure 9 ​​is another structural schematic diagram of a computer device in an embodiment of the present application. The computer device comprises a processor, a memory, a network interface, a display screen and an input device connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The network interface of the computer device is configured to communicate with an external server through a network connection. The computer program, when executed by the processor, implements the functions or steps of a client side of a data table migration method.

[0093] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the following steps when executing the computer program:

[0094] obtaining a name, a connection string of an original database, and a configuration file of a data table to be migrated, and parsing the configuration file of the data table to be migrated to obtain a table name and a table owner of the data table to be migrated;

[0095] connecting the original database according to the connection string of the original database, generating a table existence verification statement according to the table name and the table owner of the data table to be migrated, and verifying validity of the data table to be migrated according to the generated table existence verification statement;

[0096] extracting structured information of the data table to be migrated that passes the validity verification, wherein the structured information of the data table to be migrated at least comprises a table structure, a table synonym, and a table index of the data table to be migrated;

[0097] renaming the data table to be migrated in a target database according to a preset naming rule, and performing compatibility processing on the renamed data table to be migrated based on the structured information of the data table to be migrated;

[0098] generating a migration instruction of the data table in the target database, and migrating the compatibility-processed data table to be migrated to the target database according to the generated migration instruction.

[0099] In one embodiment, a computer readable storage medium is provided, which stores a computer program, the computer program being executable by a processor to implement the following steps:

[0100] obtaining a name, a connection string of an original database, and a configuration file of a data table to be migrated, and parsing the configuration file of the data table to be migrated to obtain a table name and a table owner of the data table to be migrated;

[0101] Connect the original database according to the connection string of the original database, generate a table existence verification statement according to the table name and table owner of the to-be-migrated data table, and verify the validity of the to-be-migrated data table according to the generated table existence verification statement;

[0102] Extract the structured information of the to-be-migrated data table whose validity verification is passed, wherein the structured information of the to-be-migrated data table at least includes the table structure, the table synonym and the table index of the to-be-migrated data table;

[0103] Renaming the to-be-migrated data table in the target database according to the preset naming rule, and performing compatibility processing on the renamed to-be-migrated data table based on the structured information of the to-be-migrated data table;

[0104] Generating a migration instruction of the data table in the target database, and migrating the compatibility-processed to-be-migrated data table to the target database according to the generated migration instruction.

[0105] It should be noted that the functions or steps that the above computer readable storage medium or computer device can implement can correspond to the related descriptions of the server side and the client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.

[0106] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. Any reference to memory, storage, database or other medium used in the embodiments provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0107] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.

[0108] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A method of migrating a data table, characterized by, The application relates to a method for migrating a data table from an original database to a target database. The method comprises the following steps: acquiring a configuration file of the original database, a connection string and a data table to be migrated, and parsing the configuration file of the data table to be migrated to obtain a table name and a table owner of the data table to be migrated; The method comprises the following steps: connecting the original database according to the connection string of the original database, generating a table existence verification statement through the table name and the table owner of the data table to be migrated, and verifying the validity of the data table to be migrated according to the generated table existence verification statement; The method comprises the following steps: extracting structured information of the data table to be migrated which passes the validity verification, wherein the structured information of the data table to be migrated at least comprises a table structure, a table synonym and a table index of the data table to be migrated; The method comprises the following steps: renaming the data table to be migrated in the target database according to a preset naming rule, and performing compatibility processing on the renamed data table to be migrated based on the structured information of the data table to be migrated; The method comprises the following steps: generating a migration instruction of the data table in the target database, and migrating the compatibility-processed data table to be migrated to the target database according to the generated migration instruction.

2. The data table migration method of claim 1, wherein, The method comprises the following steps: reading the configuration file of the data table to be migrated, wherein the configuration file contains identification information of at least one data table to be migrated; The method comprises the following steps: parsing the identification information in the configuration file of the data table to be migrated to obtain a table name and a table owner of the data table to be migrated; The method comprises the following steps: performing character legality verification on the table name and the table owner of the data table to be migrated, and filtering out non-standardly named table names and table owners in the data table to be migrated. The method comprises the following steps: generating a verification statement for querying whether the data table to be migrated exists based on the table structure characteristics of the original database; 3. The data table migration method of claim 1, wherein, The method comprises the following steps: establishing a connection between the original database and the data table to be migrated according to the connection string of the original database, and executing the verification statement for querying whether the data table to be migrated exists in the established connection; If the data table to be migrated exists in the original database, it is determined that the data table to be migrated is valid, otherwise, it is determined that the data table to be migrated is invalid. The method comprises the following steps: extracting field information of the data table to be migrated, wherein the field information of the data table to be migrated at least comprises a field name, a data type, a length, a constraint rule and a default value; The method comprises the following steps: extracting synonym information related to the data table to be migrated from a synonym metadata table of the original database, and associating the extracted synonym information with the data table to be migrated; 4. The data table migration method of claim 1, wherein, The method comprises the following steps: querying index metadata in the original database to generate table index information of the data table to be migrated; ​ ​ ​ Integrate the field information of the to-be-migrated data table, the associated synonym information and the table index information into structured information of the to-be-migrated data table.

5. The data table migration method of claim 1, wherein, The renaming of the to-be-migrated data table in the target database according to the preset naming rule, and the compatibility processing of the renamed to-be-migrated data table based on the structured information of the to-be-migrated data table, include: Renaming the to-be-migrated data table according to the table name of the to-be-migrated data table and the naming specification of the target database; Checking whether there is a naming conflict in the to-be-migrated data table, and if there is a conflict, adding a unique identifier in the renamed to-be-migrated data table; Compatibility verification of the structured information of the to-be-migrated data table and the target database, and format conversion of the incompatible data table in the target database.

6. The data table migration method of claim 1, wherein, The migration instruction of the data table in the target database is generated, and the compatibility-processed to-be-migrated data table is migrated to the target database according to the generated migration instruction, including: Generating a table creation statement of the target database according to the structured information of the compatibility-processed to-be-migrated data table; According to the preset data table migration rule, the data in the to-be-migrated data table is converted into a compatible format of the target database, and a data table migration instruction is generated; Executing the table creation statement and the data migration instruction of the target database in the target database, and if the execution is successful, returning a state of successful data table migration; If the execution fails, a log information of data table migration error is generated.

7. The data table migration method of claim 1, wherein, After the compatibility-processed to-be-migrated data table is migrated to the target database according to the generated migration instruction, the method further includes: Consistency verification of the number of rows and the key field value of the compatibility-processed to-be-migrated data table in the target database; Releasing the temporary storage resources occupied during the execution of the data table migration, and generating a data table migration report including the migration time, data volume and verification result.

8. A data table migration apparatus characterized by comprising: Including: The acquisition module is configured to acquire the name, connection string and configuration file of the to-be-migrated data table of the original database, and parse the configuration file of the to-be-migrated data table to obtain the table name and table owner of the to-be-migrated data table; The verification module is configured to connect the original database according to the connection string of the original database, generate a table existence verification statement according to the table name and table owner of the to-be-migrated data table, and verify the validity of the to-be-migrated data table according to the generated table existence verification statement; The extraction module is configured to extract the structured information of the to-be-migrated data table whose validity verification is passed, wherein the structured information of the to-be-migrated data table at least includes the table structure, table synonym and table index of the to-be-migrated data table; The processing module is configured to rename the to-be-migrated data table in the target database according to the preset naming rule, and to perform compatibility processing on the renamed to-be-migrated data table based on the structured information of the to-be-migrated data table; The migration module is configured to generate a migration instruction of the data table in the target database, and to migrate the compatibility-processed to-be-migrated data table to the target database according to the generated migration instruction.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to realize the steps of the data table migration method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program, when executed by a processor, implements the steps of the data table migration method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Data migration method and system based on business object mapping and storage medium

    CN121560866A

  • A data migration method, system and storage medium based on business object mapping

    CN121560866B