Database transformation method, device, equipment, storage medium and program product
Through the automated database transformation method, the problems of low efficiency and many errors in the existing technology are solved, and efficient and reliable Oracle database domestic transformation is achieved.
Patent Information
- Application Number
- CN202310458896.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-25
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2043-04-25
AI Technical Summary
During the transformation of existing databases, there are problems such as complicated manual operations, low efficiency, large labor investment, long transformation cycle and prone to errors, especially in the financial field, Oracle databases are particularly significant.
Provide an automated database transformation method, by obtaining the environment information of the source database and the dispatch server, building a target database environment, migrating structure and data in a preset way, and rewriting code programs, including structure migration, data migration and program rewriting, and verifying each step in real time to generate version packages.
It greatly reduces manpower investment, improves transformation efficiency, ensures the reliability and quality of transformation results, reduces errors, and shortens the transformation cycle.
Smart Images

Figure CN116483806B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a database transformation method, apparatus, device, storage medium, and program product. Background Art
[0002] Currently, the country is placing increasing emphasis on network and information security. To ensure this, more and more institutions and enterprises are committed to localizing their databases. However, existing database transformation practices involve numerous complex and repetitive manual conversion operations, and post-transformation data verification and validation rely solely on manual review. This results in low transformation efficiency, high labor investment, and long transformation cycles. Furthermore, there are inevitable omissions and errors, resulting in missing data in the new database. Summary of the Invention
[0003] In light of the above issues, and to efficiently complete database transformation, the present disclosure provides a database transformation method, apparatus, device, medium, and program product. These methods can automatically and efficiently complete database transformation operations, significantly reducing the manpower required during the transformation process. These methods can be applied in the financial sector, particularly in the current financial sector, which heavily relies on Oracle databases, to accelerate the localization of Oracle databases.
[0004] According to a first aspect of the present disclosure, a database transformation method is provided, the method comprising: building environmental information of a target database based on acquired environmental information of a source database and environmental information of a scheduling server; migrating the structure of the source database to the target database according to a preset structural migration method, and verifying the structural migration result; after the structural migration verification passes, migrating the data within the structure of the source database to the target database, and verifying the data migration result; after the data migration verification passes, obtaining a code program to be rewritten on the scheduling server that interacts with the source database, rewriting the code program to be rewritten into a code program that interacts with the target database, and verifying the program rewriting result; after the program rewriting verification passes, generating a version package based on the environmental information of the target database, the structural migration information, the data migration information, and the program rewriting information.
[0005] According to an embodiment of the present disclosure, building the environment information of the target database includes: configuring the environment information of the target database according to the environment information of the source database, wherein the environment information of the source database includes a database name, user, and password.
[0006] According to an embodiment of the present disclosure, migrating the structure of a source database to a target database according to a preset structure migration method includes: dividing the structure of the source database into a direct migration part, a modified migration part, and a manual migration part according to the preset structure migration method; migrating the direct migration part to the target database; modifying the modified migration part according to preset rules, and migrating the modified modified migration part to the target database; and generating a manual migration structure list corresponding to the manual migration part.
[0007] According to an embodiment of the present disclosure, verifying the structure migration result includes: verifying at least one type of structure in the structure of the source database, wherein the structure of the source database includes tables, indexes, views, functions, and user permissions.
[0008] According to an embodiment of the present disclosure, migrating data in a source database structure to a target database includes migrating data in each table of the source database according to a preset data migration method, where the preset data migration method includes full migration or incremental migration.
[0009] According to an embodiment of the present disclosure, migrating the data in each table of the source database according to a preset data migration method includes: for each table of the source database, when the preset data migration method is incremental migration, comparing the data in the table in the source database and the target database according to the primary key of the table to obtain incremental data; and migrating the incremental data of the source database to the target database.
[0010] According to an embodiment of the present disclosure, verifying the data migration result includes: for at least one table in the source database, comparing whether the number of rows of the table in the source database is the same as that of the table in the target database; if the number of rows is the same, comparing whether the data in the table in the source database is the same as that in the table in the target database; if it is determined that the data in the table in the source database is the same as that in the table in the target database, determining that the data migration result verification has passed.
[0011] A second aspect of the present disclosure provides a database transformation device, including: an environment building module, which is used to build the environment information of the target database based on the acquired environment information of the source database and the environment information of the scheduling server; a structure migration module, which is used to migrate the structure of the source database to the target database according to a preset structure migration method; a structure migration verification module, which is used to verify the structure migration result; a data migration module, which is used to further migrate the database data after completing the migration and verification of the database structure; a data migration verification module, which is used to verify the data migration result; a program rewriting module, which is used to obtain the code program to be rewritten that interacts with the source database on the scheduling server, and rewrite the code program to be rewritten into a code program that interacts with the target database; a program rewriting verification module, which is used to verify the program rewriting result; and a version release module, which is used to package the environment information of the target database built by the environment building module, the structure migration script of the structure migration module, the data migration script of the data migration module, and the program rewritten by the program rewriting module to form a version package.
[0012] A third aspect of the present disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the above-mentioned database transformation method.
[0013] A fourth aspect of the present disclosure further provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to execute the above-mentioned database transformation method.
[0014] The fifth aspect of the present disclosure further provides a computer program product, including a computer program, which implements the above-mentioned database transformation method when executed by a processor.
[0015] The database transformation method, device, equipment, medium and program product provided by the embodiments of the present disclosure can facilitate the database transformation of big data applications, save a lot of manpower investment in the transformation process, and greatly accelerate the research and development rhythm of database transformation; eliminate most of the manual operations in the database transformation process, greatly improve the version quality of the database transformation, and enhance the efficiency of the database transformation; each module can be used independently and has extremely high scalability, and can be further combined with other solutions to derive more highly available functions and solutions; after the operation steps of structure migration, data migration and program rewriting, timely verification is carried out, which can timely discover the migration error structure or data, and rewrite the wrong code program, and timely discover errors to reduce useless work in the transformation, and also make the database transformation result of the entire solution more reliable. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above contents and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0017] Figure 1 Schematically illustrates an application scenario diagram of the database transformation method, apparatus, device, medium, and program product according to an embodiment of the present disclosure;
[0018] Figure 2 The following schematically shows a flowchart of a database transformation method according to an embodiment of the present disclosure;
[0019] Figure 3 A flowchart schematically illustrates an operation of constructing environment information of a target database based on acquired environment information of a source database and environment information of a scheduling server according to an embodiment of the present disclosure;
[0020] Figure 4 The schematic diagram shows an operation diagram of migrating the structure of a source database to a target database according to a preset structure migration method according to an embodiment of the present disclosure;
[0021] Figure 5 The following schematically shows a structural block diagram of a database transformation device according to an embodiment of the present disclosure;
[0022] Figure 6 A schematic diagram illustrating the timing diagram of the operation of each module in the automation service platform according to an embodiment of the present disclosure; and
[0023] Figure 7 A block diagram of an electronic device suitable for implementing a database transformation method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0024] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present disclosure. In the detailed description below, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0025] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise," "include," etc. used herein indicate the presence of the features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0026] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0027] When expressions such as "at least one of A, B and C, etc." are used, they should generally be interpreted in accordance with the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0028] The embodiments of the present disclosure provide a database transformation method, apparatus, device, medium, and program product. These methods can automatically and efficiently complete database transformation operations, significantly reducing the manpower required during the transformation process. These methods can be applied in the financial sector, particularly in the current financial sector, which relies heavily on Oracle databases, to accelerate the localization of Oracle databases.
[0029] Figure 1 The application scenario diagram of the database transformation method, apparatus, device, medium and program product according to the embodiments of the present disclosure is schematically shown.
[0030] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a source database 101, a target database 102, a scheduling server 103, a network 104, and a transformation platform 105. The network 104 is used as a medium for providing a communication link between the source database 101, the target database 102, the scheduling server 103, and the transformation platform 105. The network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0031] The source database 101 and the target database 102 may be, for example, an Oracle database, a DB2 database, a SQL Server database, a MySQL database, a PostgreSQL database, or an Access database. The higher the similarity between the source database 101 and the target database 102, the higher the degree of automation of the transformation and the easier it is to implement.
[0032] It should be noted that the transformation platform 105 is a platform for implementing database transformation. The database transformation method provided in the embodiments of the present disclosure can generally be executed by the transformation platform 105. Accordingly, the database transformation apparatus provided in the embodiments of the present disclosure can generally be located in the transformation platform 105. The database transformation method provided in the embodiments of the present disclosure can also be executed by a server or server cluster that is different from the transformation platform 105 and that is capable of communicating with the source database 101, the target database 102, the scheduling server 103, and / or the transformation platform 105. Accordingly, the database transformation apparatus provided in the embodiments of the present disclosure can also be located in a server or server cluster that is different from the transformation platform 105 and that is capable of communicating with the source database 101, the target database 102, the scheduling server 103, and / or the transformation platform 105.
[0033] The following will be based on Figure 1 The scene described by Figures 2 to 4 The database transformation method of the disclosed embodiment is described in detail.
[0034] Figure 2 The flowchart of the database transformation method according to the embodiment of the present disclosure is schematically shown.
[0035] like Figure 2 As shown, the database transformation method of this embodiment includes operations S210 to S250:
[0036] In operation S210, based on the acquired environment information of the source database and the environment information of the scheduling server, the environment information of the target database is constructed;
[0037] In operation S220 , the structure of the source database is migrated to the target database according to a preset structure migration method, and the structure migration result is verified;
[0038] In operation S230 , after the structure migration verification is passed, the data in the structure of the source database is migrated to the target database, and the data migration result is verified;
[0039] In operation S240, after the data migration verification is passed, the code program to be rewritten that interacts with the source database is obtained on the scheduling server, the code program to be rewritten is rewritten into a code program that interacts with the target database, and the program rewriting result is verified;
[0040] In operation S250 , after the program rewriting verification passes, a version package is generated based on the target database environment information, the structure migration information, the data migration information, and the program rewriting information.
[0041] Figure 3The flowchart schematically shows an operation of building the environment information of the target database based on the acquired environment information of the source database and the environment information of the scheduling server according to an embodiment of the present disclosure.
[0042] like Figure 3 As shown, in an embodiment of the present disclosure, the above operation S210 includes operations S311 to S316 for constructing the environment information of the target database based on the acquired environment information of the source database and the environment information of the scheduling server:
[0043] In operation S311, the source database environment information and the dispatch server environment information are obtained, where the source database environment information includes the database name, user, and password. In one embodiment of the present disclosure, the source database and dispatch server environment information is automatically obtained and confirmed by inputting the source database IP address, dispatch server IP address, and target database IP address. In another embodiment of the present disclosure, the source database and dispatch server environment information is manually input.
[0044] In operation S312 , the environment information of the target database is configured to be consistent with the environment information of the source database.
[0045] In operation S313, the target database and ODBC (Open Database Connectivity) driver installation media are automatically obtained and installed on the scheduling server, and relevant environment variables and ODBC files of the scheduling server are configured.
[0046] In operation S314, permissions are granted to the installation directory. Based on this, different users do not need to repeatedly authorize when performing database transformation operations.
[0047] In operation S315, the target database environment information is verified to be successfully established. Taking the above-mentioned database transformation method for converting an Oracle database to a MySQL database as an example, the automatic statement mysql -h (host) -u (user) -p (password) -P3306 can be input to determine whether the newly established MySQL database is successfully connected to the Oracle database and the scheduling server.
[0048] In some embodiments of the present disclosure, for information security considerations, the above operations further include operation S316: automatically deleting the relevant files downloaded and installed during the above operations in the user's home directory.
[0049] Figure 4 The diagram schematically illustrates an operation of migrating the structure of a source database to a target database according to a preset structure migration method according to an embodiment of the present disclosure.
[0050] like Figure 4As shown, in an embodiment of the present disclosure, the above operation S220 of migrating the structure of the source database to the target database according to the preset structure migration method includes:
[0051] According to the preset structural migration method, the structure of the source database is divided into three categories: direct migration part, modified migration part and manual migration part. Then, the structure of the source database is migrated to the target database according to the preset structural migration method. For the structure of the direct migration part in the source database, it is directly migrated to the target database; for the structure of the modified migration part in the source database, the modified migration part is modified according to the preset rules, and the modified migration part is migrated to the target database; for the manual migration part, a corresponding manual migration structure list is generated to facilitate the subsequent manual execution of the migration work of this part of the structure. According to the embodiment of the present disclosure, the structures of manual migration and automatic migration can be identified, and the automatic migration part can be automatically migrated to the target database, which can automatically and efficiently complete the structural migration work in the database transformation operation, and greatly reduce the manpower input in the structural migration process.
[0052] In the embodiments of the present disclosure, taking the use of the above-mentioned database transformation method to transform an Oracle database to a MySQL database as an example, the above-mentioned structure that can be automatically modified and migrated includes, for example: there is a need to change the field name, such as keywords such as CONDITION and SCHEMA, which can be used as field names in the Oracle database but not in the MySQL database. In this case, they need to be automatically modified before they can be used as field names in the MySQL database; for example, there is a need to change the field type, the field type of VARCHAR2 in the Oracle database corresponds to the field type of VARCHAR in the MySQL database.
[0053] In the embodiment of the present disclosure, after the source database and the target database are successfully connected, you can independently select the database transformation type, that is, overall migration or partial migration. The structure of the overall migration includes: tables, indexes, views, functions, and user permissions.
[0054] In the embodiment of the present disclosure, migrating the structure of the source database to the target database according to the preset structure migration method further includes:
[0055] After the structural migration is completed, a structural migration report is generated to record the migration results of each structure.
[0056] In an embodiment of the present disclosure, the operation S220 of verifying the structure migration result includes:
[0057] Verify at least one type of structure in the source database, where the source database structure includes tables, indexes, views, functions, and user permissions. By default, all types of structures are selected for comparison and verification. In some embodiments of the present disclosure, operation S220 of verifying the structure migration results further includes selecting a subcategory of the selected type of structure, such as a specific table name under a table type structure. By default, all subcategories under that type are selected for comparison and verification.
[0058] In an embodiment of the present disclosure, the operation S220 of verifying the structure migration result further includes:
[0059] After the structure comparison and verification is completed, a structure migration verification report is generated. On the one hand, the report records the error information of the failed structure migration comparison and verification, and the user can filter the error information and prioritize the modification of frequently occurring errors; on the other hand, it is also used to count the syntax conversion success rate and migration success rate of each structure. According to the embodiment of the present disclosure, by automatically comparing and verifying the structure migration results, it is possible to promptly discover the erroneous parts of the structure migration and promptly correct the mapping relationship before and after the structure migration; it is possible to conveniently count the syntax conversion success rate and migration success rate of each structure.
[0060] Data migration is a process that automatically completes the entire data migration process by simply configuring the source and target databases, provided both the source and target databases are connected. Data migration can be categorized into two types: full and incremental. A full migration involves synchronizing the existing data from the source database to the target database at once, initializing the target database's data. An incremental migration involves maintaining data consistency between the source and target databases after the full migration completes the target database's initialization, using technologies such as data comparison.
[0061] In an embodiment of the present disclosure, after the structure migration verification passes, the above operation S230 of migrating the data in the structure of the source database to the target database includes:
[0062] According to the preset data migration method, the data in each table of the source database is migrated, and the preset data migration method includes full migration or incremental migration. In some embodiments of the present disclosure, it is also possible to specify that only the data in certain tables required be migrated.
[0063] In an embodiment of the present disclosure, migrating data in each table of the source database according to a preset data migration method includes:
[0064] For each table in the source database, when the preset data migration mode is incremental migration, the data in the table in the source database and the target database are compared according to the primary key of the table to obtain incremental data; the incremental data in the source database is then migrated to the target database. According to the disclosed embodiments, by comparing the primary key of the table, the incremental data can be quickly found, ensuring that the data in the source database remains synchronized with the target database after migration.
[0065] In the disclosed embodiments, data migration progress can be viewed in real time, specifically by displaying the migration progress of each table. A data migration report is generated upon completion. For tables whose migration failed as shown in the report, you can manually modify the configuration and migrate the data for that table again.
[0066] In an embodiment of the present disclosure, the operation S230 of verifying the data migration result includes:
[0067] For at least one table in the source database, compare whether the number of rows of the table in the source database is the same as that of the table in the target database; if the number of rows is the same, compare whether the data in the table in the source database is the same as that in the target database; if it is determined that the data in the table in the source database is the same as that in the target database, determine that the data migration result verification has passed. In the embodiment of the present disclosure, verifying whether the data migration of a table is correct is carried out in two steps: rough comparison and fine comparison. First, a rough comparison is performed to compare whether the number of rows of the table in the source database is the same as that of the table in the target database; if the number of rows is the same, a fine comparison is performed to compare whether the data in the table in the source database is the same as that in the target database; and in the verification process, the inconsistency of the table data before and after the migration that may be caused by the data migration method of each table is considered. In the embodiment of the present disclosure, verifying at least one table in the source database includes: automatically selecting all tables migrated in the aforementioned data migration process for verification and manually selecting a portion of all tables migrated in the aforementioned data migration process for verification. According to the embodiment of the present disclosure, when verifying the data migration results, verification is performed through two steps: coarse comparison and fine comparison. The coarse comparison can quickly identify tables with obvious errors in data migration. When the coarse comparison is correct, the fine comparison is performed to ensure that no errors are missed. This improves the efficiency of verification while ensuring the accuracy of verification.
[0068] In an embodiment of the present disclosure, the above-mentioned operation S240 obtains the code program to be rewritten on the scheduling server that interacts with the source database, and rewrites the code program to be rewritten into a code program that interacts with the target database, including: traversing all programs that need to be rewritten stored on the scheduling server by the logged-in user, finding the code program that interacts with the source database, generating a "continuous list to be rewritten" (i.e., the program to be rewritten), and then executing the program automated rewriting task, and rewriting the program to be rewritten into a code program that interacts with the target database according to the environmental information of the source database, the environmental information of the target database, and the environmental information of the scheduling server.
[0069] In some embodiments of the present disclosure, before executing the program automation rewriting task, the program to be rewritten is backed up.
[0070] In some embodiments of the present disclosure, a program rewriting report is generated after the rewriting is completed. The report includes a list of programs to be rewritten, the rewritten content, the name of the backed-up program to be rewritten, and the directory where it is located.
[0071] In an embodiment of the present disclosure, the above operation S240 of verifying the program rewriting result includes:
[0072] Perform monotonic load testing on the rewritten program. For programs that fail verification, you can manually rewrite them and then verify them again.
[0073] According to the embodiment of the present disclosure, by performing verification in a timely manner after the operational steps of structure migration, data migration and program rewriting, it is possible to promptly discover the migration error structure or data, as well as the rewriting error code program. The timely discovery of errors can reduce useless work in the transformation and make the database transformation result of the entire solution more reliable.
[0074] In an embodiment of the present disclosure, the operation S250 includes: after the program rewriting verification passes, generating a version package based on the target database environment information, structure migration information, data migration information, and program rewriting information.
[0075] Based on the above database transformation method, the present disclosure also provides a database transformation device. Figure 5 The device is described in detail.
[0076] Figure 5 The structural block diagram of the database transformation device according to an embodiment of the present disclosure is schematically shown.
[0077] like Figure 5As shown, the database transformation device 500 of this embodiment includes an environment construction module 510, a structure migration module 520, a structure migration verification module 530, a data migration module 540, a data migration verification module 550, a program rewriting module 560, a program rewriting verification module 570 and a publishing module 580.
[0078] The environment building module 510 is used to build the environment information of the target database based on the acquired environment information of the source database and the environment information of the scheduling server. In one embodiment, the environment building module 510 can be used to perform the operation S210 described above, which will not be repeated here.
[0079] The structure migration module 520 is used to migrate the structure of the source database to the target database according to a preset structure migration method. In one embodiment, the structure migration module 520 can be used to perform the operation S220 described above, which will not be repeated here.
[0080] The structure migration verification module 530 is used to verify the structure migration result. In one embodiment, the structure migration verification module 530 can be used to perform the operation S2230 described above, which will not be described in detail here.
[0081] The data migration module 540 is used to further migrate the database data after completing the migration and verification of the database structure. In one embodiment, the data migration module 540 can be used to perform the operation S230 described above, which will not be repeated here.
[0082] The data migration verification module 550 is used to verify the data migration result. In one embodiment, the data migration verification module 550 can be used to perform the operation S230 described above, which will not be described in detail here.
[0083] The program rewriting module 560 is used to obtain the code program to be rewritten on the scheduling server that interacts with the source database and rewrite the code program to be rewritten into a code program that interacts with the target database. In one embodiment, the program rewriting module 560 can be used to perform the operation S240 described above, which will not be repeated here.
[0084] The program rewriting verification module 570 is used to verify the program rewriting result. In one embodiment, the program rewriting verification module 570 can be used to perform the operation S240 described above, which will not be repeated here.
[0085] Release module 580 is used to package the target database environment information created by environment creation module 510, the structure migration script created by structure migration module 520, the data migration script created by data migration module 540, and the program rewritten by program rewriting module 560 into a version package. In one embodiment, release module 580 can be used to perform operation S250 described above, and will not be further described here.
[0086] According to an embodiment of the present disclosure, any multiple modules among the environment construction module 510, the structure migration module 520, the structure migration verification module 530, the data migration module 540, the data migration verification module 550, the program rewriting module 560, the program rewriting verification module 570, and the release module 580 can be combined into a single module for implementation, or any one of these modules can be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules can be combined with at least part of the functionality of other modules and implemented in a single module. According to an embodiment of the present disclosure, at least one of the environment construction module 510, the structure migration module 520, the structure migration verification module 530, the data migration module 540, the data migration verification module 550, the program rewriting module 560, the program rewriting verification module 570, and the release module 580 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or can be implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, at least one of the environment construction module 510, the structure migration module 520, the structure migration verification module 530, the data migration module 540, the data migration verification module 550, the program rewriting module 560, the program rewriting verification module 570, and the release module 580 can be at least partially implemented as a computer program module, and when the computer program module is executed, it can perform the corresponding function.
[0087] In some embodiments of the present disclosure, the environment construction module 510, the structure migration module 520, the structure migration verification module 530, the data migration module 540, the data migration verification module 550, the program rewriting module 560, the program rewriting verification module 570, and the release module 580 are integrated to form an automated service platform, through which users can perform database transformation operations according to the above-mentioned database transformation method. Specifically, the following steps are included:
[0088] Step 1: The user opens a browser and enters the operation interface of the automation service platform.
[0089] Step 2: Through permission control, limit users (generally including the environment manager, developers, and testers of this application) to only be able to operate the content of this application, but only be able to read the content of other applications.
[0090] Step 3: Select the fully automated database transformation mode.
[0091] Step 4, such as Figure 6 As shown, after entering the source database environment information and the dispatch server environment information, the environment setup module, structure migration module, structure migration verification module, data migration module, data migration verification module, program rewriting module, and program rewriting verification module are executed in sequence. Finally, the target database environment information built by the environment setup module, the structure migration script of the structure migration module, the data migration script of the data migration module, and the program rewritten by the program rewriting module are packaged into a version package through the release module.
[0092] Step 5: The user confirms the correctness of this database transformation based on the logs generated in each module.
[0093] According to the embodiments of the present disclosure, the modules are interconnected and run in an automated and orderly manner throughout the entire process. A source database can be automatically migrated to a target database, and the migration code can be automatically integrated to form a version package for release.
[0094] In addition, after completing all database migration content, each application can further carry out non-functional testing (including performance testing, security testing, chaos testing, etc.) and other verifications (including monitoring testing, etc.) based on actual conditions.
[0095] In some embodiments of the present disclosure, the environmental information of the source database and / or the environmental information of the target database and / or the environmental information of the scheduling server on which the above-mentioned modules are based are all manually input. Accordingly, the above-mentioned modules can be used separately to realize the functions of each module itself, with extremely high scalability. Each module can also be embedded separately in other devices and systems, and further cooperated with other solutions to derive more highly available functions and solutions.
[0096] Figure 7 A block diagram of an electronic device suitable for implementing a database transformation method according to an embodiment of the present disclosure is schematically shown.
[0097] like Figure 7 As shown, the electronic device 700 according to an embodiment of the present disclosure includes a processor 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. The processor 701 may, for example, include a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 701 may also include an onboard memory for caching purposes. The processor 701 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0098] Various programs and data required for the operation of the electronic device 700 are stored in the RAM 703. The processor 701, ROM 702, and RAM 703 are connected to each other via a bus 704. The processor 701 executes the various operations of the method flow according to the embodiment of the present disclosure by executing the programs in the ROM 702 and / or RAM 703. It should be noted that the programs may also be stored in one or more memories other than the ROM 702 and RAM 703. The processor 701 may also execute the various operations of the method flow according to the embodiment of the present disclosure by executing the programs stored in the one or more memories.
[0099] According to an embodiment of the present disclosure, the electronic device 700 may further include an input / output (I / O) interface 705, which is also connected to the bus 704. The electronic device 700 may further include one or more of the following components connected to the I / O interface 705: an input portion 706 including a keyboard, a mouse, etc.; an output portion 707 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage portion 708 including a hard disk; and a communication portion 709 including a network interface card such as a LAN card, a modem, etc. The communication portion 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed so that a computer program read therefrom can be installed into the storage portion 708 as needed.
[0100] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments, or may exist independently and not be incorporated into the device / apparatus / system. The computer-readable storage medium carries one or more programs, and when executed, implements the method according to the embodiments of the present disclosure.
[0101] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 702 and / or RAM 703 described above and / or one or more memories other than ROM 702 and RAM 703.
[0102] The embodiments of the present disclosure also include a computer program product, which includes a computer program containing program code for executing the method shown in the flowchart. When the computer program product is executed in a computer system, the program code is used to enable the computer system to implement the database transformation method provided by the embodiments of the present disclosure.
[0103] The computer program executes the above functions defined in the system / device of the embodiment of the present disclosure when the processor 701 executes the computer program. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0104] In one embodiment, the computer program may be stored on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may be transmitted and distributed in the form of a signal on a network medium, downloaded and installed via the communication portion 709, and / or installed from a removable medium 711. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to wireless, wired, or any suitable combination thereof.
[0105] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 709, and / or installed from a removable medium 711. When the computer program is executed by the processor 701, the above-described functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the systems, devices, means, modules, units, etc. described above can be implemented by computer program modules.
[0106] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, python, "C" or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect via the Internet).
[0107] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0108] Those skilled in the art will appreciate that the features described in the various embodiments and / or claims of this disclosure may be combined and / or coupled in various ways, even if such combinations and / or couplings are not explicitly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure may be combined and / or coupled in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or couplings are intended to fall within the scope of this disclosure.
[0109] The embodiments of the present disclosure are described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although each embodiment has been described separately above, this does not mean that the measures in each embodiment cannot be used in combination to advantage. The scope of the present disclosure is defined by the appended claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A database transformation method, comprising: Based on the acquired environment information of the source database and the environment information of the scheduling server, build the environment information of the target database; Migrating the structure of the source database to the target database according to a preset structure migration method, and verifying the structure migration result; After the structure migration verification is passed, the data in the structure of the source database is migrated to the target database, and the data migration result is verified; After the data migration verification is passed, obtaining the code program to be rewritten on the scheduling server that interacts with the source database, rewriting the code program to be rewritten into a code program that interacts with the target database, and verifying the program rewriting result; After the program rewriting verification passes, a version package is generated based on the environment information of the target database, the structure migration information, the data migration information, and the program rewriting information.
2. The method according to claim 1, wherein The environment information for building the target database includes: The environment information of the target database is configured according to the environment information of the source database, wherein the environment information of the source database includes a database name, a user, and a password.
3. The method according to claim 1, wherein Migrating the structure of the source database to the target database according to a preset structure migration method includes: According to a preset structure migration method, the structure of the source database is divided into a direct migration part, a modified migration part, and a manual migration part; Migrating the direct migration part to the target database; Modify the modified migration part according to a preset rule, and migrate the modified migration part to the target database; Generate a manual migration structure list corresponding to the manual migration part.
4. The method according to claim 1, wherein The verification structure migration results include: At least one type of structure in the source database structure is verified, wherein the source database structure includes tables, indexes, views, functions, and user permissions.
5. The method according to claim 4, wherein Migrating the data in the structure of the source database to the target database includes: Migrate the data in each table of the source database according to a preset data migration method, where the preset data migration method includes full migration or incremental migration.
6. The method according to claim 5, wherein: Migrating the data in each table of the source database according to the preset data migration method includes: For each table in the source database, when the preset data migration mode is incremental migration, comparing the data in the table in the source database and the target database according to the primary key of the table to obtain incremental data; Migrate the incremental data of the source database to the target database.
7. The method according to claim 6, wherein: The verification data migration results include: For at least one table in the source database, comparing the number of rows of the table in the source database and the number of rows of the table in the target database; If the number of rows is the same, compare the data in the table in the source database and the table in the target database to see if they are the same; If it is determined that the data in the table in the source database is identical to the data in the table in the target database, it is determined that the data migration result verification has passed.
8. A database transformation device, comprising: The environment building module is used to build the environment information of the target database based on the acquired environment information of the source database and the environment information of the scheduling server; A structure migration module, configured to migrate the structure of the source database to the target database according to a preset structure migration method; Structural migration verification module, used to verify the structural migration results; The data migration module is used to further migrate database data after completing the migration and verification of the database structure; Data migration verification module, used to verify data migration results; A program rewriting module, configured to obtain a code program to be rewritten on the scheduling server that interacts with the source database, and rewrite the code program to be rewritten into a code program that interacts with the target database; Program rewriting verification module, used to verify the program rewriting results; The version release module is used to package the environment information of the target database built by the environment building module, the structure migration script of the structure migration module, the data migration script of the data migration module and the program rewritten by the program rewriting module into a version package.
9. An electronic device comprising: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors are enabled to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having executable instructions stored thereon, wherein when the instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 7.
11. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Data migration method and device, equipment, medium and program product
CN114281803A
Automated database migration architecture
US20150019488A1