Database data migration method and computer equipment

By introducing the migration comparison relationship between visual pages and intermediate databases in the database data migration tool, the problem of high difficulty and inflexibility of data migration in the existing technology is solved, and a simpler and more flexible data migration process is achieved.

CN119938642APending Publication Date: 2025-05-06WINNING HEALTH TECHNOLOGY GROUP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510017164.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-06
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

Existing database data migration technology requires users to have basic database skills, editing scripts is prone to errors, and the operation is difficult and not flexible enough.

Method used

Enter information from the source database, target database and intermediate database through the visual page of the preset data migration tool, and use the intermediate database to store the migration comparison relationship of the business table under the service type to realize data migration.

Benefits of technology

It reduces the difficulty of data migration to the database and improves the flexibility of migration operations, so that users can complete data migration without having basic database skills.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119938642A_ABST
    Figure CN119938642A_ABST
Patent Text Reader

Abstract

The invention provides a data migration method of a database and computer equipment, and relates to the technical field of information. According to information of a source database, information of a target database and information of an intermediate database which are input on a visual page of a preset data migration tool, the information of the target database and the information of the intermediate database are obtained; the method comprises the following steps: respectively connecting a source database, a target database and an intermediate database, and searching a target business table of migration starting and ending time under a business type from the source database according to migration starting and ending time information input through a visual page and the business type of a to-be-migrated data table, and extracting table data of the target business table into a data extraction table in the intermediate database, and migrating business data of the target business table in the source database into the target database according to information of a migration mode input through a visual page and the data extraction table. The data migration difficulty of the database is reduced, and the flexibility of migration operation is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information technology, and in particular to a database data migration method and a computer device. Background Art

[0002] After four or five years of use, the user's on-site formal database has an increased amount of data, which makes query reports very slow to retrieve. In some businesses, if the query verification is performed before the business is carried out, there may be downtime. Even if an index is created, there will not be much improvement due to the large amount of data. In order to improve the operating speed of the user's on-site database and ensure the normal operation of the hospital's business, a database data migration tool is now provided for on-site technical implementation.

[0003] At present, the target script is obtained by presetting the initial script, and the staff edits the start and end time and table name in the specimen by themselves, and runs the target script in the target database to migrate data to the target database.

[0004] However, the existing technology requires staff to have basic database skills and be able to skillfully edit scripts and run databases. Manual script editing is prone to errors and requires repeated checking, which is difficult and inflexible for staff. Summary of the invention

[0005] The purpose of the present application is to provide a database data migration method and computer equipment to address the deficiencies in the above-mentioned prior art. The present application reduces the difficulty of database data migration and improves the flexibility of the migration operation.

[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0007] In a first aspect, an embodiment of the present application provides a method for migrating data from a database, the method comprising:

[0008] According to the information of the source database, the information of the target database and the information of the intermediate database inputted on the visualization page of the preset data migration tool, connecting to the source database, the target database and the intermediate database respectively;

[0009] According to the information of the migration start and end time input through the visualization page and the business type of the data table to be migrated, searching the target business table of the migration start and end time under the business type from the source database, and extracting the table data of the target business table into the data extraction table in the intermediate database, wherein the data extraction table is used to store the migration comparison relationship of the business table under the business type;

[0010] The business data of the target business table in the source database is migrated to the target database according to the migration mode information input through the visualization page and the data extraction table.

[0011] Optionally, before searching the source database for a target business table of the migration start and end time under the business type according to the information of the migration start and end time input through the visualization page and the business type, and extracting the table data of the target business table into the data extraction table, the method further comprises:

[0012] According to the data extraction operation and verification password information input through the visualization page, identity verification is performed using the corresponding verification password in the user setting table in the intermediate database;

[0013] If the identity verification passes, the data extraction state is entered.

[0014] Optionally, searching the source database for a target business table of the migration start and end time under the business type according to the information of the migration start and end time input through the visualization page and the business type, and extracting table data of the target business table into the data extraction table includes:

[0015] According to the information of the migration start and end time and the business type, a backend data extraction thread is executed to search the target business table from the source database, and table data of the target business table is extracted into the data extraction table;

[0016] The method further comprises:

[0017] When executing the backend data extraction thread, a preset waiting animation is displayed on the visualization page;

[0018] According to a preset interval, cyclically query whether the backend data extraction thread has finished executing;

[0019] If the backend data extraction thread is finished, the preset waiting animation is stopped from being displayed on the visualization page, and an indication message indicating that the extraction is completed is displayed.

[0020] Optionally, after searching the source database for a target business table of the migration start and end time under the business type according to the information of the migration start and end time input through the visualization page and the business type of the data table to be migrated, and extracting the table data of the target business table into the data extraction table in the intermediate database, the method further comprises:

[0021] Displaying the table name of the target business table and the total data volume of the target business table on the visualization page;

[0022] The table name of the data extraction table, the table name of the target business table, and the total data volume of the target business table are written into the migration record table in the intermediate database.

[0023] Optionally, migrating the business data of the target business table in the source database to the target database according to the migration mode information input through the visualization page and the data extraction table includes:

[0024] If the migration mode is the first migration mode, deleting the business data of the target business table in the source database according to the data extraction table;

[0025] According to the data extraction table, data in other business tables other than the target business table in the target database are deleted.

[0026] Optionally, migrating the business data of the target business table in the source database to the target database according to the migration mode information input through the visualization page and the data extraction table includes:

[0027] If the migration mode is a non-first migration mode, copying the business data of the target business table in the source database to the target database according to the data extraction table;

[0028] According to the data extraction table, the business data of the target business table in the source database is deleted.

[0029] Optionally, the method further comprises:

[0030] According to the data migration operation input through the visualization page and the second verification password information, a second identity verification is performed using the corresponding verification password in the user setting table in the intermediate database;

[0031] If the second identity verification passes, the data migration state is entered and the migration start time of this migration is obtained;

[0032] Acquire the migration data volume of the current migration from the target database;

[0033] Writing the migration start time, the migration mode information, and the migration data volume into the migration record table in the intermediate database;

[0034] The migration record table is called to display the migration data volume in the visualization page.

[0035] Optionally, before deleting data in other business tables other than the target business table in the target database according to the data extraction table, the method further includes:

[0036] According to the data deletion operation input through the visualization page, verify whether the time interval between the input time of the data deletion operation and the data deletion time of the source database is greater than or equal to a preset time length;

[0037] Deleting data in other business tables other than the target business table in the target database according to the data extraction table includes:

[0038] If the time interval is greater than or equal to the preset time length, data in other business tables other than the target business table in the target database are deleted according to the data extraction table.

[0039] Optionally, the method further comprises:

[0040] Verifying whether the data migration of the target business table is completed according to the migration end operation input through the visualization page and the data extraction table;

[0041] If the data migration of the target business table is completed, the migration end time of this migration is obtained, and the migration end time is written into the migration record table in the intermediate database;

[0042] A migration operation log is generated according to the migration end time, the migration start time and the migration data volume in the migration record table.

[0043] In a second aspect, another embodiment of the present application provides a data migration device for a database, the device comprising:

[0044] A connection module, used to respectively connect to the source database, the target database and the intermediate database according to the information of the source database, the target database and the intermediate database input through the visualization page of the preset data migration tool;

[0045] An extraction module, used to search the target business table of the migration start and end time under the business type from the source database according to the information of the migration start and end time input through the visualization page and the business type of the data table to be migrated, and extract the table data of the target business table into the data extraction table in the intermediate database, wherein the data extraction table is used to store the migration comparison relationship of the business table under the business type;

[0046] The migration module is used to migrate the business data of the target business table in the source database to the target database according to the migration mode information input through the visualization page and the data extraction table.

[0047] In the third aspect, another embodiment of the present application provides a computer device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the computer device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the database data migration method as described in any of the first aspects above.

[0048] In a fourth aspect, another embodiment of the present application provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the database data migration method as described in any one of the first aspects above are executed.

[0049] The beneficial effects of this application are:

[0050] The present application provides a method and computer device for data migration of a database. According to the information of the source database, the information of the target database and the information of the intermediate database inputted through the visualization page of the preset data migration tool, the source database, the target database and the intermediate database are connected respectively. According to the information of the migration start and end time inputted through the visualization page and the business type of the data table to be migrated, the target business table of the migration start and end time under the business type is searched from the source database, and the table data of the target business table is extracted into the data extraction table in the intermediate database. According to the information of the migration mode inputted through the visualization page and the data extraction table, the business data of the target business table in the source database is migrated to the target database. The present application sets the migration comparison relationship of the business table under the business type stored in the intermediate database, and can migrate according to the migration relationship during the migration of the source database, without being affected by the order of the business tables. Through the multiple information inputted through the visualization page of the preset data migration tool, the business data of the target business table in the source database is migrated to the target database, and the migration of business data can be realized when the user does not have basic database skills, which reduces the difficulty of data migration of the database and improves the flexibility of the migration operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0052] Figure 1 A schematic diagram of a data migration method for a database provided in an embodiment of the present application;

[0053] Figure 2 A schematic diagram of the process of identity verification in a database migration method provided in an embodiment of the present application;

[0054] Figure 3 A schematic diagram of a flow chart of executing a data extraction thread in a database data migration method provided in an embodiment of the present application;

[0055] Figure 4 A schematic diagram of a process of writing data into a migration record table in a database data migration method provided in an embodiment of the present application;

[0056] Figure 5 A schematic diagram of a data migration process in a database data migration method provided in an embodiment of the present application;

[0057] Figure 6 A schematic diagram of a data migration process in another database data migration method provided in an embodiment of the present application;

[0058] Figure 7 A schematic diagram of a process for determining the amount of data to be migrated in a method for migrating data from a database provided in an embodiment of the present application;

[0059] Figure 8 A schematic diagram of a process of data deletion in a method for data migration of a database provided in an embodiment of the present application;

[0060] Fig. 9 A schematic diagram of a process for generating a migration log in a data migration method provided in an embodiment of the present application;

[0061] Fig.10 A schematic diagram of the structure of a data migration device for a database provided in an embodiment of the present application;

[0062] Fig.11 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0063] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0064] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0065] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0066] To clearly describe the database data migration method provided in the embodiment of the present application, the method is described below with reference to a plurality of drawings. Figure 1 A schematic diagram of a data migration method for a database provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:

[0067] Step 101 : connect to the source database, the target database and the intermediate database respectively according to the information of the source database, the target database and the intermediate database input on the visualization page of the preset data migration tool.

[0068] Among them, the preset data migration tool can be a hospital information system (HIS) in a cloud computing environment. The visualization page of the preset data migration tool provides a graphical interface for users, so that users can configure and execute data migration tasks without programming knowledge.

[0069] The source database is a formal database running in the user's on-site server environment. The source database information includes: the source database address, account number and password. The target database is a database used to store historical data. The target database information includes: the target database address, account number and password. During the data migration process, the intermediate database will write the migration comparison relationship and migration record information to the intermediate database. The intermediate database information includes: the intermediate database address, account number and password. During the data migration process, the configuration of the source database, target database and intermediate database will not be changed.

[0070] Optionally, before entering the source database information, target database information and intermediate database information on the visualization page of the preset data migration tool, the user data login information and password are required to log in to the preset migration tool, and enter the preset data migration tool after the user login information is successfully verified.

[0071] Optionally, the preset data migration tool connects to the source database, the target database and the intermediate database respectively through the information of the source database, the target database and the intermediate database. When the information of the source database, the target database and the intermediate database are all verified, the connection can be established, and the source database, the target database and the intermediate database are tested whether the connection is normal. If the connection is normal, the data in the source database will be restored to the historical database.

[0072] Step 102: according to the migration start and end time information input through the visualization page and the business type of the data table to be migrated, the target business table of the migration start and end time under the business type is searched from the source database, and the table data of the target business table is extracted into the data extraction table in the intermediate database.

[0073] Among them, the migration start and end time include: the migration data start time and the migration data end time, wherein the migration data start time and the migration data end time correspond to the data writing time in the source database. The business type of the data table to be migrated is a pre-set business type, for example, it can be an outpatient business type, an inpatient business type, a medical record business type, etc. The embodiment of the present application does not limit this, and different business types correspond to multiple business tables. The data extraction table is used to store the migration comparison relationship of the business table under the business type. The table data in the data extraction table stores the primary key of the business table, the medical institution corresponding to the business table, and the generation time of the business table, etc. The embodiment of the present application does not limit this.

[0074] Optionally, the intermediate database stores a data extraction table generation script and a data writing script. After the preset data migration tool establishes a connection with the intermediate database, the data extraction table is generated by executing the data extraction table generation script, and the migration comparison relationship of the business table under the storage business type is written into the data extraction table by executing the data writing script.

[0075] Optionally, based on the information of the migration start and end time input through the visualization page and the business type of the data table to be migrated, multiple business tables of the business type of the data table to be migrated are determined from the source database, and based on the migration start and end time, the target business table corresponding to the start and end migration time is determined from the multiple business tables, and the primary key in the target business table, the medical institution corresponding to the business table, and the generation time of the business table are written into the data extraction table through the data writing script.

[0076] Step 103: Migrate the business data of the target business table in the source database to the target database according to the migration mode information input through the visualization page and the data extraction table.

[0077] Optionally, when the migration mode is different, the corresponding data migration method is different, and the migration mode can be the first migration and the non-first migration. The specific migration method is determined according to the information of the migration mode, and the business data of the target business table in the source database is migrated to the target database according to the migration method corresponding to the migration mode and the data extraction table in the intermediate database.

[0078] In an embodiment of the present application, according to the information of the source database, the target database and the intermediate database input on the visualization page of the preset data migration tool, the source database, the target database and the intermediate database are connected respectively, according to the information of the migration start and end time input through the visualization page and the business type of the data table to be migrated, the target business table of the migration start and end time under the business type is searched from the source database, and the table data of the target business table is extracted into the data extraction table in the intermediate database, and according to the information of the migration mode input through the visualization page and the data extraction table, the business data of the target business table in the source database is migrated to the target database. By setting the migration comparison relationship of the business table under the business type stored in the intermediate database, the present application can migrate according to the migration relationship during the migration of the source database without being affected by the order of the business tables. Through the multiple information input on the visualization page of the preset data migration tool, the business data of the target business table in the source database is migrated to the target database, and the migration of business data can be realized when the user does not have basic database skills, which reduces the difficulty of data migration to the database and improves the flexibility of the migration operation.

[0079] Based on the above embodiments, the present application provides a process of identity verification in a database migration method. Figure 2 A schematic diagram of the process of identity verification in a database migration method provided in an embodiment of the present application, such as Figure 2 As shown, before the above step 102 searches the target business table of the migration start and end time under the business type from the source database according to the information of the migration start and end time and the business type input through the visualization page, and extracts the table data of the target business table into the data extraction table, the method further includes:

[0080] Step 201: According to the data extraction operation input through the visualization page and the first verification password information, the corresponding verification password in the user setting table in the intermediate database is used to perform identity verification.

[0081] The user setting table pre-stores verification passwords corresponding to multiple operations. The data extraction operation input through the visualization page can be realized by clicking a data extraction button on the visualization page. The first verification password user verifies the data extraction operation.

[0082] Optionally, the intermediate database also includes a user setting table generation script. When the preset data extraction tool establishes a connection with the intermediate database, the user setting table is generated by executing the user setting table generation script. At this time, no content is written in the user setting table. By executing the data writing script in the intermediate database, the basic setting information of data migration, user information, login password, verification password and operation log are written into the user setting table during the data migration process. The user setting table includes: basic setting information of data migration, user information, login password, verification password and operation log. Among them, the basic setting information of data migration includes: migration start and end time, migration mode and other information. The user information is the information of the user logging into the preset data migration tool. The login password is the user's login password in the preset data migration tool. The verification password is used to verify different operations during the data migration process. The operation log is the user's operation information during the data migration process.

[0083] Optionally, first input the data extraction operation through the visualization page, after receiving the data extraction operation input by the user, a verification password box pops up to receive the first verification password input by the user, and uses the corresponding verification password in the user setting table in the intermediate database to verify the user's identity.

[0084] Step 202: If the identity verification is passed, the data extraction state is entered.

[0085] Optionally, if the first verification password is consistent with the corresponding verification password in the user setting table in the intermediate database, it means that the user's identity verification is passed, and the data extraction state is entered. If the first verification password is inconsistent with the corresponding verification password in the user setting table in the intermediate database, the identity verification fails and the data extraction state cannot be entered.

[0086] In the embodiment of the present application, according to the data extraction operation input through the visualization page and the first verification password information, the corresponding verification password in the user setting table of the intermediate database is used for identity verification, and if the verification is passed, the data extraction state is entered. The present application improves the security of data extraction and increases the reliability of the data migration tool by verifying the password.

[0087] Based on the above embodiments, the present application also provides a process for executing a data extraction thread in a database data migration method. Figure 3 A schematic diagram of a flow chart of executing a data extraction thread in a database data migration method provided in an embodiment of the present application, such as Figure 3 As shown, according to the migration start and end time information and business type entered through the visualization page, the target business table of the migration start and end time under the business type is searched from the source database, and the table data of the target business table is extracted into the data extraction table, including:

[0088] Step 301: Execute the backend data extraction thread according to the migration start and end time information and the business type, search for the target business table from the source database, and extract the table data of the target business table into the data extraction table.

[0089] The data extraction thread is used to search for a target business table from a database and extract table data of the target business table into a data extraction table.

[0090] Optionally, by executing the data extraction thread, the business table under the business type is searched from the source database according to the business type, and the target business table with the migration start and end time under the business type is determined according to the migration start and end time and the data writing time in the business table under the business type, and the table data in the target business table is extracted into the data extraction table.

[0091] In the above steps 101 to 103, the method further includes:

[0092] Step 302: When executing the backend data extraction thread, a preset waiting animation is displayed on the visualization page.

[0093] The preset waiting animation is used to indicate that the data extraction thread is extracting data. The preset waiting animation may also display the specific extraction progress, for example, information such as 10% of the data has been extracted.

[0094] Step 303: According to a preset interval, cyclically query whether the backend data extraction thread has finished executing.

[0095] The preset interval may be 1-2 minutes.

[0096] Optionally, according to a preset interval, a backend data extraction thread is cyclically queried to determine whether the execution is completed. Specifically, when all table data of the target business table within the migration start and end time are extracted into the data extraction table, it indicates that the backend data extraction thread is completed.

[0097] Step 304: If the backend data extraction thread is finished, the preset waiting animation is stopped on the visualization page, and an indication message indicating that the extraction is completed is displayed.

[0098] Optionally, all table data of the target business table within the migration start and end time are extracted into the data extraction table. When the backend data extraction thread is executed, the preset waiting animation is stopped from being displayed on the visualization page, and an indication message indicating that the extraction is completed is displayed.

[0099] In an embodiment of the present application, a backend data extraction thread is executed, a target business table is searched from a source database, and table data of the target business table is extracted into a data extraction table. When the backend data extraction thread is executed, a preset waiting animation is displayed on a visualization page; according to a preset interval, a loop query is made to see whether the backend data extraction thread has been completed. If the backend data extraction thread has been completed, the preset waiting animation is stopped from being displayed on the visualization page, and an indication message indicating that the extraction is complete is displayed. The present application allows users to accurately understand the data extraction process through a visualization page. By loop querying to see whether the backend data extraction thread has been completed, system resources can be reasonably allocated to avoid occupying unnecessary resources for a long time. The backend asynchronously extracts and migrates data, combined with the front-end fake animation display, to avoid operation interruptions caused by session timeouts, and to improve the stability of data migration operations.

[0100] Based on the above embodiments, the present application also provides a process of writing data into a migration record table in a database data migration method. Figure 4 A schematic diagram of a process of writing data into a migration record table in a database data migration method provided in an embodiment of the present application, such as Figure 4 As shown, after the above step 102 searches the source database for the target business table of the migration start and end time according to the information of the migration start and end time input through the visualization page and the business type of the data table to be migrated, and extracts the table data of the target business table into the data extraction table in the intermediate database, the method further includes:

[0101] Step 401: Display the table name of the target business table and the total data volume of the target business table on a visualization page.

[0102] The table name is the name of the target business table, which is used as a unique identifier of the business table to distinguish different data sets.

[0103] Optionally, the table name of the target business table and the total data volume of the target business table are displayed on the visualization page so that the user can understand the specific data extraction situation.

[0104] Step 402: Write the table name of the data extraction table, the table name of the target business table, and the total data volume of the target business table into the migration record table in the intermediate database.

[0105] Optionally, the intermediate database also includes a migration record table generation script. After the preset data migration tool is successfully connected to the intermediate database, the migration record table is generated by executing the migration record table generation script. At this time, no data is written into the migration record table.

[0106] Optionally, the table name of the data extraction table, the table name of the target business table, and the total amount of data in the target business table are written into the migration record table in the intermediate database by executing the data writing script. The migration record table includes: the table name of the data extraction table, the table name of the target business table, and the total amount of data in the target business table.

[0107] In the embodiment of the present application, the table name of the target business table and the total data volume of the target business table are displayed on the visualization page, and the status of the current business table, including the data volume, can be immediately seen, so that a decision can be made quickly. The table name of the data extraction table, the table name of the target business table, and the total data volume of the target business table are written into the migration record table in the intermediate database. If an error occurs during the migration process, the information in the record table can help quickly locate the problem.

[0108] Based on the above embodiments, the present application also provides a data migration process in a database data migration method. Figure 5 A schematic diagram of a data migration process in a method for migrating data from a database provided in an embodiment of the present application, such as Figure 5 As shown, in the above step 103, according to the information of the migration mode input through the visualization page and the data extraction table, the business data of the target business table in the source database is migrated to the target database, including:

[0109] Step 501: If the migration mode is the first migration mode, the business data of the target business table in the source database is deleted according to the data extraction table.

[0110] In the case of the first migration model, the data in the source database and the target database are completely consistent. When the current migration mode is the first migration mode, the migration data start time in the migration start and end time is the write time of the first data in the data table to be migrated in the source database, and the migration data end time is the time entered on the visualization page. The migration data end time cannot be set within two years from the current operation to avoid deleting too much data, which may cause the medical system corresponding to the source database to fail to work properly.

[0111] Optionally, the source database in the present application is a business database, and the source database can also be a test database, which is used to simulate the data in the business database and is completely consistent with the data in the business database. Before the first migration of the business database, the migration process can also be simulated through the test database, and the information of the test database, the target database and the intermediate database are input on the visualization page of the preset data migration tool, respectively connected to the test database, the target database and the intermediate database, and the data in the business database is completely restored to the test database and the historical database. According to the information of the migration start and end time input through the visualization page and the business type of the data table to be migrated, the target business table of the migration start and end time under the business type is searched from the test database, and the table data of the target business table is extracted into the data extraction table in the intermediate database. According to the data extraction table, the business data of the target business table in the test database is migrated to the target database. When the amount of data in the test database is the same as the sum of the amount of data in the target database and the amount of data in the business database, and when the primary key in the data extraction table in the intermediate database exists in the target database but not in the source database, it means that the test is successful, and the data migration of the business database is performed at this time.

[0112] Optionally, if the migration mode is the first migration mode, and the data in the source database is exactly the same as the data in the target database, the business data of the target business table in the source database corresponding to the business table primary key in the data extraction table is deleted. The business table primary key is determined based on the target business table. The business data is determined based on the migration start and end time information and the business type of the data table to be migrated.

[0113] Step 502: Delete data in other business tables other than the target business table in the target database according to the data extraction table.

[0114] Optionally, data in other business tables other than the target business table in the target database is deleted according to the business table primary key in the data extraction table.

[0115] For example, when a medical system has been running for 10 years, the running time is from 2014.1.1 to 2024.1.1, and the migration mode is the first migration mode, the data from 2014.1.1 to 2020.12.31 are migrated for six years. First, the source database, that is, the business database, is restored to the historical database. After extracting the data of a certain business type from 2014.1.1 to 2020.12.31, data migration is performed. First, the business data corresponding to the business type from 2014.1.1 to 2020.12.31 in the business database is deleted. Then the data other than the business data corresponding to the business type from 2021.1.1 to 2024.1.1 in the target database is deleted. At this time, the data in the target database is the business data corresponding to the business type from 2014.1.1 to 2020.12.31, and the data in the business database is the data other than the business data corresponding to the business type from 2014.1.1 to 2020.12.31.

[0116] In an embodiment of the present application, before migrating the business database, the function of simulating the migration by testing the data path can be used to estimate the amount of migration data and the time required to ensure accuracy and security before the formal migration. During the data migration process, the present application ensures that old data is no longer retained in the source database, reduces data redundancy, improves database performance, and ensures data consistency and integrity of the source database and the target database.

[0117] Based on the above embodiment, the present application also provides a data migration process in another database data migration method. Figure 6 A schematic diagram of a data migration process in another database data migration method provided in an embodiment of the present application, such as Figure 6 As shown, in the above step 103, according to the information of the migration mode input through the visualization page and the data extraction table, the business data of the target business table in the source database is migrated to the target database, including:

[0118] Step 601: If the migration mode is a non-first migration mode, the business data of the target business table in the source database is copied to the target database according to the data extraction table.

[0119] Among them, when the migration mode is non-first migration mode, the migration data start time in the migration start and end time is the next day after the last migration data end time of the source database, and the migration data end time is the time entered on the visualization page. The migration data end time cannot be set within two years from the current operation to avoid deleting too much data, which may cause the medical system corresponding to the source database to fail to work properly.

[0120] Optionally, when the migration mode is non-first migration mode, different types of business data tables are stored in the source database and the target database. The business data for this migration is determined according to the data extraction table, and the business data of the target business table in the source database is copied to the target database.

[0121] Step 602: Delete the business data of the target business table in the source database according to the data extraction table.

[0122] Optionally, at this time, both the source data table and the business data table store the business data of this migration, and then the business data of the target business table in the source database is deleted according to the data extraction table.

[0123] For example, when the migration mode is non-first migration mode, the business data of the business type of the data table to be migrated from 2021.1.1 to 2021.4.1 is migrated. After the data extraction is completed, the data of the source database from 2021.1.1 to 2021.4.1 is copied to the target database; then the business data of the business type of the migration data table from 2021.1.1 to 2021.4.1 of the target database is deleted. At this time, the target database data is: the business data of the business type of the migration data table from 2014.1.1 to 2021.4.1, and the source data is: the business data of the business type of the migration data table from 2021.4.2 to 2024.2.1.

[0124] In the embodiment of the present application, if the migration mode is a non-first migration mode, the business data of the target business table in the source database is copied to the target database according to the data extraction table, and the business data of the target business table in the source database is deleted according to the data extraction table. The present application migrates data according to the migration model to ensure the success of data migration, reduce the risk of data loss due to migration failure, and maintain data integrity and consistency.

[0125] Based on the above embodiments, the present application also provides a process for determining the amount of migrated data in a database data migration method. Figure 7 A schematic diagram of a flow chart for determining the amount of data to be migrated in a method for migrating data from a database provided in an embodiment of the present application, such as Figure 7 As shown, based on the above steps 401 and 402, the method further includes:

[0126] Step 701: According to the data migration operation input through the visualization page and the second verification password information, a second identity verification is performed using the corresponding verification password in the user setting table in the intermediate database.

[0127] Optionally, the user inputs the data migration operation through the visualization page and can input the data migration operation by clicking the data migration button. At this time, a verification password box pops up, and the user enters the second verification password information and uses the verification password corresponding to the data migration operation in the user setting table in the intermediate database to perform a second identity verification.

[0128] Step 702: If the second identity verification passes, the data migration state is entered, and the migration start time of this migration is obtained.

[0129] Optionally, if the second verification password is consistent with the verification password corresponding to the data migration operation in the user setting table in the intermediate database, the second identity verification passes, the data migration state is entered, and the time of entering the data migration state is used as the migration start time of this migration. If the second verification password is inconsistent with the verification password corresponding to the data migration operation in the user setting table in the intermediate database, the second identity verification fails.

[0130] Step 703: Obtain the migration data volume of this migration from the target database.

[0131] The amount of migrated data may be the number of data items or the size of the data in bytes.

[0132] Optionally, the migration data volume of this migration is obtained from the target database, that is, the number of data items stored in the target database or the data size in bytes in the target database.

[0133] Step 704: Write the migration start time, migration mode information, and migration data volume into the migration record table in the intermediate database.

[0134] Optionally, by executing the data writing script, the migration start time, migration mode information, and migration data volume are all written into the migration record table in the intermediate database. The migration start time is the time when the data migration starts, not the data writing time. The migration mode information includes the first migration mode or the non-first migration mode, and the migration data volume can be the number of data items or the data size.

[0135] Step 705: Call the migration record table to display the migration data volume in the visualization page.

[0136] Optionally, the amount of migrated data in the migration record table may be called by calling a data calling script, and the amount of migrated data may be displayed in a visualization page.

[0137] In the embodiment of the present application, according to the data migration operation input through the visualization page and the second verification password information, if the second identity verification is passed, the migration start time of this migration is obtained, the migration data volume of this migration is obtained from the target database, the migration start time, migration mode information, and migration data volume are written into the migration record table in the intermediate database, and the migration record table is called to display the migration data volume in the visualization page. The present application enables users to intuitively see the progress and results of the migration, improves the user experience, and can monitor the specific information of the migration through the migration record table, and monitor the migration data.

[0138] Based on the above embodiments, the present application also provides a process of data deletion in a method for data migration of a database. Figure 8 A schematic diagram of a data deletion process in a database data migration method provided in an embodiment of the present application, such as Figure 8 As shown, before deleting data of other business tables other than the target business table in the target database according to the data extraction table in the above step 502, the method further includes:

[0139] Step 801: According to the data deletion operation input through the visualization page, verify whether the time interval between the input time of the data deletion operation and the data deletion time of the source database is greater than or equal to a preset time length.

[0140] The preset duration is greater than or equal to 15 days, for example, the time duration may be 15 days.

[0141] Optionally, according to the data deletion operation input through the visualization page, the data deletion operation can be a data deletion operation input by clicking the data deletion button on the visualization page. At this time, a password verification window pops up, and a third verification password information is entered in the password verification window. The verification password corresponding to the data deletion operation in the user setting table in the intermediate database is used to perform a third identity verification. If the verification passes, it is determined whether the time interval between the input time of the verification data deletion operation and the data deletion time of the source database is greater than or equal to the preset duration.

[0142] In the above step 502, according to the data extraction table, data in other business tables other than the target business table in the target database are deleted, including:

[0143] Step 802: If the time interval is greater than or equal to the preset time length, data in other business tables other than the target business table in the target database are deleted according to the data extraction table.

[0144] Optionally, if the time interval is greater than or equal to the preset duration, it means that the data can be deleted. Then, according to the data extraction table, the data of other business tables other than the target business table in the target database are deleted. After the data deletion is completed, the data deletion result is displayed on the visualization page.

[0145] In the embodiment of the present application, according to the data deletion operation input through the visualization page, the time interval between the input time of the data deletion operation and the data deletion time of the source database is verified. If the time interval is greater than or equal to the preset time, the data of other business tables other than the target business table in the target database is deleted according to the data extraction table. The present application adds delay control to the data deletion system, reserves sufficient time for verification and confirmation for the implementation personnel, and can restore the data through the historical database if any problem is found. The safety of the operation is guaranteed through verification and prevents misoperation or malicious deletion of database content.

[0146] Based on the above embodiments, the present application also provides a process for generating a migration log in a data migration method. Fig. 9 A schematic diagram of a process for generating a migration log in a data migration method provided in an embodiment of the present application, such as Fig. 9 As shown, based on the above steps 701 to 705, the method further includes:

[0147] Step 901: Verify whether the data migration of the target business table is completed according to the migration end operation input through the visualization page and the data extraction table.

[0148] Optionally, based on the migration end operation input through the visualization page, the migration end operation can be input by clicking the migration end button of the visualization page. When the input of the migration end operation is received, the primary key of the data extraction table is verified to determine whether the data migration of the target business table is completed.

[0149] Step 902: If the data migration of the target business table is completed, the migration end time of this migration is obtained, and the migration end time is written into the migration record table in the intermediate database.

[0150] Optionally, if the primary key of the data extraction table is the same as the primary key of the target business table, it means that the data migration of the target business table is completed, and the time at this time is used as the migration end time of this migration, and the migration end time is written into the migration record table in the intermediate database by executing the data writing script. The migration record table includes: migration start time, migration end time, source database table name, intermediate database table name, total data volume, migrated data volume, migration mode migration status, migration operator, operation time, etc.

[0151] Step 903: Generate a migration operation log according to the migration end time, migration start time and migration data volume in the migration record table.

[0152] Optionally, by calling a data reading script, the migration end time, migration start time and migration data volume of this data migration are read from the migration record table to generate this migration operation log.

[0153] Optionally, according to the migration operation date of the log viewing operation input through the visualization page, the specific log viewing operation may be a log viewing operation input by the user by clicking a day difference viewing button in the visualization page.

[0154] In the embodiment of the present application, after receiving the migration end operation, it is determined whether the data migration of the target business table is completed according to the data extraction table, so as to determine the end time of this migration, and write the end time into the migration record table, so as to generate a migration operation log according to the migration record table. The automatic verification and upgrade of the database of the present application ensures the data integrity after data migration, and implements the operation through detailed operation log specifications. The database changes are traceable, and each data migration can be traced. It does not provide a time reference for subsequent daily migration, so as to facilitate the implementation personnel to arrange the migration work and reduce work pressure.

[0155] Based on the same inventive concept, the embodiment of the present application also provides a database data migration device corresponding to the database data migration method. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned database data migration method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0156] Fig.10 A schematic diagram of a data migration device for a database provided in an embodiment of the present application, the device comprising:

[0157] A connection module 1001 is used to connect to the source database, the target database and the intermediate database respectively according to the information of the source database, the target database and the intermediate database input through the visualization page of the preset data migration tool;

[0158] The extraction module 1002 is used to search the target business table of the migration start and end time under the business type from the source database according to the information of the migration start and end time input through the visualization page and the business type of the data table to be migrated, and extract the table data of the target business table into the data extraction table in the intermediate database, and the data extraction table is used to store the migration comparison relationship of the business table under the business type;

[0159] The migration module 1003 is used to migrate the business data of the target business table in the source database to the target database according to the migration mode information input through the visualization page and the data extraction table.

[0160] Optionally, the extraction module 1002 is further used to: perform identity verification using a corresponding verification password in a user setting table in the intermediate database according to the data extraction operation input through the visualization page and the first verification password information;

[0161] If the identity verification passes, the data extraction state is entered.

[0162] Optionally, the extraction module 1002 is specifically used to: execute the backend data extraction thread according to the information of the migration start and end time and the business type, search the target business table from the source database, and extract the table data of the target business table into the data extraction table;

[0163] The device also includes: an execution module, which is specifically used to: display a preset waiting animation on a visualization page when executing a backend data extraction thread;

[0164] According to the preset interval, cyclically query whether the backend data extraction thread has finished executing;

[0165] If the backend data extraction thread is finished, the preset waiting animation will stop displaying on the visualization page, and the extraction completion indication message will be displayed.

[0166] Optionally, the extraction module 1002 is further configured to: display the table name of the target business table and the total data volume of the target business table on the visualization page;

[0167] The table name of the data extraction table, the table name of the target business table, and the total data volume of the target business table are written into the migration record table in the intermediate database.

[0168] Optionally, the migration module 1003 is specifically configured to: if the migration mode is the first migration mode, delete the business data of the target business table in the source database according to the data extraction table;

[0169] According to the data extraction table, the data of other business tables except the target business table in the target database is deleted.

[0170] Optionally, the migration module 1003 is specifically configured to: if the migration mode is a non-first migration mode, copy the business data of the target business table in the source database to the target database according to the data extraction table;

[0171] According to the data extraction table, delete the business data of the target business table in the source database.

[0172] Optionally, the extraction module 1002 is further used to: perform a second identity verification using a corresponding verification password in a user setting table in the intermediate database according to the data migration operation input through the visualization page and the second verification password information;

[0173] If the second identity verification passes, the data migration state is entered and the migration start time of this migration is obtained;

[0174] Obtain the amount of migration data for this migration from the target database;

[0175] The migration start time, migration mode information, and migration data volume are all written into the migration record table in the intermediate database;

[0176] Call the migration record table to display the migration data volume in the visualization page.

[0177] Optionally, the migration module 1003 is further used to: verify, according to the data deletion operation input through the visualization page, whether the time interval between the input time of the data deletion operation and the data deletion time of the source database is greater than or equal to a preset time length;

[0178] According to the data extraction table, delete the data of other business tables except the target business table in the target database, including:

[0179] If the time interval is greater than or equal to the preset time length, data in other business tables other than the target business table in the target database are deleted according to the data extraction table.

[0180] Optionally, the extraction module 1002 is further used to: verify whether the data migration of the target business table is completed according to the migration end operation input through the visualization page and the data extraction table;

[0181] If the data migration of the target business table is completed, the migration end time of this migration is obtained and written into the migration record table in the intermediate database;

[0182] Generate a migration operation log based on the migration end time, migration start time, and migration data volume in the migration record table.

[0183] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.

[0184] The present application also provides a computer device, Fig.11 A schematic diagram of the structure of a computer device provided in an embodiment of the present application, such as Fig.11As shown, the computer and device include: a processor 1101, a memory 1102, and optionally, a bus 1103. The memory 1102 stores machine-readable instructions executable by the processor 1101. When the computer device is running, the processor 1101 communicates with the memory 1102 via the bus 1103. When the machine-readable instructions are executed by the processor 1101, the steps of the above-mentioned database data migration method are executed.

[0185] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned database data migration method are executed.

[0186] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0187] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or part of the technical solution that contributes to the prior art or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), disk or optical disk and other media that can store program code.

[0188] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.

Claims

1. A method for migrating database data, characterized in that: The method comprises: According to the information of the source database, the information of the target database and the information of the intermediate database inputted on the visualization page of the preset data migration tool, connecting to the source database, the target database and the intermediate database respectively; According to the information of the migration start and end time input through the visualization page and the business type of the data table to be migrated, searching the target business table of the migration start and end time under the business type from the source database, and extracting the table data of the target business table into the data extraction table in the intermediate database, wherein the data extraction table is used to store the migration comparison relationship of the business table under the business type; The business data of the target business table in the source database is migrated to the target database according to the migration mode information input through the visualization page and the data extraction table.

2. The method according to claim 1, characterized in that Before searching the source database for a target business table of the migration start and end time under the business type according to the information of the migration start and end time input through the visualization page and the business type, and extracting the table data of the target business table into the data extraction table, the method further includes: According to the data extraction operation input through the visualization page and the first verification password information, identity verification is performed using the corresponding verification password in the user setting table in the intermediate database; If the identity verification passes, the data extraction state is entered.

3. The method according to claim 1, characterized in that The step of searching the source database for a target business table of the migration start and end time under the business type according to the information of the migration start and end time input through the visualization page and the business type, and extracting the table data of the target business table into the data extraction table includes: According to the information of the migration start and end time and the business type, a backend data extraction thread is executed to search the target business table from the source database, and table data of the target business table is extracted into the data extraction table; The method further comprises: When executing the backend data extraction thread, a preset waiting animation is displayed on the visualization page; According to a preset interval, cyclically query whether the backend data extraction thread has finished executing; If the backend data extraction thread is finished, the preset waiting animation is stopped from being displayed on the visualization page, and an indication message indicating that the extraction is completed is displayed.

4. The method according to claim 1, characterized in that: After searching the source database for a target business table of the migration start and end time under the business type according to the information of the migration start and end time input through the visualization page and the business type of the data table to be migrated, and extracting the table data of the target business table into the data extraction table in the intermediate database, the method further includes: Displaying the table name of the target business table and the total data volume of the target business table on the visualization page; The table name of the data extraction table, the table name of the target business table, and the total data volume of the target business table are written into the migration record table in the intermediate database.

5. The method according to claim 1, characterized in that The migrating the business data of the target business table in the source database to the target database according to the information of the migration mode input through the visualization page and the data extraction table includes: If the migration mode is the first migration mode, deleting the business data of the target business table in the source database according to the data extraction table; According to the data extraction table, data in other business tables other than the target business table in the target database are deleted.

6. The method according to claim 1, characterized in that The migrating the business data of the target business table in the source database to the target database according to the information of the migration mode input through the visualization page and the data extraction table includes: If the migration mode is a non-first migration mode, copying the business data of the target business table in the source database to the target database according to the data extraction table; According to the data extraction table, the business data of the target business table in the source database is deleted.

7. The method according to claim 4, characterized in that The method further comprises: According to the data migration operation input through the visualization page and the second verification password information, a second identity verification is performed using the corresponding verification password in the user setting table in the intermediate database; If the second identity verification passes, the data migration state is entered and the migration start time of this migration is obtained; Acquire the migration data volume of the current migration from the target database; Writing the migration start time, the migration mode information, and the migration data volume into the migration record table in the intermediate database; The migration record table is called to display the migration data volume in the visualization page.

8. The method according to claim 5, characterized in that Before deleting data in other business tables other than the target business table in the target database according to the data extraction table, the method further includes: According to the data deletion operation input through the visualization page, verify whether the time interval between the input time of the data deletion operation and the data deletion time of the source database is greater than or equal to a preset time length; Deleting data in other business tables other than the target business table in the target database according to the data extraction table includes: If the time interval is greater than or equal to the preset time length, data in other business tables other than the target business table in the target database are deleted according to the data extraction table.

9. The method according to claim 7, characterized in that: The method further comprises: Verifying whether the data migration of the target business table is completed according to the migration end operation input through the visualization page and the data extraction table; If the data migration of the target business table is completed, the migration end time of this migration is obtained, and the migration end time is written into the migration record table in the intermediate database; A migration operation log is generated according to the migration end time, the migration start time and the migration data volume in the migration record table.

10. A computer device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor executes the machine-readable instructions to perform the steps of the method for migrating database data as described in any one of claims 1 to 9.