CN107885804A - Database synchronization method, application server and computer-readable recording medium - Google Patents

Database synchronization method, application server and computer-readable recording medium Download PDF

Info

Publication number
CN107885804A
CN107885804A CN201711064837.2A CN201711064837A CN107885804A CN 107885804 A CN107885804 A CN 107885804A CN 201711064837 A CN201711064837 A CN 201711064837A CN 107885804 A CN107885804 A CN 107885804A
Authority
CN
China
Prior art keywords
data
tables
database
source database
application server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201711064837.2A
Other languages
Chinese (zh)
Inventor
高宁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201711064837.2A priority Critical patent/CN107885804A/en
Publication of CN107885804A publication Critical patent/CN107885804A/en
Priority to PCT/CN2018/089724 priority patent/WO2019085471A1/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication

Abstract

The invention discloses a kind of database synchronization method, this method includes:The one-to-one object table of each tables of data and middle table with source database are established in target database;Single control table is established in target database;Monitor the data manipulation of each tables of data of source database;By the data variation information record of the tables of data listened in source database and write middle table corresponding with tables of data;The middle table of the data table data change information recorded in active data storehouse is synchronously merged into object table corresponding with tables of data in target data;Record each middle table be synchronously merged into corresponding to object table information to control table.The present invention also provides a kind of application server and computer-readable recording medium.The defects of database synchronization method, application server and computer-readable recording medium provided by the invention can avoid needing to write complicated process ability Achieve Database Synchronization in the prior art, mitigate the pressure of developer.

Description

Database synchronization method, application server and computer-readable recording medium
Technical field
The present invention relates to database analysis technical field, more particularly to a kind of database synchronization method, application server and Computer-readable recording medium.
Background technology
With the raising of social informatization degree, either economic construction or social life, to IT system, internet Dependence is increasing, and this many related data is stored in the database in each server, however, being realized in application layer Between database during the data syn-chronization of specific table, existing method needs to write complicated process, can be only achieved high-performance, exhaustive Target, and bring great inconvenience to developer, it is necessary to change program when needing synchronous table to change.
The content of the invention
In view of this, the present invention proposes a kind of database synchronization method, application server and computer-readable recording medium, To solve the problems, such as how to conveniently realize database synchronization.
First, to achieve the above object, the present invention proposes a kind of database synchronization method, and the method comprising the steps of:
The one-to-one object table of each tables of data and middle table with source database are established in target database;
Single control table is established in the target database;
Monitor the data manipulation of each tables of data of the source database;
By the data variation information record of the tables of data listened in the source database and write and the tables of data pair Answer middle table;
The middle table for recording the data table data change information having in the source database is synchronously merged into the target Object table corresponding with the tables of data in data;
Record each middle table be synchronously merged into corresponding to object table information to the control table.
Alternatively, it is described synchronously to merge the middle table for recording the data table data change information having in the source database Into the target data the step of object table corresponding with the tables of data before, also comprise the following steps:
The control table is inquired about with default very first time interval;
The upper subsynchronous merging time of each tables of data recorded according to the control table and default synchronization of time intenals, Judge whether each tables of data in the source database reaches lock in time;
If having reached lock in time, start synchronous union operation.
Alternatively, by the data variation information record of the tables of data listened in the source database and write-in and the number The step of corresponding to middle table according to table, specifically include:
Tables of data in the source database listened to the default second time interval inquiry application server Data variation information;
The data variation information batch of all tables of data inquired is write into middle table corresponding with the tables of data.
Alternatively, methods described also comprises the following steps:
Analyze the middle table;
The data variation information of corresponding object table need not be synchronously merged into by deleting.
Alternatively, the data variation of the tables of data listened in the source database is believed using batch insert functions Breath records and writes middle table corresponding with the tables of data.
In addition, to achieve the above object, the present invention also provides a kind of application server, including memory, processor, described The database synchronous system that can be run on the processor is stored with memory, the database synchronous system is by the place Reason device realizes following steps when performing:
The one-to-one object table of each tables of data and middle table with source database are established in target database;
Single control table is established in the target database;
Monitor the data manipulation of each tables of data of the source database;
By the data variation information record of the tables of data listened in the source database and write and the tables of data pair Answer middle table;
The middle table for recording the data table data change information having in the source database is synchronously merged into the target Object table corresponding with the tables of data in data;
Record each middle table be synchronously merged into corresponding to object table information to the control table.
Alternatively, it is described synchronously to merge the middle table for recording the data table data change information having in the source database Into the target data the step of object table corresponding with the tables of data before, also comprise the following steps:
The control table is inquired about with default very first time interval;
The upper subsynchronous merging time of each tables of data recorded according to the control table and default synchronization of time intenals, Judge whether each tables of data in the source database reaches lock in time;
If having reached lock in time, start synchronous union operation.
Alternatively, by the data variation information record of the tables of data listened in the source database and write-in and the number The step of corresponding to middle table according to table, specifically include:
Tables of data in the source database listened to the default second time interval inquiry application server Data variation information;
The data variation information batch of all tables of data inquired is write into middle table corresponding with the tables of data.
Alternatively, methods described also comprises the following steps:
Analyze the middle table;
The data variation information of corresponding object table need not be synchronously merged into by deleting.
Further, to achieve the above object, the present invention also provides a kind of computer-readable recording medium, the computer Readable storage medium storing program for executing is stored with database synchronous system, the database synchronous system can by least one computing device, with The step of making at least one computing device database synchronization method described above.
Compared to prior art, database synchronization method proposed by the invention, application server and computer-readable deposit Storage media, first, the one-to-one object table of each tables of data and middle table with source database are established in target database; Then, single control table is established in the target database;Further, each tables of data of the source database is monitored Data manipulation, and by the data variation information record of the tables of data listened in the source database and write and the tables of data Corresponding middle table;Then, the middle table for recording the data table data change information having in the source database is synchronously merged into Object table corresponding with the tables of data in the target data;Finally, each middle table is recorded synchronously to be merged into The information of corresponding object table is to the control table.It thus is avoided that to need to write complicated process in the prior art and could realizes data The defects of storehouse synchronization, mitigate the pressure of developer.
Brief description of the drawings
Fig. 1 is the schematic diagram of one optional hardware structure of application server of the present invention;
Fig. 2 is the program module schematic diagram of database synchronous system first embodiment of the present invention;
Fig. 3 is the program module schematic diagram of database synchronous system second embodiment of the present invention;
Fig. 4 is the program module schematic diagram of database synchronous system 3rd embodiment of the present invention;
Fig. 5 is the schematic flow sheet of database synchronization method first embodiment of the present invention;
Fig. 6 is the schematic flow sheet of database synchronization method second embodiment of the present invention;
Fig. 7 is the schematic flow sheet of database synchronization method 3rd embodiment of the present invention.
Reference:
The realization, functional characteristics and advantage of the object of the invention will be described further referring to the drawings in conjunction with the embodiments.
Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, it is right below in conjunction with drawings and Examples The present invention is further elaborated.It should be appreciated that specific embodiment described herein is only to explain the present invention, not For limiting the present invention.Based on the embodiment in the present invention, those of ordinary skill in the art are not before creative work is made The every other embodiment obtained is put, belongs to the scope of protection of the invention.
It should be noted that the description for being related to " first ", " second " etc. in the present invention is only used for describing purpose, and can not It is interpreted as indicating or implies its relative importance or imply the quantity of the technical characteristic indicated by indicating.Thus, define " the One ", at least one this feature can be expressed or be implicitly included to the feature of " second ".In addition, the skill between each embodiment Art scheme can be combined with each other, but must can be implemented as basis with those of ordinary skill in the art, when technical scheme With reference to occurring conflicting or will be understood that the combination of this technical scheme is not present when can not realize, also not in application claims Protection domain within.
As shown in fig.1, it is the schematic diagram of 2 one optional hardware structure of application server of the present invention.
In the present embodiment, the application server 2 may include, but be not limited only to, and company can be in communication with each other by system bus Connect memory 11, processor 12, network interface 13.It is pointed out that Fig. 1 illustrate only the application clothes with component 11-13 It is engaged in device 2, it should be understood that be not required for implementing all components shown, the implementation that can be substituted is more or less Component.
Wherein, the application server 2 can be rack-mount server, blade server, tower server or rack The computing devices such as formula server, the application server 2 can be that independent server or multiple servers are formed Server cluster.
The memory 11 comprises at least a type of readable storage medium storing program for executing, the readable storage medium storing program for executing include flash memory, Hard disk, multimedia card, card-type memory (for example, SD or DX memories etc.), random access storage device (RAM), static random are visited Ask memory (SRAM), read-only storage (ROM), Electrically Erasable Read Only Memory (EEPROM), programmable read-only deposit Reservoir (PROM), magnetic storage, disk, CD etc..In certain embodiments, the memory 11 can be the application clothes The internal storage unit of business device 2, such as the hard disk or internal memory of the application server 2.In further embodiments, the memory 11 can also be the plug-in type hard disk being equipped with the External memory equipment of the application server 2, such as the application server 2, Intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) etc..Certainly, the memory 11 can also both include the internal storage unit of the application server 2 or including outside it Portion's storage device.In the present embodiment, the memory 11 is generally used for the operating system that storage is installed on the application server 2 With types of applications software, such as program code of database synchronous system 200 etc..In addition, the memory 11 can be also used for Temporarily store the Various types of data that has exported or will export.
The processor 12 can be in certain embodiments central processing unit (Central ProcessingUnit, CPU), controller, microcontroller, microprocessor or other data processing chips.The processor 12 is generally used for should described in control With the overall operation of server 2.In the present embodiment, the processor 12 is used to run the program generation stored in the memory 11 Code or processing data, such as run described database synchronous system 200 etc..
The network interface 13 may include radio network interface or wired network interface, and the network interface 13 is generally used for Communication connection is established between the application server 2 and other electronic equipments.
So far, oneself is through describing the hardware configuration and function of relevant device of the present invention in detail.Below, above-mentioned introduction will be based on It is proposed each embodiment of the present invention.
First, the present invention proposes a kind of database synchronous system 200.
As shown in fig.2, it is the Program modual graph of the first embodiment of database synchronous system 200 of the present invention.
In the present embodiment, the database synchronous system 200 includes a series of computer being stored on memory 11 Programmed instruction, when the computer program instructions are performed by processor 12, it is possible to achieve the database of various embodiments of the present invention is same Step operation.In certain embodiments, the specific operation realized based on the computer program instructions each several part, database synchronization System 200 can be divided into one or more modules.For example, in fig. 2, the database synchronous system 200 can be divided It is cut into and establishes module 201, monitors module 202, logging modle 203 and synchronization module 204.Wherein:
It is described to establish module 201, it is one-to-one with each tables of data of source database for being established in target database Object table and middle table;
Normally, database usually contains multiple tables of data, records different information.Target database does not change data Authority in the case of, each data table information of each data table information and source database of target database corresponds, When the data message in the tables of data of source database changes, the data of change need to be synchronized to as early as possible corresponding in object library Tables of data, that is, realize the one-way synchronization between source database and target database.
Specifically, target database and source database all include multiple tables of data, the tables of data of target database and source Tables of data in database has mapping relations.The application server 2 is established by the module of establishing in target database Multiple object tables, each object table correspond to a tables of data in target database.The structure of the object table and tables of data is simultaneous Hold, or can be changed by structure.Application server 2 also by it is described establish module 201 established on object library with The one-to-one middle table of object table, the middle table are interim table.
It is described to establish module 201, it is additionally operable to establish single control table in the target database.
Specifically, the control table is used to record the synchronizing information between the target database and the source database. Specifically, the application server 2 establishes control table in the target database, for record the tables of data of source database with Synchronous details between object table (on synchronous between the tables of data and object table of source database, will be described below). Every record of the control table represents the synchronizing information of a source database tables of data, the details of the control table record Critical field include but is not limited to, source database, source data table, object table, middle table, ID row, timestamp row, field conversion Information, sync interval duration, lock in time last time.
The monitoring module 202, the data manipulation of each tables of data for monitoring the source database;
Specifically, the application server 2 monitors the data in the source database by the monitoring module 203 in real time Whether table has increase data message or change, deletion data message in database manipulation message, such as some tables of data etc. Operation.
The logging modle 203, for the data variation information record for the tables of data that will be listened in the source database And write middle table corresponding with the tables of data.
Specifically, when the application server 2 listens to some in the source database by the monitoring module 202 The data of tables of data or multiple tables of data become because data occur for the operation such as increase data message or change, deletion data message During change, the data record to change is obtained, and writes middle table corresponding with tables of data, wherein, data record includes data Have corresponding to the table name of tables of data where the data to be changed in storehouse, the title of each field of data record and each field Hold in vivo.
In the present embodiment, the logging modle 203 will listen to the source database using batch insert functions In tables of data data variation information record and write corresponding with tables of data middle table.
In other embodiments of the invention, the application server 2 is also analyzed the information record of the middle table and deleted The record that need not be updated except the target database in middle table.Specifically, when in the source database of middle token record Tables of data increase data message, the data message of change or deletion, and corresponding target database need not synchronize more When new, then the record information of the middle table is deleted, i.e., unconcerned field or data can be ignored.
The synchronization module 204, for the centre for the data table data change information having in the source database will to be recorded Table is synchronously merged into the target data object table corresponding with the tables of data.
Specifically, in the present embodiment, the synchronization module 204 is merged middle table using the merge functions of database To the object table.The object table is identical with the structure of the tables of data in the target database, and middle table is merged into After object table, object table includes the record of the newly-increased data message of object table and change in addition source database or deletes number According to this record of next year.And the object table is established in target database, therefore the target database can be accessed or adjusted The data in the object table for including modification record are taken, realize the one-way synchronization of integration across database.
The logging modle 203, it is additionally operable to remember the information that each middle table is synchronously merged into corresponding object table Record to the control table.
Specifically, the critical field of the details of the control table record includes but is not limited to, source database, source data Table, object table, middle table, ID row, timestamp row, field transitional information, sync interval duration, lock in time last time.
By said procedure module 201-204, database synchronous system 200 proposed by the invention, first, in number of targets The one-to-one object table of each tables of data and middle table with source database are established according to storehouse;Then, in the target data Single control table is established in storehouse;Further, the data manipulation of each tables of data of the source database is monitored, and will be listened to The data variation information record of tables of data in the source database simultaneously writes middle table corresponding with the tables of data;Then, will The middle table that record has the data table data change information in the source database is synchronously merged into the target data and institute State object table corresponding to the tables of data;Finally, the information that each middle table is synchronously merged into corresponding object table is recorded To the control table.Thus be avoided that need to write in the prior art complicated process could Achieve Database Synchronization the defects of, mitigate The pressure of developer.
As shown in fig.3, it is the Program modual graph of the second embodiment of database synchronous system 200 of the present invention.The present embodiment In, described database synchronous system 200 except including described in first embodiment establish module 201, monitor module 202, Outside logging modle 203 and synchronization module 204, in addition to enquiry module 205.
The enquiry module 205, the source listened to for inquiring about the application server at predetermined intervals The data variation information of tables of data in database.
Specifically, it will be recalled from above that database includes multiple tables of data, each tables of data is used to record different letters Breath.If the data that the monitoring module 202 listens in source database every time change, all by data variation information record And write corresponding with tables of data middle table, then when frequently being changed in the data short time in source database, then institute The operation that logging modle 203 frequently executes data variation information record and writes middle table corresponding with the tables of data is stated, is increased The operation of the application server is added to bear.
Therefore, in the present embodiment, the presetting time interval of the application server 2, and pass through the enquiry module 205 when reaching the prefixed time interval, inquires about the source data monitored module 202 and during this period of time listened to All data variation information of tables of data in storehouse.
The logging modle 203, the data variation information batch for all tables of data for being additionally operable to inquire writes and institute State tables of data and correspond to middle table.
Specifically, the logging modle 203 disposably by interval time all data variation information write-in with it is described Tables of data corresponds to middle table, realizes batch operation.
By said procedure module 205, database synchronous system 200 proposed by the invention, additionally it is possible to for default The data variation information of tables of data inquired about in the source database that the application server listens to of time interval, once Property all data variation information in interval time are write into corresponding with tables of data middle table, realize batch operation, mitigation The operating pressure of the application server 2.
As shown in fig.4, it is the Program modual graph of the 3rd embodiment of database synchronous system 200 of the present invention.The present embodiment In, described database synchronous system 200 is on the basis of second embodiment, in addition to judge module 206.
The enquiry module 205, it is additionally operable to inquire about the control table at predetermined intervals.
Specifically, it will be recalled from above that database includes multiple tables of data, each tables of data is used to record different letters Breath.If the data that the monitoring module 202 listens in source database every time change, a simultaneously operating is carried out, The middle table that the data table data change information in the source database will be recorded synchronously is merged into the target data Object table corresponding with the tables of data, then when frequently being changed in the data short time in source database, then institute State synchronization module 204 and frequently execute simultaneously operating, increase the operation burden of the application server.
Therefore, in the present embodiment, between the presetting synchronization of time intenals of the application server 2 and a query time Every, and the control table is inquired about according to the default query time interval by the enquiry module 205, to inquire about the control Lock in time last time for each tables of data recorded of tabulating.
Specifically, the judge module 206, for the upper subsynchronous conjunction of each tables of data recorded according to the control table And time and default synchronization of time intenals, judge whether each tables of data in the source database reaches lock in time.
Specifically, the application server 2 judges every number in the source database by the judge module 206 Whether reach lock in time according to table, if having reached lock in time, the application server is held by the synchronization module 204 The synchronous union operation of row.
By said procedure module 206, database synchronous system 200 proposed by the invention, additionally it is possible to it is default when Between interval inquire about the control table, and upper subsynchronous merging time of each tables of data recorded according to the control table and default Synchronization of time intenals, judge whether each tables of data in the source database reaches lock in time;If reach synchronous Time, start synchronous union operation, to avoid the application server 2 from frequently executing synchronous union operation, mitigate the application The operating pressure of server 2.
In addition, the present invention also proposes a kind of database synchronization method.
As shown in fig.5, it is the schematic flow sheet of database synchronization method first embodiment of the present invention.In the present embodiment In, according to different demands, the execution sequence of the step in flow chart shown in Fig. 5 can change, and some steps can be omitted.
Step S501, target database establish with the one-to-one object table of each tables of data of source database and in Between table;
Normally, database usually contains multiple tables of data, records different information.Target database does not change data Authority in the case of, each data table information of each data table information and source database of target database corresponds, When the data message in the tables of data of source database changes, the data of change need to be synchronized to as early as possible corresponding in object library Tables of data, that is, realize the one-way synchronization between source database and target database.
Specifically, target database and source database all include multiple tables of data, the tables of data of target database and source Tables of data in database has mapping relations.The application server 2 is established by the module of establishing in target database Multiple object tables, each object table correspond to a tables of data in target database.The structure of the object table and tables of data is simultaneous Hold, or can be changed by structure.Application server 2 is established middle correspondingly with object table on object library Table, the middle table are interim table.
Step S502, single control table is established in the target database.
Specifically, the control table is used to record the synchronizing information between the target database and the source database. Specifically, the application server 2 establishes control table in the target database, for record the tables of data of source database with Synchronous details between object table (on synchronous between the tables of data and object table of source database, will be described below). Every record of the control table represents the synchronizing information of a source database tables of data, the details of the control table record Critical field include but is not limited to, source database, source data table, object table, middle table, ID row, timestamp row, field conversion Information, sync interval duration, lock in time last time.
Step S503, monitor the data manipulation of each tables of data of the source database;
Specifically, whether the tables of data that the application server 2 is monitored in the source database in real time has database manipulation The operations such as increase data message or change, deletion data message in information, such as some tables of data.
Step S504, by the data variation information record of the tables of data listened in the source database and write with it is described Tables of data corresponds to middle table.
Specifically, some tables of data or multiple tables of data listened in the source database when the application server 2 Data due to increase data message or change, delete the operation such as data message data variation occur when, acquisition changes Data record, and write corresponding with tables of data middle table, wherein, data record includes the data that are changed in database The table name of the tables of data at place, the title of each field of data record and particular content corresponding to each field.
In the present embodiment, the application server 2 will listen to the source database using batch insert functions In tables of data data variation information record and write corresponding with tables of data middle table.
In other embodiments of the invention, the application server 2 is also analyzed the information record of the middle table and deleted The record that need not be updated except the target database in middle table.Specifically, when in the source database of middle token record Tables of data increase data message, the data message of change or deletion, and corresponding target database need not synchronize more When new, then the record information of the middle table is deleted, i.e., unconcerned field or data can be ignored.
Step S505, the middle table for recording the data table data change information having in the source database is synchronously merged into Object table corresponding with the tables of data in the target data.
Specifically, in the present embodiment, the application server 2 is merged middle table using the merge functions of database To the object table.The object table is identical with the structure of the tables of data in the target database, and middle table is merged into After object table, object table includes the record of the newly-increased data message of object table and change in addition source database or deletes number According to this record of next year.And the object table is established in target database, therefore the target database can be accessed or adjusted The data in the object table for including modification record are taken, realize the one-way synchronization of integration across database.
Step S506, by each middle table be synchronously merged into corresponding to object table information record to the control Table.
Specifically, the critical field of the details of the control table record includes but is not limited to, source database, source data Table, object table, middle table, ID row, timestamp row, field transitional information, sync interval duration, lock in time last time.
By above-mentioned steps S501-S506, database synchronization method proposed by the invention, first, in target database Establish the one-to-one object table of each tables of data and middle table with source database;Then, built in the target database Vertical single control table;Further, the data manipulation of each tables of data of the source database is monitored, and will be listened to described The data variation information record of tables of data in source database simultaneously writes middle table corresponding with the tables of data;Then, will record The middle table for having the data table data change information in the source database is synchronously merged into the target data and the institute State object table corresponding to tables of data;Finally, record each middle table be synchronously merged into corresponding to object table information to institute State control table.It thus is avoided that mitigation is developed the defects of needing to write complicated process ability Achieve Database Synchronization in the prior art The pressure of personnel.
As shown in fig. 6, it is the schematic flow sheet of the second embodiment of database synchronization method of the present invention.In the present embodiment, The middle table for recording the data table data change information having in the source database is synchronously merged into institute in first embodiment Before the step of stating object table corresponding with the tables of data in target data, also comprise the following steps:
Step S601, the number inquired about at predetermined intervals in the source database that the application server listens to According to the data variation information of table.
Specifically, it will be recalled from above that database includes multiple tables of data, each tables of data is used to record different letters Breath.If the data that the application server 2 listens in source database every time change, all by data variation information record And write corresponding with tables of data middle table, then when frequently being changed in the data short time in source database, then institute The operation that application server 2 frequently executes data variation information record and writes middle table corresponding with the tables of data is stated, is increased The operation of the application server is added to bear.
Therefore, in the present embodiment, the presetting time interval of the application server 2, and when reaching described default Between when being spaced, all data variation information for the tables of data inquired about in this period in the source database listened to.
Step S602, by the data variation information of all tables of data inquired batch write it is corresponding with the tables of data in Between table.
Specifically, the logging modle 203 disposably by interval time all data variation information write-in with it is described Tables of data corresponds to middle table, realizes batch operation.
By above-mentioned steps S601-S602, database synchronization method proposed by the invention, additionally it is possible to for default The data variation information for the tables of data that time interval is inquired about in the source database that the application server listens to, disposably All data variation information in interval time are write into middle table corresponding with the tables of data, realize batch operation, mitigate institute State the operating pressure of application server 2.
As shown in fig. 7, it is the schematic flow sheet of the 3rd embodiment of database synchronization method of the present invention.In the present embodiment, In first embodiment by the data variation information record of the tables of data listened in the source database and write with the number The step of corresponding to middle table according to table, specifically include:
Step S701, the control table is inquired about at predetermined intervals.
Specifically, it will be recalled from above that database includes multiple tables of data, each tables of data is used to record different letters Breath.If the data that the application server 2 listens in source database every time change, a simultaneously operating is carried out, The middle table that the data table data change information in the source database will be recorded synchronously is merged into the target data Object table corresponding with the tables of data, then when frequently being changed in the data short time in source database, then institute State application server 2 and frequently execute simultaneously operating, increase the operation burden of the application server.
Therefore, in the present embodiment, between the presetting synchronization of time intenals of the application server 2 and a query time Every, and the control table is inquired about according to the default query time interval, to inquire about each data of the control table record Lock in time last time of table.
Step S702, the upper subsynchronous merging time of each tables of data recorded according to the control table and default synchronization Time interval, judges whether each tables of data in the source database reaches lock in time.
Step S203, if having reached lock in time, start synchronous union operation.
Specifically, the application server 2 judges whether each tables of data in the source database reaches lock in time, If having reached lock in time, the application server 2 performs synchronous union operation.
By above-mentioned steps S701-S703, database synchronization method proposed by the invention, additionally it is possible to the default time The control table is inquired about at interval, and upper subsynchronous merging time of each tables of data recorded according to the control table and default Synchronization of time intenals, judges whether each tables of data in the source database reaches lock in time;If reached synchronous Between, start synchronous union operation, to avoid the application server 2 from frequently executing synchronous union operation, mitigate the application clothes The operating pressure of business device 2.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on such understanding, technical scheme is substantially done to prior art in other words Going out the part of contribution can be embodied in the form of software product, and the computer software product is stored in a storage medium In (such as ROM/RAM, magnetic disc, CD), including some instructions to cause a station terminal equipment (can be mobile phone, computer, clothes Be engaged in device, air conditioner, or network equipment etc.) perform method described in each embodiment of the present invention.
The preferred embodiments of the present invention are these are only, are not intended to limit the scope of the invention, it is every to utilize this hair The equivalent structure or equivalent flow conversion that bright specification and accompanying drawing content are made, or directly or indirectly it is used in other related skills Art field, is included within the scope of the present invention.

Claims (10)

1. a kind of database synchronization method, applied to application server, it is characterised in that methods described includes step:
The one-to-one object table of each tables of data and middle table with source database are established in target database;
Single control table is established in the target database;
Monitor the data manipulation of each tables of data of the source database;
By listen to the tables of data in the source database data variation information record and write it is corresponding with the tables of data in Between table;
The middle table for recording the data table data change information having in the source database is synchronously merged into the target data In object table corresponding with the tables of data;
Record each middle table be synchronously merged into corresponding to object table information to the control table.
2. database synchronization method as claimed in claim 1, it is characterised in that described that record has in the source database The middle table of data table data change information is synchronously merged into the target data target corresponding with the tables of data Before the step of table, also comprise the following steps:
The control table is inquired about with default very first time interval;
The upper subsynchronous merging time of each tables of data recorded according to the control table and default synchronization of time intenals, judged Whether each tables of data in the source database reaches lock in time;
If having reached lock in time, start synchronous union operation.
3. database synchronization method as claimed in claim 1, it is characterised in that the data in the source database will be listened to The step of data variation information record and write-in middle table corresponding with the tables of data of table, specifically include:
The number of tables of data in the source database listened to the default second time interval inquiry application server According to change information;
The data variation information batch of all tables of data inquired is write into middle table corresponding with the tables of data.
4. database synchronization method as claimed in claim 1, it is characterised in that methods described also comprises the following steps:
Analyze the middle table;
The data variation information of corresponding object table need not be synchronously merged into by deleting.
5. database synchronization method as claimed in claim 1, it is characterised in that will be listened to using batch insert functions The data variation information record of tables of data in the source database simultaneously writes middle table corresponding with the tables of data.
6. a kind of application server, it is characterised in that the application server includes memory, processor, on the memory The database synchronous system that can be run on the processor is stored with, the database synchronous system is by the computing device Shi Shixian following steps:
The one-to-one object table of each tables of data and middle table with source database are established in target database;
Single control table is established in the target database;
Monitor the data manipulation of each tables of data of the source database;
By listen to the tables of data in the source database data variation information record and write it is corresponding with the tables of data in Between table;
The middle table for recording the data table data change information having in the source database is synchronously merged into the target data In object table corresponding with the tables of data;
Record each middle table be synchronously merged into corresponding to object table information to the control table.
7. application server as claimed in claim 6, it is characterised in that described to record the data having in the source database The middle table of table data variation information is synchronously merged into object table corresponding with the tables of data in the target data Before step, also comprise the following steps:
The control table is inquired about with default very first time interval;
The upper subsynchronous merging time of each tables of data recorded according to the control table and default synchronization of time intenals, judged Whether each tables of data in the source database reaches lock in time;
If having reached lock in time, start synchronous union operation.
8. application server as claimed in claim 6, it is characterised in that by the tables of data listened in the source database The step of data variation information record and write-in middle table corresponding with the tables of data, specifically include:
The number of tables of data in the source database listened to the default second time interval inquiry application server According to change information;
The data variation information batch of all tables of data inquired is write into middle table corresponding with the tables of data.
9. application server as claimed in claim 7, it is characterised in that the database synchronous system is held by the processor Following steps are also realized during row:
Analyze the middle table;
The data variation information of corresponding object table need not be synchronously merged into by deleting.
10. a kind of computer-readable recording medium, the computer-readable recording medium storage has database synchronous system, described Database synchronous system can be by least one computing device, so that at least one computing device such as claim 1-5 Any one of database synchronization method the step of.
CN201711064837.2A 2017-11-02 2017-11-02 Database synchronization method, application server and computer-readable recording medium Pending CN107885804A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201711064837.2A CN107885804A (en) 2017-11-02 2017-11-02 Database synchronization method, application server and computer-readable recording medium
PCT/CN2018/089724 WO2019085471A1 (en) 2017-11-02 2018-06-03 Database synchronization method, application server, and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711064837.2A CN107885804A (en) 2017-11-02 2017-11-02 Database synchronization method, application server and computer-readable recording medium

Publications (1)

Publication Number Publication Date
CN107885804A true CN107885804A (en) 2018-04-06

Family

ID=61783628

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711064837.2A Pending CN107885804A (en) 2017-11-02 2017-11-02 Database synchronization method, application server and computer-readable recording medium

Country Status (2)

Country Link
CN (1) CN107885804A (en)
WO (1) WO2019085471A1 (en)

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108897794A (en) * 2018-06-12 2018-11-27 东软集团股份有限公司 Synchronous method, device, storage medium and the electronic equipment of dereliction key data table
CN109657002A (en) * 2018-11-09 2019-04-19 山东中创软件商用中间件股份有限公司 A kind of multilist batch data synchronous method, device and equipment
WO2019085471A1 (en) * 2017-11-02 2019-05-09 平安科技(深圳)有限公司 Database synchronization method, application server, and computer readable storage medium
CN109753494A (en) * 2019-01-04 2019-05-14 北京环境特性研究所 A kind of target characteristic data library system and method for data synchronization
CN109902078A (en) * 2019-01-10 2019-06-18 杭州迪普科技股份有限公司 Database upgrade compatible method, apparatus, equipment and storage medium
CN110162569A (en) * 2019-04-15 2019-08-23 平安普惠企业管理有限公司 Data processing method, device and computer equipment based on GG synchronized process
CN110706797A (en) * 2019-09-16 2020-01-17 重庆华医康道科技有限公司 Method for linking medical data of medical institution in real time
CN110888774A (en) * 2019-11-07 2020-03-17 中盈优创资讯科技有限公司 Big data report processing method and device based on HBASE
CN110928885A (en) * 2018-09-04 2020-03-27 北京奇虎科技有限公司 Method and device for updating data of Mysql database to Es database
CN111125214A (en) * 2019-12-02 2020-05-08 武汉虹信技术服务有限责任公司 Lightweight incremental data synchronization method and device and computer readable medium
CN111258993A (en) * 2020-01-09 2020-06-09 佛山科学技术学院 Method and device for filtering abnormal data of industrial big data
CN111475517A (en) * 2020-03-06 2020-07-31 平安科技(深圳)有限公司 Data updating method and device, computer equipment and storage medium
CN111506556A (en) * 2020-04-09 2020-08-07 北京市测绘设计研究院 Multi-source heterogeneous structured data synchronization method
CN112182104A (en) * 2020-09-25 2021-01-05 中国建设银行股份有限公司 Data synchronization method, device, equipment and storage medium
CN112269788A (en) * 2020-11-13 2021-01-26 中盈优创资讯科技有限公司 Method and device for improving click House data storage performance
CN112347103A (en) * 2020-11-05 2021-02-09 深圳市极致科技股份有限公司 Data synchronization method and device, electronic equipment and storage medium
CN113076314A (en) * 2021-03-30 2021-07-06 深圳市酷开网络科技股份有限公司 Data table storage method and device and computer readable storage medium
CN113779038A (en) * 2021-09-26 2021-12-10 大健云仓科技(苏州)有限公司 Multi-data source data synchronization method
CN113076314B (en) * 2021-03-30 2024-04-19 深圳市酷开网络科技股份有限公司 Data table storage method and device and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060136443A1 (en) * 2004-12-16 2006-06-22 International Business Machines Corporation Method and apparatus for initializing data propagation execution for large database replication
CN102158475A (en) * 2011-02-22 2011-08-17 山东大学 System architecture based on student dormitory passageway system and system data synchronization method thereof
CN102495910A (en) * 2011-12-28 2012-06-13 畅捷通信息技术股份有限公司 Device and method for data timing synchronization of heterogeneous system
CN103984715A (en) * 2014-05-08 2014-08-13 武汉库百网络技术有限公司 Data synchronizing and checking method, device and system of isomerous database
CN106682002A (en) * 2015-11-05 2017-05-17 中兴通讯股份有限公司 Database synchronization method and system, source data and target data synchronization device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100521605C (en) * 2005-09-23 2009-07-29 英业达股份有限公司 Synchronizing system and method
CN107885804A (en) * 2017-11-02 2018-04-06 平安科技(深圳)有限公司 Database synchronization method, application server and computer-readable recording medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060136443A1 (en) * 2004-12-16 2006-06-22 International Business Machines Corporation Method and apparatus for initializing data propagation execution for large database replication
CN102158475A (en) * 2011-02-22 2011-08-17 山东大学 System architecture based on student dormitory passageway system and system data synchronization method thereof
CN102495910A (en) * 2011-12-28 2012-06-13 畅捷通信息技术股份有限公司 Device and method for data timing synchronization of heterogeneous system
CN103984715A (en) * 2014-05-08 2014-08-13 武汉库百网络技术有限公司 Data synchronizing and checking method, device and system of isomerous database
CN106682002A (en) * 2015-11-05 2017-05-17 中兴通讯股份有限公司 Database synchronization method and system, source data and target data synchronization device

Cited By (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019085471A1 (en) * 2017-11-02 2019-05-09 平安科技(深圳)有限公司 Database synchronization method, application server, and computer readable storage medium
CN108897794A (en) * 2018-06-12 2018-11-27 东软集团股份有限公司 Synchronous method, device, storage medium and the electronic equipment of dereliction key data table
CN108897794B (en) * 2018-06-12 2020-11-27 东软集团股份有限公司 Synchronization method and device for data table without main key, storage medium and electronic equipment
CN110928885A (en) * 2018-09-04 2020-03-27 北京奇虎科技有限公司 Method and device for updating data of Mysql database to Es database
CN110928885B (en) * 2018-09-04 2023-05-16 三六零科技集团有限公司 Method and device for updating data of Mysql database to Es database
CN109657002B (en) * 2018-11-09 2022-04-08 山东中创软件商用中间件股份有限公司 Multi-table batch data synchronization method, device and equipment
CN109657002A (en) * 2018-11-09 2019-04-19 山东中创软件商用中间件股份有限公司 A kind of multilist batch data synchronous method, device and equipment
CN109753494A (en) * 2019-01-04 2019-05-14 北京环境特性研究所 A kind of target characteristic data library system and method for data synchronization
CN109902078A (en) * 2019-01-10 2019-06-18 杭州迪普科技股份有限公司 Database upgrade compatible method, apparatus, equipment and storage medium
CN110162569A (en) * 2019-04-15 2019-08-23 平安普惠企业管理有限公司 Data processing method, device and computer equipment based on GG synchronized process
CN110706797A (en) * 2019-09-16 2020-01-17 重庆华医康道科技有限公司 Method for linking medical data of medical institution in real time
CN110888774A (en) * 2019-11-07 2020-03-17 中盈优创资讯科技有限公司 Big data report processing method and device based on HBASE
CN111125214B (en) * 2019-12-02 2023-08-25 武汉虹信技术服务有限责任公司 Lightweight incremental data synchronization method, device and computer readable medium
CN111125214A (en) * 2019-12-02 2020-05-08 武汉虹信技术服务有限责任公司 Lightweight incremental data synchronization method and device and computer readable medium
CN111258993A (en) * 2020-01-09 2020-06-09 佛山科学技术学院 Method and device for filtering abnormal data of industrial big data
CN111475517A (en) * 2020-03-06 2020-07-31 平安科技(深圳)有限公司 Data updating method and device, computer equipment and storage medium
CN111475517B (en) * 2020-03-06 2024-02-20 平安科技(深圳)有限公司 Data updating method, device, computer equipment and storage medium
CN111506556A (en) * 2020-04-09 2020-08-07 北京市测绘设计研究院 Multi-source heterogeneous structured data synchronization method
CN112182104A (en) * 2020-09-25 2021-01-05 中国建设银行股份有限公司 Data synchronization method, device, equipment and storage medium
CN112347103A (en) * 2020-11-05 2021-02-09 深圳市极致科技股份有限公司 Data synchronization method and device, electronic equipment and storage medium
CN112347103B (en) * 2020-11-05 2024-04-12 深圳市极致科技股份有限公司 Data synchronization method, device, electronic equipment and storage medium
CN112269788A (en) * 2020-11-13 2021-01-26 中盈优创资讯科技有限公司 Method and device for improving click House data storage performance
CN113076314A (en) * 2021-03-30 2021-07-06 深圳市酷开网络科技股份有限公司 Data table storage method and device and computer readable storage medium
CN113076314B (en) * 2021-03-30 2024-04-19 深圳市酷开网络科技股份有限公司 Data table storage method and device and computer readable storage medium
CN113779038A (en) * 2021-09-26 2021-12-10 大健云仓科技(苏州)有限公司 Multi-data source data synchronization method
CN113779038B (en) * 2021-09-26 2024-04-16 大健云仓科技(苏州)有限公司 Multi-data source data synchronization method

Also Published As

Publication number Publication date
WO2019085471A1 (en) 2019-05-09

Similar Documents

Publication Publication Date Title
CN107885804A (en) Database synchronization method, application server and computer-readable recording medium
CN108011929A (en) Data request processing method, apparatus, computer equipment and storage medium
CN103167026B (en) A kind of cloud store environmental data processing method, system and equipment
CN104216835B (en) A kind of method and device for realizing internal memory fusion
CN109299157B (en) Data export method and device for distributed big single table
US20170031948A1 (en) File synchronization method, server, and terminal
CN104104717A (en) Inputting channel data statistical method and device
CN109413127A (en) A kind of method of data synchronization and device
CN104737135B (en) The information processing terminal and synchronisation control means
CN109033360B (en) Data query method, device, server and storage medium
TW201202959A (en) Data synchronization methods for synchronizing data in communication systems and communication systems
CN112714359B (en) Video recommendation method and device, computer equipment and storage medium
CN108965383B (en) File synchronization method and device, computer equipment and storage medium
CN104657435A (en) Storage management method for application data and network management system
CN107040576A (en) Information-pushing method and device, communication system
CN111190962A (en) File synchronization method and device and local terminal
CN103490978A (en) Terminal, server and message monitoring method
US11829377B2 (en) Efficient storage method for time series data
CN102594874A (en) Synchronization processing method and device
CN105991744A (en) Method and equipment used for synchronizing user application data
CN108491466A (en) Electronic device, access instruction information acquisition method and storage medium
CN109165259B (en) Index table updating method based on network attached storage, processor and storage device
CN104408056B (en) Data processing method and device
CN114928620B (en) User information synchronization method, apparatus, device, storage medium, and program product
CN105827739A (en) Contact person information synchronization method, device, server and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20180406