Database synchronization method and device, storage medium and electronic device

By filtering the target synchronization timing information, rule information and update information of the target data table in the database, the data is directly sent to the target database, which solves the problem of low database synchronization efficiency and realizes efficient data synchronization.

CN117033516BActive Publication Date: 2025-09-30INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311041606.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-17
Publication Date
2025-09-30
Estimated Expiration
2043-08-17

AI Technical Summary

Technical Problem

In the prior art, data synchronization between databases is inefficient and prone to message queue blockage and data loss.

Method used

By detecting the target data table in the source database, the target data is filtered out using the target synchronization timing information, target synchronization rule information, update time information and update type information, and sent directly to the target database for synchronization, avoiding the use of SQL statements and reducing the depth of the message queue.

Benefits of technology

It improves the synchronization efficiency of the database, avoids message queue blockage and data loss, and improves the speed and reliability of data synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117033516B_ABST
    Figure CN117033516B_ABST
Patent Text Reader

Abstract

The present application discloses a database synchronization method and device, storage medium and electronic device. Relating to the field of financial technology, the method comprises: when a target data table is detected in a source database, finding the target synchronization timing information and target synchronization rule information corresponding to the target data table from the data table, synchronization timing information and synchronization rule information with corresponding relationships; filtering out target data from the target data table according to the target synchronization timing information, target synchronization rule information, update time information and update type information, wherein the target data is all or part of the data in the target data table, and the part of the data is the data in the target data table whose update time occurs after the synchronization time point of the last synchronization and before the update time point of the last data update; sending the target data to the target database to synchronize the target data table. Through this application, the problems of low database synchronization efficiency in the related art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of financial technology, and specifically, to a database synchronization method and device, a storage medium, and an electronic device. Background Art

[0002] Synchronizing data between different databases is a frequently performed operation between databases. Currently, methods for synchronizing data between databases include: performing data double writing based on message queue-based synchronization of SQL (Structured Query Language, a standardized language for managing relational databases) statements. Before the first database executes the first function, the first control device stores the SQL statement in a storage space and sends it to a message queue server after the first database successfully executes it. The message queue server sends the SQL statement in at least one message queue to the second control device based on the subscription information of the second control device. The second database executes the SQL statement to complete data synchronization.

[0003] The above approach requires storing SQL statements in the source database (i.e., the first database) and sending them to the message queue after the first function is executed. This approach can cause the database to execute a large number of SQL statements in a short period of time, increasing the depth of the message queue and causing message congestion. Executing SQL statements sequentially can prolong data synchronization and even lead to the loss of SQL statements in the message queue, resulting in data synchronization failure.

[0004] Currently, no effective solution has been proposed to address the problems of low database synchronization efficiency in related technologies. Summary of the Invention

[0005] The main purpose of this application is to provide a database synchronization method and device, a storage medium and an electronic device to solve the problem of low database synchronization efficiency in related technologies.

[0006] To achieve the above objectives, according to one aspect of the present application, a method for synchronizing a database is provided. The method comprises:

[0007] In the case where a target data table is detected in the source database, the target synchronization timing information and target synchronization rule information corresponding to the target data table are found from the data tables, synchronization timing information and synchronization rule information having corresponding relationships, wherein the target data table is a data table in the source database to be synchronized to the target database, and the target data table records update time information and update type information, the update time information is used to indicate the update time point of the last data update in the target data table, the update type information is used to indicate the update type of each updated data in the target data table, the target synchronization timing information is used to indicate the synchronization time point of the last synchronization of the target data table, and the time interval for synchronizing the target data table, and the target synchronization rule information is used to indicate the method for synchronizing the data in the target data table from the source database to the target database;

[0008] Filtering target data from the target data table according to the target synchronization timing information, the target synchronization rule information, the update time information, and the update type information, wherein the target data is all or part of the data in the target data table, and the part of the data is data in the target data table whose update time occurs after the synchronization time point of the last synchronization and before the update time point of the last data update;

[0009] The target data is sent to the target database to synchronize the target data table.

[0010] Optionally, filtering out target data from the target data table according to the target synchronization timing information, the target synchronization rule information, the update time information, and the update type information includes:

[0011] In a case where the target synchronization rule information is used to indicate that the mode in which the data in the target data table is synchronized from the source database to the target database is a full synchronization mode, all the data recorded in the target data table is determined as the target data;

[0012] When the target synchronization rule information is used to indicate that the data in the target data table is synchronized from the source database to the target database in an incremental synchronization mode, the target data is filtered out from the target data table according to the target synchronization timing information, the update time information and the update type information.

[0013] Optionally, filtering out the target data from the target data table according to the target synchronization timing information, the update time information, and the update type information includes:

[0014] The data in the target data table whose updated time falls after the synchronization time point and before the update time point and whose update type information is the modification type of this library is determined as the target data, wherein the data in the target data table whose modification type is the modification type of this library is obtained by modifying the data in the source database.

[0015] Optionally, sending the target data to the target database to synchronize the target data table includes:

[0016] detecting a data state of the target data;

[0017] In a case where the data status indicates that the target data currently allows a synchronization operation to be performed, converting the target data into a target data file, wherein the target data file carries a target data table identifier corresponding to the target data table;

[0018] Call a data transfer tool to transfer the target data file from the source database to the target database, wherein the target database is used to find out the target synchronization rule information corresponding to the target data table from the data tables and synchronization rule information with corresponding relationships when receiving the target data file; and synchronize the target data in the target data file to the target database according to the target synchronization rule information when receiving a data synchronization instruction.

[0019] Optionally, synchronizing the target data in the target data file to the target database according to the target synchronization rule information includes:

[0020] When the target synchronization rule information indicates that the data in the target data table is synchronized from the source database to the target database in a full synchronization mode, clearing the data recorded in the reference data table in the target database for receiving the target data, and importing the target data into the cleared reference data table;

[0021] In a case where the target synchronization rule information is used to indicate that the data in the target data table is synchronized from the source database to the target database in an incremental synchronization mode, the target data is inserted into a corresponding position in the reference data table.

[0022] Optionally, detecting the data status of the target data includes:

[0023] In a case where the target synchronization status information corresponding to the target data table indicates that the target data table does not allow a data synchronization operation to be performed, determining that the data status indicates that the target data table currently does not allow a synchronization operation to be performed;

[0024] In a case where the target synchronization state information is used to indicate that the target data table allows a data synchronization operation to be performed, but a reference time difference is less than a time interval indicated by the target synchronization timing information, determining that the data state is used to indicate that the target data table currently does not allow a synchronization operation to be performed, wherein the reference time difference is a time difference between a synchronization time point indicated by the target synchronization timing information and a current time point;

[0025] When the target synchronization status information is used to indicate that the target data table allows data synchronization operations, and the reference time difference is greater than or equal to the time interval indicated by the target synchronization timing information, it is determined that the data status is used to indicate that the target data currently allows synchronization operations.

[0026] Optionally, after sending the target data to the target database to synchronize the target data table, the method further includes:

[0027] The synchronization time point indicated by the synchronization timing information is updated to the time point when the target data table is most recently synchronized in the target database.

[0028] To achieve the above-mentioned purpose, according to another aspect of the present application, a database synchronization device is provided. The device includes:

[0029] A search module is configured to, when a target data table is detected in a source database, search for target synchronization timing information and target synchronization rule information corresponding to the target data table from data tables, synchronization timing information, and synchronization rule information having corresponding relationships, wherein the target data table is a data table in the source database to be synchronized to the target database, and the target data table records update time information and update type information, the update time information is used to indicate the update time point of the last data update in the target data table, the update type information is used to indicate the update type of each updated data in the target data table, the target synchronization timing information is used to indicate the synchronization time point of the last synchronization of the target data table, and the time interval for synchronizing the target data table, and the target synchronization rule information is used to indicate the method for synchronizing the data in the target data table from the source database to the target database;

[0030] a screening module, configured to screen target data from the target data table according to the target synchronization timing information, the target synchronization rule information, the update time information, and the update type information, wherein the target data is all or part of the data in the target data table, and the part of the data is data in the target data table whose update time occurs after the synchronization time point of the last synchronization and before the update time point of the last data update;

[0031] A sending module is used to send the target data to the target database to synchronize the target data table.

[0032] Through the present application, the following steps are adopted: when a target data table is detected in a source database, the target synchronization timing information and target synchronization rule information corresponding to the target data table are found from the data tables, synchronization timing information and synchronization rule information with corresponding relationships, wherein the target data table is a data table in the source database to be synchronized to the target database, and the target data table records the update time information and update type information, the update time information is used to indicate the update time point of the last data update of the target data table, the update type information is used to indicate the update type of each updated data in the target data table, the target synchronization timing information is used to indicate the synchronization time point of the last synchronization of the target data table, and the time interval for synchronizing the target data table, the target synchronization rule information is used to indicate the method for synchronizing the data in the target data table from the source database to the target database; according to the target synchronization timing information, target synchronization rule information, update time information and update type information The target data is filtered out from the target data table, wherein the target data is all or part of the data in the target data table, and the part of the data is data in the target data table whose update time occurs after the synchronization time point of the last synchronization and before the update time point of the last data update; the target data is sent to the target database to synchronize the target data table. In the above method, the target synchronization timing information, target synchronization rule information, update time information, and update type information of the target data table are found, and the target data is directly filtered out from the target data table based on the target synchronization timing information, target synchronization rule information, update time information, and update type information. The target data is then sent to the target database to synchronize the target data table. The above database synchronization process does not require the use of SQL statements, so there is no large number of SQL statements that increase the depth of the message queue and cause message blocking. This solves the problem of low database synchronization efficiency in related technologies. Thus, the technical effect of improving database synchronization efficiency is achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The accompanying drawings, which constitute part of this application, are intended to provide a further understanding of this application. The exemplary embodiments and descriptions of this application are intended to explain this application and do not constitute an improper limitation on this application. In the accompanying drawings:

[0034] Figure 1 is a flowchart of a database synchronization method provided according to an embodiment of the present application;

[0035] Figure 2 is a schematic diagram of target data provided according to an embodiment of the present application;

[0036] Figure 3 is a schematic diagram of exporting target data from a source database according to an embodiment of the present application;

[0037] Figure 4 This is a schematic diagram of a target database receiving target data according to an embodiment of the present application;

[0038] Figure 5 is a schematic diagram of a database synchronization device according to an embodiment of the present application;

[0039] Figure 6 is a schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0040] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0041] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0042] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0043] For ease of description, some nouns or terms involved in the embodiments of the present application are explained below:

[0044] DATA_SYNC_CTL: data synchronization control table;

[0045] LAST_SYNC_TIME: the latest data synchronization time of the table;

[0046] SYNC_STSTUS: data synchronization switch, 0-on, 1-off;

[0047] SYNC_INTERVAL: the time interval for data synchronization;

[0048] LAST_UPDATE_TIME: the latest modification time of table data;

[0049] MODIFY_TYPE: data modifier type, 0-data is modified in this database, 1-data is synchronized from another database.

[0050] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display and analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving the consent information fed back by the aforementioned user or organization.

[0051] The present invention will be described below in conjunction with preferred implementation steps. Figure 1 is a flowchart of a database synchronization method provided according to an embodiment of the present application, such as Figure 1 As shown, the method includes the following steps:

[0052] Step S102: When a target data table is detected in the source database, target synchronization timing information and target synchronization rule information corresponding to the target data table are found from the data tables, synchronization timing information, and synchronization rule information having corresponding relationships, wherein the target data table is a data table in the source database to be synchronized to the target database, and the target data table records update time information and update type information, the update time information is used to indicate the update time point of the last data update in the target data table, the update type information is used to indicate the update type of each updated data in the target data table, the target synchronization timing information is used to indicate the synchronization time point of the last synchronization of the target data table, and the time interval for synchronizing the target data table, and the target synchronization rule information is used to indicate the method for synchronizing the data in the target data table from the source database to the target database;

[0053] Step S104: Filtering target data from the target data table according to the target synchronization timing information, the target synchronization rule information, the update time information, and the update type information, wherein the target data is all or part of the data in the target data table, and the part of the data is data in the target data table whose update time occurs after the synchronization time point of the last synchronization and before the update time point of the last data update;

[0054] Step S106: Send the target data to the target database to synchronize the target data table.

[0055] Through the above steps, when the target data table is detected in the source database, the target synchronization timing information and target synchronization rule information corresponding to the target data table are found from the data tables, synchronization timing information and synchronization rule information with corresponding relationships, wherein the target data table is the data table in the source database to be synchronized to the target database, and the target data table records the update time information and update type information, the update time information is used to indicate the update time point of the last data update in the target data table, the update type information is used to indicate the update type of each updated data in the target data table, the target synchronization timing information is used to indicate the synchronization time point of the last synchronization of the target data table, and the time interval for synchronizing the target data table, the target synchronization rule information is used to indicate the method of synchronizing the data in the target data table from the source database to the target database; according to the target synchronization timing information, the target synchronization rule information, the update time information and the update type information, the target data table is synchronized from the target data table Target data is filtered out, wherein the target data is all or part of the data in the target data table, and the part of the data is data in the target data table whose update time occurs after the synchronization time point of the last synchronization and before the update time point of the last data update; the target data is sent to the target database to synchronize the target data table. In the above method, the target synchronization timing information, target synchronization rule information, update time information, and update type information of the target data table are found, and the target data is directly filtered out from the target data table based on the target synchronization timing information, target synchronization rule information, update time information, and update type information. The target data is then sent to the target database to synchronize the target data table. The above database synchronization process does not require the use of SQL statements, so there is no large number of SQL statements that increase the depth of the message queue and cause message blocking. This solves the problem of low database synchronization efficiency in related technologies. Thus, the technical effect of improving database synchronization efficiency is achieved.

[0056] In the technical solution provided in the above step S102, the data tables, synchronization timing information and synchronization rule information with corresponding relationships can be, but are not limited to, recorded in the data synchronization control table (DATA_SYNC_CTL), wherein the data synchronization control table is used to control the synchronization process of the target data in the target data table. There are multiple data tables in the source database. The data table to be synchronized to the target database in the multiple data tables is called the target data table. Obviously, there may be multiple target data tables. Here, the process of synchronizing a target data table from the source database to the target database is taken as an example. The remaining data tables can all use the synchronization mechanism of the target data table. It is worth noting that the above data synchronization control table is not only used for the synchronization process of the target data in the target data table, but all data tables in the source database can find the corresponding synchronization timing information and synchronization rule information from the data synchronization control table. Among them, the fields recorded in the data synchronization control table are shown in Table 1 below:

[0057] Table 1

[0058] Serial number Field Name Notes 1 SYNC_ID Synchronization ID 2 TABLE_NAME Name of the table to be synchronized 3 SYNC_INTERVAL Synchronization interval 4 LAST_SYNC_TIME The latest data synchronization time of the table 5 SYNC_STATUS Data synchronization switch, 0-on, 1-off 6 INCREMENT_FLAG Data synchronization mode 0-incremental, 1-full

[0059] The following is an explanation of the specific meaning of each field in Table 1:

[0060] SYNC_ID: Synchronization ID. The data synchronization control table is not only used for synchronizing target data in the target data table, but also for all data tables in the source database. The corresponding synchronization timing information and synchronization rule information can be found in the data synchronization control table. That is, each data table in the source database corresponds to a unique SYNC_ID.

[0061] TABLE_NAME: The name of the table to be synchronized. For example, if the target table is the table in the source database to be synchronized to the target database, the name of the target table is TABLE_NAME.

[0062] SYNC_INTERVAL: synchronization interval, used to indicate the time interval for synchronizing a data table from the source database to the target database (i.e., the time interval for synchronizing the target data table);

[0063] LAST_SYNC_TIME: The latest data synchronization time of the table, that is, the synchronization time point of the target data table last synchronization;

[0064] SYNC_STATUS: data synchronization switch, 0-on, 1-off. When the data synchronization switch is set to 0, it means that the target data table currently allows synchronization operations. When the data synchronization switch is set to 1, it means that the target data table currently does not allow synchronization operations.

[0065] INCREMENT_FLAG: Data synchronization mode: 0 - incremental, 1 - full. When the data synchronization mode is set to 0, it indicates that the data synchronization mode is incremental. When the data synchronization mode is set to 1, it indicates that the data synchronization mode is full.

[0066] The fields recorded in the data synchronization control table are described above. The fields recorded in the target data table are described below. The target data table that controls the data synchronization method through the data synchronization control table needs to record the fields shown in Table 2:

[0067] Table 2

[0068]

[0069] The following is an explanation of the specific meaning of each field in Table 2:

[0070] LAST_UPDATE_TIME: The latest modification time of the data, that is, the update time information, which is used to indicate the update time point of the last data update in the target data table;

[0071] MODIFY_TYPE: Data modifier type, used to indicate the modifier type of the most recently updated data in the target data table. When MODIFY_TYPE is set to 0, it indicates that the data modifier type is modified by this database. When MODIFY_TYPE is set to 1, it indicates that the data modifier type is synchronized from another database.

[0072] Optionally, in this embodiment, when a target data table is detected in the source database, the target synchronization timing information and target synchronization rule information corresponding to the target data table are found from the data table, synchronization timing information and synchronization rule information with corresponding relationships (i.e., Table 1), wherein the target data table is the data table in the source database to be synchronized to the target database, and the target data table records the update time information and update type information. The update time information (i.e., the LAST_UPDATE_TIME field in Table 2) is used to indicate the update time point of the last data update of the target data table, and the update type information is used to indicate the update time point of the last data update of the target data table. The target synchronization timing information is used to indicate the update type of each updated data in the target data table (i.e., the MODIFY_TYPE field in Table 2); the target synchronization timing information is used to indicate the synchronization time point of the last synchronization of the target data table (i.e., the LAST_SYNC_TIME field in Table 1), and the time interval for synchronizing the target data table (i.e., the SYNC_INTERVAL field in Table 1); the target synchronization rule information (i.e., the INCREMENT_FLAG field in Table 1) is used to indicate the method for synchronizing the data in the target data table from the source database to the target database;

[0073] In the technical solution provided in the above step S104, the target data is screened out from the target data table based on the target synchronization timing information, the target synchronization rule information, the update time information and the update type information.

[0074] In an exemplary embodiment, the target data can be filtered out from the target data table according to the target synchronization timing information, the target synchronization rule information, the update time information and the update type information in the following manner, but not limited to: when the target synchronization rule information is used to indicate that the method for synchronizing the data in the target data table from the source database to the target database is a full synchronization method, all the data recorded in the target data table is determined as the target data; when the target synchronization rule information is used to indicate that the method for synchronizing the data in the target data table from the source database to the target database is an incremental synchronization method, the target data is filtered out from the target data table according to the target synchronization timing information, the update time information and the update type information.

[0075] Optionally, in this embodiment, for example, the target data table records 100 pieces of data, of which the last 40 pieces are newly added data. When the target synchronization rule information is used to indicate that the data in the target data table is synchronized from the source database to the target database in a full synchronization mode, all the data recorded in the target data table is determined as the target data (i.e., 100 pieces). When the target synchronization rule information is used to indicate that the data in the target data table is synchronized from the source database to the target database in an incremental synchronization mode, the target data (i.e., 40 pieces of newly added data) are filtered out from the target data table according to the target synchronization timing information, the update time information, and the update type information.

[0076] In an exemplary embodiment, the target data can be filtered out from the target data table according to the target synchronization timing information, the update time information and the update type information in the following manner, but not limited to: the data in the target data table whose updated time falls after the synchronization time point and before the update time point and whose update type information is the modification type of this library is determined as the target data, wherein the data in the target data table whose modification type is the modification type of this library is obtained by modifying the data in the source database.

[0077] Optionally, in this embodiment, Figure 2 is a schematic diagram of target data provided according to an embodiment of the present application, such as Figure 2As shown, there are 100 pieces of data in the target data table, among which the data from the 61st piece (DATE 61) to the 100th piece (DATE 100) are updated after the synchronization time point and before the update time point, and the update type information of the 62nd piece (DATE 62) to the 100th piece (DATE 100) is the local library modification type, so the data from the 62nd piece (DATE 62) to the 100th piece (DATE 100) are determined as the target data.

[0078] In the technical solution provided in step S106 above, unlike the related art method of using SQL statements to synchronize data, the database synchronization method proposed in this application directly sends the target data to the target database after determining the target data. After receiving the target data, the target database performs data synchronization. This avoids the problem of increasing the depth of the message queue and causing message blocking caused by using SQL statements, reduces data synchronization time, and improves database synchronization efficiency.

[0079] In an exemplary embodiment, the target data can be sent to the target database to synchronize the target data table in the following manner, but is not limited to: detecting the data status of the target data; when the data status is used to indicate that the target data currently allows synchronization operations to be performed, converting the target data into a target data file, wherein the target data file carries a target data table identifier corresponding to the target data table; calling a data transfer tool to transfer the target data file from the source database to the target database, wherein the target database is used to find the target synchronization rule information corresponding to the target data table from the data tables and synchronization rule information with corresponding relationships when receiving the target data file; and when receiving a data synchronization instruction, synchronizing the target data in the target data file to the target database according to the target synchronization rule information.

[0080] Optionally, in this embodiment, when SYNC_STATUS in the data synchronization control table is set to 1, it indicates that the target data table is currently not allowed to perform synchronization operations, that is, the data status is used to indicate that the target data is currently not allowed to perform synchronization operations; and when SYNC_STATUS in the data synchronization control table is set to 0, it indicates that the target data table is currently allowed to perform synchronization operations, that is, the data status is used to indicate that the target data is currently allowed to perform synchronization operations.

[0081] Optionally, in this embodiment, converting the target data into a target data file may be, but is not limited to, converting the target data into a compressed file, wherein the name of the compressed file carries a target data table identifier corresponding to the target data table.

[0082] In an exemplary embodiment, the target data in the target data file can be synchronized to the target database according to the target synchronization rule information in the following manner, but not limited to: when the target synchronization rule information is used to indicate that the method for synchronizing the data in the target data table from the source database to the target database is a full synchronization method, the data recorded in the reference data table in the target database for receiving the target data is cleared, and the target data is imported into the cleared reference data table; when the target synchronization rule information is used to indicate that the method for synchronizing the data in the target data table from the source database to the target database is an incremental synchronization method, the target data is inserted into the corresponding position in the reference data table.

[0083] Optionally, in this embodiment, when the target synchronization rule information is used to indicate that the data in the target data table is synchronized from the source database to the target database in a full synchronization mode, that is, all the data recorded in the target data table is target data, if the target data is to be synchronized to the target database, in order to avoid duplication of the historically synchronized data of the reference data table in the target database and the data synchronized this time, the reference data table can be cleared and then the cleared reference data table can be imported.

[0084] In an exemplary embodiment, the data status of the target data can be detected in the following manner, but is not limited to: when the target synchronization status information corresponding to the target data table is used to indicate that the target data table does not allow data synchronization operations to be performed, determining that the data status is used to indicate that the target data currently does not allow synchronization operations to be performed; when the target synchronization status information is used to indicate that the target data table allows data synchronization operations to be performed, but the reference time difference is less than the time interval indicated by the target synchronization timing information, determining that the data status is used to indicate that the target data currently does not allow synchronization operations to be performed, wherein the reference time difference is the time difference between the synchronization time point indicated by the target synchronization timing information and the current time point; when the target synchronization status information is used to indicate that the target data table allows data synchronization operations to be performed, and the reference time difference is greater than or equal to the time interval indicated by the target synchronization timing information, determining that the data status is used to indicate that the target data currently allows synchronization operations to be performed.

[0085] Optionally, in this embodiment, when SYNC_STATUS in the data synchronization control table is set to 1, it indicates that the target data table is not currently allowed to perform synchronization operations, that is, the data status is used to indicate that the target data is not currently allowed to perform synchronization operations; and when SYNC_STATUS in the data synchronization control table is set to 0, it indicates that the target data table is currently allowed to perform synchronization operations, but the reference time difference is less than the time interval indicated by the target synchronization timing information, indicating that the time for performing the synchronization operation has not yet arrived. At this time, it is determined that the data status is used to indicate that the target data is not currently allowed to perform synchronization operations. When the reference time difference is greater than or equal to the time interval indicated by the target synchronization timing information, it indicates that the synchronization operation has reached the execution time, and then it is determined that the data status is used to indicate that the target data is currently allowed to perform synchronization operations.

[0086] In an exemplary embodiment, after sending the target data to the target database to synchronize the target data table, the following method may be included but is not limited to: updating the synchronization time point indicated by the synchronization timing information to the time point when the target data table was most recently synchronized in the target database.

[0087] Optionally, in this embodiment, each time the target data table is synchronized with the target database, the synchronization time indicated by the synchronization sequence information may be updated to the time at which the target data table was most recently synchronized with the target database. For example, if the synchronization time indicated by the synchronization sequence information was 11:00 AM and the target data table was synchronized with the target database at 12:00 PM, the synchronization time indicated by the synchronization sequence information may be updated from 11:00 AM to 12:00 PM.

[0088] It should be noted that the above embodiment uses the process of synchronizing the target data table from the source database to the target database to illustrate the database synchronization method. The following describes the steps performed by the source database and the target database during the database synchronization process:

[0089] 1. Source Database

[0090] Figure 3 is a schematic diagram of exporting target data from a source database according to an embodiment of the present application, such as Figure 3 As shown, the following steps are included:

[0091] Step 301: Determine whether data synchronization is enabled based on SYNC_STATUS (data synchronization switch) in the data synchronization control table DATA_SYNC_CTL, and determine whether the target data is currently allowed to perform synchronization operations based on LAST_SYNC_TIME (latest data synchronization time) and SYNC_INTERVAL (synchronization interval);

[0092] Step 302: Filter the target data to be synchronized this time, query the LAST_UPDATE_TIME (latest modification time of the data) and MODIFY_TYPE (data modifier type, data generation method) recorded in the target data table to obtain the target data to be synchronized this time in the target data table;

[0093] Step 303: Determine whether the data synchronization condition is met: LAST_SYNC_TIME+SYNC_INTERVAL<this synchronization time:

[0094] Step 303-1: If INCREMENT_FLAG indicates full synchronous export, then perform full table data export;

[0095] Step 303-2: If INCREMENT_FLAG indicates incremental synchronization export, then export data where the LAST_UPDATE_TIME of the table to be synchronized is greater than the LAST_SYNC_TIME recorded in the synchronization control table DATA_SYNC_CTL and MODIFY_TYPE='0';

[0096] Step 304: If the export is successful, a delay of a set time is set to wait for the next processing (target data file name: SYNC_ID_+INCREMENT_FLAG_traceId.zip), and the target data file is transferred to the target database using the GTP transfer tool. If the export fails, an alarm is triggered and a log is recorded.

[0097] 2. Target Database

[0098] Figure 4 Schematic diagram of a target database receiving target data according to an embodiment of the present application. Figure 4 As shown, the following steps are included:

[0099] Step 401: Parse the target data file's file name to obtain the data table to which the target data belongs and the target data import method (target data file's file name: SYNC_ID_+INCREMENT_FLAG_trace Id.zip, obtain the target data's synchronization method from the data synchronization control table DATA_SYNC_CTL based on SYNC_ID);

[0100] Step 401-1: Obtain the task start status of the current synchronization task;

[0101] Step 402: When the synchronization task is started, the target data is imported (if the target data is synchronized in full, the data in the reference data table is first cleared, and then the target data is fully inserted into the cleared reference data table; if the target data is synchronized in incremental, a primary key match is performed, and if a match is found, the record whose LASTS_UPDATE_TIME in the reference data table is less than the LASTS_UPDATE_TIME in the target data file is updated). If the import fails, an alarm is triggered and a log is recorded;

[0102] Step 403: If the import is successful, the process will be delayed for a set time and wait for the next processing.

[0103] This application provides a low-complexity data synchronization algorithm that can quickly recover data in abnormal situations. It also provides a simple and configurable table-level data synchronization solution, thereby improving data synchronization efficiency.

[0104] The database synchronization method provided by the embodiment of the present application, when a target data table is detected in the source database, the target synchronization timing information and target synchronization rule information corresponding to the target data table are found from the data tables, synchronization timing information and synchronization rule information with corresponding relationships, wherein the target data table is a data table in the source database to be synchronized to the target database, and the target data table records the update time information and update type information, the update time information is used to indicate the update time point of the last data update of the target data table, the update type information is used to indicate the update type of each updated data in the target data table, the target synchronization timing information is used to indicate the synchronization time point of the last synchronization of the target data table, and the time interval for synchronizing the target data table, the target synchronization rule information is used to indicate the method of synchronizing the data in the target data table from the source database to the target database; according to the target synchronization timing information, the target synchronization rule information, the update time information and the update type information Target data is filtered out from a target data table, wherein the target data is all or part of the data in the target data table, and the part of the data is data in the target data table whose update time occurs after the synchronization time point of the last synchronization and before the update time point of the last data update; the target data is sent to a target database to synchronize the target data table. In the above method, target synchronization timing information, target synchronization rule information, update time information, and update type information of the target data table are found, and the target data is directly filtered out from the target data table based on the target synchronization timing information, target synchronization rule information, update time information, and update type information. The target data is then sent to the target database to synchronize the target data table. The above database synchronization process does not require the use of SQL statements, so there is no large number of SQL statements that increase the depth of the message queue and cause message blocking. This solves the problem of low database synchronization efficiency in related technologies, thereby achieving the technical effect of improving database synchronization efficiency.

[0105] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0106] The embodiment of the present application further provides a database synchronization device. It should be noted that the database synchronization device of the embodiment of the present application can be used to execute the database synchronization method provided in the embodiment of the present application. The database synchronization device provided in the embodiment of the present application is introduced below.

[0107] Figure 5 Schematic diagram of a database synchronization device according to an embodiment of the present application. Figure 5 As shown, the device includes:

[0108] A search module 502 is configured to search, when a target data table is detected in a source database, for target synchronization timing information and target synchronization rule information corresponding to the target data table from corresponding data tables, synchronization timing information, and synchronization rule information, wherein the target data table is a data table in the source database to be synchronized to the target database, and the target data table records update time information and update type information, wherein the update time information is used to indicate the update time point of the last data update in the target data table, the update type information is used to indicate the update type of each updated data in the target data table, the target synchronization timing information is used to indicate the synchronization time point of the last synchronization of the target data table, and the time interval for synchronizing the target data table, and the target synchronization rule information is used to indicate the method for synchronizing the data in the target data table from the source database to the target database;

[0109] a screening module 504, configured to screen target data from the target data table according to the target synchronization timing information, the target synchronization rule information, the update time information, and the update type information, wherein the target data is all or part of the data in the target data table, and the part of the data is data in the target data table whose update time occurs after the synchronization time point of the last synchronization and before the update time point of the last data update;

[0110] The sending module 506 is configured to send the target data to the target database to synchronize the target data table.

[0111] Optionally, in the database synchronization device provided in the embodiment of the present application, the screening module includes:

[0112] a first determining unit configured to determine all data recorded in the target data table as the target data when the target synchronization rule information indicates that a mode in which the data in the target data table is synchronized from the source database to the target database is a full synchronization mode;

[0113] The second determination unit is used to filter out the target data from the target data table according to the target synchronization timing information, the update time information and the update type information when the target synchronization rule information is used to indicate that the method in which the data in the target data table is synchronized from the source database to the target database is an incremental synchronization method.

[0114] Optionally, in the database synchronization device provided in the embodiment of the present application, the second determining unit is further configured to:

[0115] The data in the target data table whose updated time falls after the synchronization time point and before the update time point and whose update type information is the modification type of this library is determined as the target data, wherein the data in the target data table whose modification type is the modification type of this library is obtained by modifying the data in the source database.

[0116] Optionally, in the database synchronization device provided in an embodiment of the present application, the sending module includes:

[0117] a detection unit, configured to detect a data state of the target data;

[0118] a conversion unit, configured to convert the target data into a target data file when the data state indicates that the target data currently allows a synchronization operation to be performed, wherein the target data file carries a target data table identifier corresponding to the target data table;

[0119] A transmission unit is used to call a data transmission tool to transfer the target data file from the source database to the target database, wherein the target database is used to find out the target synchronization rule information corresponding to the target data table from the data tables and synchronization rule information with corresponding relationships when receiving the target data file; and when receiving a data synchronization instruction, synchronize the target data in the target data file to the target database according to the target synchronization rule information.

[0120] Optionally, in the database synchronization device provided in the embodiment of the present application, the transmission unit is further configured to:

[0121] When the target synchronization rule information indicates that the data in the target data table is synchronized from the source database to the target database in a full synchronization mode, clearing the data recorded in the reference data table in the target database for receiving the target data, and importing the target data into the cleared reference data table;

[0122] In a case where the target synchronization rule information is used to indicate that the data in the target data table is synchronized from the source database to the target database in an incremental synchronization mode, the target data is inserted into a corresponding position in the reference data table.

[0123] Optionally, in the database synchronization device provided in the embodiment of the present application, the detection unit is further configured to:

[0124] In a case where the target synchronization status information corresponding to the target data table indicates that the target data table does not allow a data synchronization operation to be performed, determining that the data status indicates that the target data table currently does not allow a synchronization operation to be performed;

[0125] In a case where the target synchronization state information is used to indicate that the target data table allows a data synchronization operation to be performed, but a reference time difference is less than a time interval indicated by the target synchronization timing information, determining that the data state is used to indicate that the target data table currently does not allow a synchronization operation to be performed, wherein the reference time difference is a time difference between a synchronization time point indicated by the target synchronization timing information and a current time point;

[0126] When the target synchronization status information is used to indicate that the target data table allows data synchronization operations, and the reference time difference is greater than or equal to the time interval indicated by the target synchronization timing information, it is determined that the data status is used to indicate that the target data currently allows synchronization operations.

[0127] Optionally, in the database synchronization device provided in the embodiment of the present application, the device further includes:

[0128] An updating module is configured to update the synchronization time point indicated by the synchronization timing information to the time point at which the target data table was most recently synchronized in the target database after the target data is sent to the target database to synchronize the target data table.

[0129] The database synchronization device provided by the embodiment of the present application, when a target data table is detected in the source database, finds the target synchronization timing information and target synchronization rule information corresponding to the target data table from the data tables, synchronization timing information and synchronization rule information with corresponding relationships, wherein the target data table is a data table in the source database to be synchronized to the target database, and the target data table records the update time information and update type information, the update time information is used to indicate the update time point of the last data update of the target data table, the update type information is used to indicate the update type of each updated data in the target data table, the target synchronization timing information is used to indicate the synchronization time point of the last synchronization of the target data table, and the time interval for synchronizing the target data table, the target synchronization rule information is used to indicate the method of synchronizing the data in the target data table from the source database to the target database; according to the target synchronization timing information, the target synchronization rule information, the update time information and the update type information Target data is filtered out from a target data table, wherein the target data is all or part of the data in the target data table, and the part of the data is data in the target data table whose update time occurs after the synchronization time point of the last synchronization and before the update time point of the last data update; the target data is sent to a target database to synchronize the target data table. In the above method, target synchronization timing information, target synchronization rule information, update time information, and update type information of the target data table are found, and the target data is directly filtered out from the target data table based on the target synchronization timing information, target synchronization rule information, update time information, and update type information. The target data is then sent to the target database to synchronize the target data table. The above database synchronization process does not require the use of SQL statements, so there is no large number of SQL statements that increase the depth of the message queue and cause message blocking. This solves the problem of low database synchronization efficiency in related technologies, thereby achieving the technical effect of improving database synchronization efficiency.

[0130] The database synchronization device includes a processor and a memory. The above units are all stored in the memory as program units, and the processor executes the above program units stored in the memory to realize corresponding functions.

[0131] The processor contains a kernel, which retrieves the corresponding program unit from the memory. You can set one or more kernels, and adjust the kernel parameters to improve the efficiency of database synchronization.

[0132] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0133] An embodiment of the present invention provides a computer-readable storage medium storing a program, which implements the database synchronization method when executed by a processor.

[0134] An embodiment of the present invention provides a processor, which is used to run a program, wherein the database synchronization method is executed when the program is running.

[0135] Figure 6 Schematic diagram of an electronic device according to an embodiment of the present application. Figure 6 As shown, an embodiment of the present invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented:

[0136] In the case where a target data table is detected in the source database, the target synchronization timing information and target synchronization rule information corresponding to the target data table are found from the data tables, synchronization timing information and synchronization rule information having corresponding relationships, wherein the target data table is a data table in the source database to be synchronized to the target database, and the target data table records update time information and update type information, the update time information is used to indicate the update time point of the last data update in the target data table, the update type information is used to indicate the update type of each updated data in the target data table, the target synchronization timing information is used to indicate the synchronization time point of the last synchronization of the target data table, and the time interval for synchronizing the target data table, and the target synchronization rule information is used to indicate the method for synchronizing the data in the target data table from the source database to the target database;

[0137] Filtering target data from the target data table according to the target synchronization timing information, the target synchronization rule information, the update time information, and the update type information, wherein the target data is all or part of the data in the target data table, and the part of the data is data in the target data table whose update time occurs after the synchronization time point of the last synchronization and before the update time point of the last data update;

[0138] The target data is sent to the target database to synchronize the target data table.

[0139] Optionally, the processor may further implement the following steps when executing the program:

[0140] In a case where the target synchronization rule information is used to indicate that the mode in which the data in the target data table is synchronized from the source database to the target database is a full synchronization mode, all the data recorded in the target data table is determined as the target data;

[0141] When the target synchronization rule information is used to indicate that the data in the target data table is synchronized from the source database to the target database in an incremental synchronization mode, the target data is filtered out from the target data table according to the target synchronization timing information, the update time information and the update type information.

[0142] Optionally, the processor may further implement the following steps when executing the program:

[0143] The data in the target data table whose updated time falls after the synchronization time point and before the update time point and whose update type information is the modification type of this library is determined as the target data, wherein the data in the target data table whose modification type is the modification type of this library is obtained by modifying the data in the source database.

[0144] Optionally, the processor may further implement the following steps when executing the program:

[0145] detecting a data state of the target data;

[0146] In a case where the data status indicates that the target data currently allows a synchronization operation to be performed, converting the target data into a target data file, wherein the target data file carries a target data table identifier corresponding to the target data table;

[0147] Call a data transfer tool to transfer the target data file from the source database to the target database, wherein the target database is used to find out the target synchronization rule information corresponding to the target data table from the data tables and synchronization rule information with corresponding relationships when receiving the target data file; and synchronize the target data in the target data file to the target database according to the target synchronization rule information when receiving a data synchronization instruction.

[0148] Optionally, the processor may further implement the following steps when executing the program:

[0149] When the target synchronization rule information indicates that the data in the target data table is synchronized from the source database to the target database in a full synchronization mode, clearing the data recorded in the reference data table in the target database for receiving the target data, and importing the target data into the cleared reference data table;

[0150] In a case where the target synchronization rule information is used to indicate that the data in the target data table is synchronized from the source database to the target database in an incremental synchronization mode, the target data is inserted into a corresponding position in the reference data table.

[0151] Optionally, the processor may further implement the following steps when executing the program:

[0152] In a case where the target synchronization status information corresponding to the target data table indicates that the target data table does not allow a data synchronization operation to be performed, determining that the data status indicates that the target data table currently does not allow a synchronization operation to be performed;

[0153] In a case where the target synchronization state information is used to indicate that the target data table allows a data synchronization operation to be performed, but a reference time difference is less than a time interval indicated by the target synchronization timing information, determining that the data state is used to indicate that the target data table currently does not allow a synchronization operation to be performed, wherein the reference time difference is a time difference between a synchronization time point indicated by the target synchronization timing information and a current time point;

[0154] When the target synchronization status information is used to indicate that the target data table allows data synchronization operations, and the reference time difference is greater than or equal to the time interval indicated by the target synchronization timing information, it is determined that the data status is used to indicate that the target data currently allows synchronization operations.

[0155] Optionally, the processor may further implement the following steps when executing the program:

[0156] After sending the target data to the target database to synchronize the target data table, the synchronization time point indicated by the synchronization timing information is updated to the time point when the target data table was last synchronized in the target database.

[0157] The devices in this article can be servers, PCs, PADs, mobile phones, etc.

[0158] The present application also provides a computer program product which, when executed on a data processing device, is adapted to execute a program for initializing the following method steps:

[0159] In the case where a target data table is detected in the source database, the target synchronization timing information and target synchronization rule information corresponding to the target data table are found from the data tables, synchronization timing information and synchronization rule information having corresponding relationships, wherein the target data table is a data table in the source database to be synchronized to the target database, and the target data table records update time information and update type information, the update time information is used to indicate the update time point of the last data update in the target data table, the update type information is used to indicate the update type of each updated data in the target data table, the target synchronization timing information is used to indicate the synchronization time point of the last synchronization of the target data table, and the time interval for synchronizing the target data table, and the target synchronization rule information is used to indicate the method for synchronizing the data in the target data table from the source database to the target database;

[0160] Filtering target data from the target data table according to the target synchronization timing information, the target synchronization rule information, the update time information, and the update type information, wherein the target data is all or part of the data in the target data table, and the part of the data is data in the target data table whose update time occurs after the synchronization time point of the last synchronization and before the update time point of the last data update;

[0161] The target data is sent to the target database to synchronize the target data table.

[0162] Optionally, the computer program product, when executed on a data processing device, is adapted to execute an initialization program having the following method steps:

[0163] In a case where the target synchronization rule information is used to indicate that the mode in which the data in the target data table is synchronized from the source database to the target database is a full synchronization mode, all the data recorded in the target data table is determined as the target data;

[0164] When the target synchronization rule information is used to indicate that the data in the target data table is synchronized from the source database to the target database in an incremental synchronization mode, the target data is filtered out from the target data table according to the target synchronization timing information, the update time information and the update type information.

[0165] Optionally, the computer program product, when executed on a data processing device, is adapted to execute an initialization program having the following method steps:

[0166] The data in the target data table whose updated time falls after the synchronization time point and before the update time point and whose update type information is the modification type of this library is determined as the target data, wherein the data in the target data table whose modification type is the modification type of this library is obtained by modifying the data in the source database.

[0167] Optionally, the computer program product, when executed on a data processing device, is adapted to execute an initialization program having the following method steps:

[0168] detecting a data state of the target data;

[0169] In a case where the data status indicates that the target data currently allows a synchronization operation to be performed, converting the target data into a target data file, wherein the target data file carries a target data table identifier corresponding to the target data table;

[0170] Call a data transfer tool to transfer the target data file from the source database to the target database, wherein the target database is used to find out the target synchronization rule information corresponding to the target data table from the data tables and synchronization rule information with corresponding relationships when receiving the target data file; and synchronize the target data in the target data file to the target database according to the target synchronization rule information when receiving a data synchronization instruction.

[0171] Optionally, the computer program product, when executed on a data processing device, is adapted to execute an initialization program having the following method steps:

[0172] When the target synchronization rule information indicates that the data in the target data table is synchronized from the source database to the target database in a full synchronization mode, clearing the data recorded in the reference data table in the target database for receiving the target data, and importing the target data into the cleared reference data table;

[0173] In a case where the target synchronization rule information is used to indicate that the data in the target data table is synchronized from the source database to the target database in an incremental synchronization mode, the target data is inserted into a corresponding position in the reference data table.

[0174] Optionally, the computer program product, when executed on a data processing device, is adapted to execute an initialization program having the following method steps:

[0175] In a case where the target synchronization status information corresponding to the target data table indicates that the target data table does not allow a data synchronization operation to be performed, determining that the data status indicates that the target data table currently does not allow a synchronization operation to be performed;

[0176] In a case where the target synchronization state information is used to indicate that the target data table allows a data synchronization operation to be performed, but a reference time difference is less than a time interval indicated by the target synchronization timing information, determining that the data state is used to indicate that the target data table currently does not allow a synchronization operation to be performed, wherein the reference time difference is a time difference between a synchronization time point indicated by the target synchronization timing information and a current time point;

[0177] When the target synchronization status information is used to indicate that the target data table allows data synchronization operations, and the reference time difference is greater than or equal to the time interval indicated by the target synchronization timing information, it is determined that the data status is used to indicate that the target data currently allows synchronization operations.

[0178] Optionally, the computer program product, when executed on a data processing device, is adapted to execute an initialization program having the following method steps:

[0179] After sending the target data to the target database to synchronize the target data table, the synchronization time point indicated by the synchronization timing information is updated to the time point when the target data table was last synchronized in the target database.

[0180] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0181] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1A device that provides the functions specified in a block or multiple blocks.

[0182] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0183] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0184] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0185] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0186] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0187] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0188] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0189] The above are merely embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.

Claims

1. A database synchronization method, characterized in that: include: In the case where a target data table is detected in the source database, the target synchronization timing information and target synchronization rule information corresponding to the target data table are found from the data tables, synchronization timing information and synchronization rule information having corresponding relationships, wherein the target data table is a data table in the source database to be synchronized to the target database, and the target data table records update time information and update type information, the update time information is used to indicate the update time point of the last data update in the target data table, the update type information is used to indicate the update type of each updated data in the target data table, the target synchronization timing information is used to indicate the synchronization time point of the last synchronization of the target data table, and the time interval for synchronizing the target data table, and the target synchronization rule information is used to indicate the method for synchronizing the data in the target data table from the source database to the target database; Filtering target data from the target data table according to the target synchronization timing information, the target synchronization rule information, the update time information, and the update type information, wherein the target data is all or part of the data in the target data table, and the part of the data is data in the target data table whose update time occurs after the synchronization time point of the last synchronization and before the update time point of the last data update; Sending the target data to the target database to synchronize the target data table; Wherein, sending the target data to the target database to synchronize the target data table includes: detecting the data status of the target data; if the data status is used to indicate that the target data currently allows the synchronization operation to be performed, converting the target data into a target data file, wherein the target data file carries a target data table identifier corresponding to the target data table; calling a data transfer tool to transfer the target data file from the source database to the target database, wherein the target database is used to find the target synchronization rule information corresponding to the target data table from the data tables and synchronization rule information with corresponding relationships when receiving the target data file; and synchronizing the target data in the target data file to the target database according to the target synchronization rule information when receiving a data synchronization instruction; Wherein, the detecting of the data status of the target data includes: when the target synchronization status information corresponding to the target data table is used to indicate that the target data table does not allow the execution of data synchronization operations, determining that the data status is used to indicate that the target data currently does not allow the execution of synchronization operations; when the target synchronization status information is used to indicate that the target data table allows the execution of data synchronization operations, but the reference time difference is less than the time interval indicated by the target synchronization timing information, determining that the data status is used to indicate that the target data currently does not allow the execution of synchronization operations, wherein the reference time difference is the time difference between the synchronization time point indicated by the target synchronization timing information and the current time point; when the target synchronization status information is used to indicate that the target data table allows the execution of data synchronization operations, and the reference time difference is greater than or equal to the time interval indicated by the target synchronization timing information, determining that the data status is used to indicate that the target data currently allows the execution of synchronization operations.

2. The method according to claim 1, characterized in that The step of filtering out target data from the target data table according to the target synchronization timing information, the target synchronization rule information, the update time information, and the update type information includes: In a case where the target synchronization rule information is used to indicate that the mode in which the data in the target data table is synchronized from the source database to the target database is a full synchronization mode, all the data recorded in the target data table is determined as the target data; When the target synchronization rule information is used to indicate that the data in the target data table is synchronized from the source database to the target database in an incremental synchronization mode, the target data is filtered out from the target data table according to the target synchronization timing information, the update time information and the update type information.

3. The method according to claim 2, characterized in that The step of filtering out the target data from the target data table according to the target synchronization timing information, the update time information, and the update type information includes: The data in the target data table whose updated time falls after the synchronization time point and before the update time point and whose update type information is the modification type of this library is determined as the target data, wherein the data in the target data table whose modification type is the modification type of this library is obtained by modifying the data in the source database.

4. The method according to claim 1, wherein Synchronizing the target data in the target data file to the target database according to the target synchronization rule information includes: When the target synchronization rule information indicates that the data in the target data table is synchronized from the source database to the target database in a full synchronization mode, clearing the data recorded in the reference data table in the target database for receiving the target data, and importing the target data into the cleared reference data table; In a case where the target synchronization rule information is used to indicate that the data in the target data table is synchronized from the source database to the target database in an incremental synchronization mode, the target data is inserted into a corresponding position in the reference data table.

5. The method according to claim 1, wherein After sending the target data to the target database to synchronize the target data table, the method further includes: The synchronization time point indicated by the synchronization timing information is updated to the time point when the target data table is most recently synchronized in the target database.

6. A database synchronization device, characterized in that: include: A search module is configured to, when a target data table is detected in a source database, search for target synchronization timing information and target synchronization rule information corresponding to the target data table from data tables, synchronization timing information, and synchronization rule information having corresponding relationships, wherein the target data table is a data table in the source database to be synchronized to the target database, and the target data table records update time information and update type information, the update time information is used to indicate the update time point of the last data update in the target data table, the update type information is used to indicate the update type of each updated data in the target data table, the target synchronization timing information is used to indicate the synchronization time point of the last synchronization of the target data table, and the time interval for synchronizing the target data table, and the target synchronization rule information is used to indicate the method for synchronizing the data in the target data table from the source database to the target database; a screening module, configured to screen target data from the target data table according to the target synchronization timing information, the target synchronization rule information, the update time information, and the update type information, wherein the target data is all or part of the data in the target data table, and the part of the data is data in the target data table whose update time occurs after the synchronization time point of the last synchronization and before the update time point of the last data update; A sending module, configured to send the target data to the target database to synchronize the target data table; Wherein, the sending module includes: a detection unit for detecting the data status of the target data; a conversion unit for converting the target data into a target data file when the data status indicates that the target data currently allows the synchronization operation to be performed, wherein the target data file carries a target data table identifier corresponding to the target data table; a transmission unit for calling a data transmission tool to transfer the target data file from the source database to the target database, wherein the target database is used to find the target synchronization rule information corresponding to the target data table from the data tables and synchronization rule information with corresponding relationships when receiving the target data file; and synchronize the target data in the target data file to the target database according to the target synchronization rule information when receiving a data synchronization instruction; Wherein, the detection unit is further used to: when the target synchronization status information corresponding to the target data table is used to indicate that the target data table is not allowed to perform data synchronization operations, determine that the data status is used to indicate that the target data is not currently allowed to perform synchronization operations; when the target synchronization status information is used to indicate that the target data table allows data synchronization operations, but the reference time difference is less than the time interval indicated by the target synchronization timing information, determine that the data status is used to indicate that the target data is not currently allowed to perform synchronization operations, wherein the reference time difference is the time difference between the synchronization time point indicated by the target synchronization timing information and the current time point; when the target synchronization status information is used to indicate that the target data table allows data synchronization operations, and the reference time difference is greater than or equal to the time interval indicated by the target synchronization timing information, determine that the data status is used to indicate that the target data is currently allowed to perform synchronization operations.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 5 when executed.

8. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 5 through the computer program.