CN103984715B - Data synchronizing and checking method, device and system of isomerous database - Google Patents
Data synchronizing and checking method, device and system of isomerous database Download PDFInfo
- Publication number
- CN103984715B CN103984715B CN201410192546.1A CN201410192546A CN103984715B CN 103984715 B CN103984715 B CN 103984715B CN 201410192546 A CN201410192546 A CN 201410192546A CN 103984715 B CN103984715 B CN 103984715B
- Authority
- CN
- China
- Prior art keywords
- data
- field
- client
- database
- data record
- 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.)
- Expired - Fee Related
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- G06F16/273—Asynchronous replication or reconciliation
Abstract
The invention discloses a data synchronizing and checking method, device and system of an isomerous database. The data synchronizing method of the isomerous database comprises the following steps: under the on-line state, monitoring the data operation of a client-side database; acquiring the monitored and changed data record and transmitting the data record to a server side; modifying data in a server-side database by the server side according to the received data record. An off-line data synchronizing method comprises the following steps: inquiring the data record of ID fields and time fields which are as the same as those in a preset temporary table in the client-side database, acquiring the data record, and transmitting to the server side; according to the received data record, inquiring whether the database has the data record where the ID fields are as the same as those of the data record and the time fields are less than those of the data record or not by the server side; if yes, modifying the data in the server-side database by the server side according to the received data record transmitted by the client side.
Description
Technical field
The present invention relates to data synchronization technology field, and in particular to a kind of data syn-chronization of heterogeneous database, method of calibration,
Apparatus and system.
Background technology
At present conventional variance data method for catching mainly has snapshot (Snapshot), diary method, API
(Application Program Interface) method, shadow table method, control table method, timestamp method and trigger method.
Snapshot is exactly that at a time data in database are carried out once " photograph ", in generating a descriptive data base
The static file of the instantaneous state of data, finally copies at the appointed time target database.
Diary method is exactly that the change sequence for replicating object is captured by analytical database log information.
API (Application Program Interface, application programming interfaces) method is exactly in application program and data
A class middleware is introduced between storehouse, by it a series of API are provided, while application program is completed on API to database update,
Record the change sequence of synchronization object.
It is that each synchronization object table sets up a shadow table when shadow table method is initialization data storehouse, i.e., as a
Current copy, obtains change information by relatively more current shadow table with source table later.
Control table method is that source table that will be synchronous for each creates a control table, and control table only includes the major key field of source table
With some control information fields (updating time, updating type etc.), when certain record in the table of source changes, while addition
Or the corresponding major key record of modification control table.
Timestamp method is to need have a timestamp field in each table in related application system, to record each table
Modification time.
Trigger method is to replicate the corresponding trigger of Object Creation, when modifying, insert and delete to replicating object
When ordering Deng DML (Data Manipulation Language, data manipulation language), trigger is waken up, by change capture.
Any mechanism is independent of using above-mentioned snapshot, extra system resource is not take up, but because it is to database
Complete copy, therefore efficiency is very low and cannot be distinguished by which concrete item changes;In addition, snapshot can only be in data of the same race
Use between storehouse, do not apply to the data syn-chronization between heterogeneous database.
Because most of databases have daily record, not only facilitated using diary method nor can be taken and too many extra be
System resource, but some shortcomings there is also using diary method:First, the form of underground its daily record of some Database Systems,
One change prize procedure based on daily record of exploitation is extremely difficult;Secondly, different databases exists very big in detail
Difference, can bring new problem to heterogeneous database;Finally, daily data base administration work is very heavy, and diary method
This burden can undoubtedly be increased, diary method is the same with snapshot, can only be completed between database of the same race, not apply to isomeric data
Storehouse.
API methods can realize the most advantage of diary method, but for the data caused by the operation without API become
Change, API cannot be captured, and in addition application program is portable poor;Under the mode of off-line data, by the data of API
Storehouse operation can not keep the uniformity of data.
Shadow table method use range is wider, easily transplanting, is well suited for solving the data syn-chronization of heterogeneous database, but accounts for
It is big with space, it is impossible to which that obtaining intermediary operation information and control information, and capture change every time will scan source table and shadow table,
Inefficiency.
The efficiency that control table method can obtain the net change of synchronization object, operation and data transfer is all very high, and control table is accounted for
Shadow table is less than with memory space, it is easy to manage, and the control information such as renewal time, operator of preservation in control table, more
The deficiency for solving synchronization conflicts is mended.But realize because control table method will rely on trigger, thus have certain office in application
It is sex-limited.
Although timestamp method does not affect the operational efficiency of original application, need to do original system larger adjustment,
Thus the peration data which is not caused by application system can not be captured and changed.
The system resource that trigger method takes is relatively more, for complicated replication task need extremely complex configuration with
Implement, manage very inconvenient;In addition, trigger is also invalid between heterogeneous database.
The content of the invention
In view of the above problems, it is proposed that the present invention so as to provide one kind overcome the problems referred to above or at least in part solve on
Data syn-chronization method of calibration, the system of method of data synchronization, device and the heterogeneous database of the heterogeneous database of problem are stated, is adopted
Number of mechanisms keeps the uniformity of database, i.e., ensure real time data synchronization under presence, and off-line data can be in network weight
Upload after even, can be verified after corrupt data, it is ensured that data it is consistent.
According to one aspect of the present invention, there is provided a kind of method of data synchronization of heterogeneous database, including:
Online data sync section and off-line data sync section;
The online data sync section includes:
The data manipulation of client database is monitored in real time;
When the data in listening to client database change, the data record for changing is obtained;
The data record is sent to server end by client;
In the case of the data record that received server-side to client sends, server end is remembered according to the data
Record, changes the data in server-side database, and data modification result phase is notified into client;
The off-line data sync section includes:
The ID of id field and time field all same in the interim table inquired about in client database and pre-set
Field and time field, and the data record corresponding with time field of id field described in client database is obtained, will be described
The data record of acquisition is sent to server end;
Received server-side whether there is and the data record to the data record in inquiry server-side database
Id field it is identical, and time field less than the data record time field data record;
Exist in server-side database it is identical with the id field of the data record, and time field be less than the number
In the case of data record according to the time field of record, the data record that server end sends according to the client for receiving,
Data in modification server-side database, and data modification result phase is notified to client.
According to another aspect of the present invention, there is provided a kind of data synchronization unit of heterogeneous database, including:
Online data sychronisation and off-line data sychronisation;
The online data sychronisation includes:
Monitoring unit, is arranged at client, for the data manipulation for monitoring client database in real time;
First data capture unit, is arranged at client, becomes for listening to the data in client database
During change, the data record for changing is obtained;
First data transmission unit, is arranged at client, for the data record to be sent to into server end;
First data modification unit, is arranged at server end, for the data sent in received server-side to client
In the case of record, according to the data record, the data in server-side database are changed, and by data modification result phase
Notify client;
The off-line data sychronisation includes:
Second data capture unit, in being arranged at client, for what is inquired about in client database and pre-set
The id field and time field of id field and time field all same in interim table, and obtain ID described in client database
Field data record corresponding with time field, and the data record is sent to into server end;
First query unit, is arranged at server end, for according to received server-side to the data record, inquiry clothes
With the presence or absence of identical with the id field of the data record in business device client database, and time field is less than the data record
The data record of time field;
Second data modification unit, is arranged at server end, for existing in server-side database and the data
The id field of record is identical, and in the case of data record of the time field less than the time field of the data record, according to
The data record that the client that receives sends, changes the data in server-side database, and by data modification result phase
Notify to client.
According to another aspect of the present invention, there is provided a kind of data verification method of heterogeneous database, including:
The synchronization of heterogeneous database is completed beforehand through the method for data synchronization of heterogeneous database;
Obtain id field and the time field of data record in client database, and by the id field of the acquisition and when
Between field be sent to server end;
Received server-side whether there is ID words to after the id field and time field in inquiry server-side database
Section is identical with the id field, and time field is less than the data record of the time field;
There is id field in server-side database identical with the id field, and time field is less than the time word
In the case that segment data is recorded, the id field that server end is met the data record of condition feeds back to client;
The id field that client sends according to the server end for receiving, with the id field in acquisition client database
The corresponding data record of identical id field, and the data record is sent to into server end;
Server end changes the data in server-side database and notifies number clients according to the data record for receiving
According to successfully modified.
According to another aspect of the invention, there is provided a kind of data verification system of heterogeneous database, beforehand through isomery
The data synchronization unit of database, completes the data syn-chronization of heterogeneous database, and data verification system includes:
Field acquiring unit, is arranged at client, for obtaining client database in data record id field and when
Between field, and the id field of the acquisition and time field are sent to into server end;
Second query unit, is arranged at server end, for after received server-side to the id field and time field,
It is identical with the id field with the presence or absence of id field in inquiry server-side database, and time field is less than the time field
Data record;
Feedback unit, it is identical with the id field for there is id field in the database of server end, and time word
In the case of data record of the section less than the time field, server end is met the id field feedback of the data record of condition
To client;
3rd data capture unit, in being arranged at client, what the server end for being received according to client sent
Id field, obtains data record corresponding with the id field identical id field in client database, and the data are remembered
Record is sent to server end;
3rd data modification unit, is arranged at server end, for the data record arrived according to received server-side, modification
Data in server-side database simultaneously notify that client data is successfully modified.
The present invention provide a kind of heterogeneous database method of data synchronization and device, including online data sync section and
Off-line data sync section, wherein, online data sync section is by by the data record changed in client database
Server end is sent to, server end is modified according to the data record for receiving to the data in own database;From
Line number is the data record for inquiring about latest update in the client in the state of network is reconnected according to sync section, and by data
Record is sent to server end, received server-side to these data records, in inquiry own database with the presence or absence of with it is aforementioned
Id field identical id field in data record, and time field is less than the corresponding number of time field in aforementioned data record
According to record, if existing, modify.The method provided by the present invention, by the way of number of mechanisms combines, for example,
Online data sync section adopts trigger method, off-line data synchronously to realize that online real time data is same using timestamp method mode
Step and offline timing data synchronization, overcome the shortcoming for realizing data syn-chronization using a kind of method merely.
The method and system of the data syn-chronization verification of a kind of heterogeneous database that the present invention is provided, by by client data
The corresponding id field of data record is sent to server end, received server-side to id field and time word with time field in storehouse
Section, inquiry is identical with the presence or absence of ID in own database, and time field is less than the data of the time field that client sends
Record, if existing, by the id field for meeting condition client is fed back to, and client sends out the corresponding data record of the id field
Server end is given, server end changes the data in own database according to the data record for receiving.Carried by the present invention
For method, using the combination of control table method and timestamp method, the data syn-chronization verification of heterogeneous database is realized, for data go out
Further supplement has been done in wrong part, the further synchronization for ensureing data.
Description of the drawings
Fig. 1 is a kind of method of data synchronization flow chart of heterogeneous database of the embodiment of the present invention one;
Fig. 2 is online data sync section stream in a kind of method of data synchronization of heterogeneous database of the embodiment of the present invention one
Cheng Tu;
Fig. 3 is off-line data sync section stream in a kind of method of data synchronization of heterogeneous database of the embodiment of the present invention one
Cheng Tu;
Fig. 4 is the data transmission procedure schematic diagram of client and server in the embodiment of the present invention;
Fig. 5 is a kind of data synchronization unit schematic diagram of heterogeneous database of the embodiment of the present invention two;
Fig. 6 is a kind of data verification method flow chart of heterogeneous database of the embodiment of the present invention three;
Fig. 7 is a kind of data verification method overall flow figure of heterogeneous database of the embodiment of the present invention three;
And,
Fig. 8 is a kind of data verification system schematic diagram of heterogeneous database of the embodiment of the present invention four.
Specific embodiment
The principle and feature of the present invention are described below in conjunction with accompanying drawing, example is served only for explaining the present invention, and
It is non-for limiting the scope of the present invention.
Embodiment one, a kind of method of data synchronization of heterogeneous database.With reference to the side that Fig. 1-Fig. 4 is provided the present invention
Method is described in detail.
Referring to Fig. 1 and Fig. 2, the method for data synchronization of database provided by the present invention include online data sync section and
Off-line data sync section, wherein, the synchronous method of data includes under presence:
The data manipulation of S101, the in real time database of monitoring client.
Specifically, under presence (i.e. network service is normal), whether client can monitor local data base in real time
There are database manipulation message, such as increase, change of database etc. to operate.
S102, when the data in the database for listening to client change, obtain the data record that changes.
Specifically, when the data that client is listened in local data base change because increase, change etc. are operated,
Client can obtain the data record changed in local data base, wherein, data record includes being changed in database
The data table name of table, the title of each field of data record and the corresponding particular content of each field that are located.
Above-mentioned data record is sent to server end by S103, client.
S104, in the case of the data record that received server-side to client sends, server end is according to receiving
Data record, change server-side database in data, and by data modification result phase notify client.
Specifically, when the data record that received server-side to client sends, can be according to the data record for receiving
Data record in modification server-side database, makes the data in the data and server-side database in client database
It is consistent.The example of a specific realization, when the data record that received server-side to client sends, basis first
The corresponding relation of the table name in the database of the client for pre-setting and the table name in the database of server end is in server
Find table corresponding with the database table name of client in end;Then the ID words of the data record that client changes can be obtained
Section, and data record corresponding with the id field identical id field, root are searched in the corresponding table of database of server end
According to the data record that client sends, renewal of modifying to the data in server-side database;When the data of server end
During storehouse modification data success, data modification result phase can be set to data modification success status (or true) by server end,
When the database update data failure of server end, data modification result phase can be set to data modification failure by database
State (or false);Afterwards data modification result phase can be notified client by server end.
S105, change in interim table or insert id field or time field.
Specifically, the data record for changing is sent to server end by above-mentioned steps S103 client, and server
Client after the data record or execution step S104 that do not receive client transmission is held not receive the number of server end transmission
During according to modification result phase, the network service exception of possible client and server, client can be interim what is pre-set
Inquiry in table whether there is the id field identical id field of the data record changed with client, if existing, basis
Id field in above-mentioned data record and time field, change the id field identical ID word with above-mentioned data record in interim table
The corresponding time field of section, makes the id field and time word in id field in interim table and time field and above-mentioned data record
Duan Xiangtong;If not existing, the id field and time field of the data record that client changes is inserted in interim table.
Likewise, when the data modification result phase sent from server end that client is received is modification status of fail
When, renewal that also id field in interim table and/or time field are modified.
It should be noted that the interim table in the present embodiment is arranged in client, and the data in interim table include
The table name of the table that the data changed in client database are located, the id field of the data for changing and this id field pair
The time field answered.
Referring to Fig. 1 and Fig. 3, the method for data synchronization that the present invention is provided also includes off-line data synchronous method part, including:
Id field and time field all same in S111, the interim table inquired about in client database and pre-set
Id field and time field, and obtain the data record corresponding with time field of id field described in client database, general
The data record of the acquisition is sent to server end.
Specifically, in the synchronous implementation method of above-mentioned online data, it is possible to exist between client and server
Network service exception, this when can be by the id field of the data record changed in client database and time word
Section be stored in interim table, wherein, preserve in interim table the data place table changed in client database table name,
The id field and time field of the data for changing.When the network service between client and server is reconnected
Afterwards, client can be according to identical with time field with the id field in interim table in predetermined time interval inquiring client terminal database
Id field and time field, and obtain these id fields data record corresponding with time field, these data records are usual
It is newest data, after getting these newest data records, sends them to server.When implementing, can be with root
The table name being located according to the data for changing recorded in interim table searches the table in client database, then in the table
Search the id field with the data for changing of the table recorded in interim table and time field identical id field and time
The corresponding data record of field, and the table name and id field and the corresponding data record of time field are sent to into server
End.
The data record that S112, received server-side send to client, whether there is in inquiry server-side database
It is identical with the id field of the data record, and time field is less than the data record of the time field of data record.
Specifically, after the data record that received server-side to client sends, it is in inquiry server-side database
It is no to exist and the id field identical id field in the data record for receiving, but time field is less than the data record for receiving
In the corresponding data record of time field.If meeting these conditions, these data for showing server end are not newest
Data, that is, need to update.When implementing, in the table name that can be sent according to the client for receiving and client database
The one-to-one relationship of the table name in table name and server-side database, finds and client data in server-side database
The corresponding table of table name in storehouse, the id field and time field in the data record that the client that then basis is received sends,
Server end inquire about in corresponding table with the presence or absence of with the data record for receiving in id field identical id field, but when
Between field less than the corresponding data record of time field in the data record that receives.
S113, there is in server-side database, and the time identical with the id field of the data record of client transmission
In the case of data record of the field less than the time field of the data record that client sends, server end is according to receiving
The data record that client sends, changes the data in server-side database, and data modification result phase is notified to visitor
Family end.
Specifically, if there is the data record of the condition met in above-mentioned steps S113 in server-side database, this
A little data records need to update.The data record that now can be sent according to the client that received server-side is arrived, modification service
Need to change the data for updating in database in device, if the data modification success in server-side database, server end can be by
Data modification result phase is set to data modification success status (or being set to True), if the data in server-side database
Data modification result phase can be set to data modification status of fail (or being set to false) by modification failure, server end.Clothes
This data modification result phase can be sent to client by business device end.
In addition, when there are no the data for meeting the condition in above-mentioned S113 steps in server-side database, server
Directly data modification result phase can be set to into data modification success status, and this data modification success status is sent to into visitor
Family end.
When the data modification result phase that client receives server end transmission is data modification success status information,
By the corresponding id field of successfully modified with server end in the interim table of client data record and time field identical ID word
Section is deleted with time field, to discharge the space of interim table.
Finally, it should be noted that the database in client belongs to heterogeneous database with the database in server, visitor
Family end be to be communicated by way of WebService between server end.Referring to Fig. 4, in the process of data transfer
In, identical data object is defined in client and server, different development languages, the field name of definition keeps one
Cause.Before client end/server end sends data, the data object that will be sent first carries out Json formattings, is converted to Json
Character string, then by Json character strings is converted into binary system byte again, is compressed, two after WebService is by compression
System byte is sent to server end/client, when server end/client receives binary system byte, enters to two first
Byte processed is decompressed, and then the binary system byte of decompression is converted to into Json character strings, then to the anti-lattice of Json character strings
Formula, by Json character strings the data object in server end/client is converted into, and this completes client and server
The data transfer at end, all using the form of binary code during whole network is transmitted, it is ensured that the security of data.
Embodiment two, a kind of data synchronization unit of heterogeneous database.The device that the present invention is provided is entered with reference to Fig. 5
Row is described in detail.
In Fig. 5, the data synchronization unit that the present invention is provided includes online data sync section and off-line data sync section.
Wherein, online data sync section includes monitoring unit 501, the first data capture unit 502, the first data transmission unit
503rd, the first data modification unit 504 and interim table maintenance unit 505.
Monitoring unit 501 is mainly used in the data manipulation of the database for monitoring client in real time.
First data capture unit 502 is mainly used in the data listened in the database of client when monitoring unit 501
When changing, the data record for changing is obtained.
First data transmission unit 503 is mainly used in the data record that client obtains the first data capture unit 502
It is sent to server end.
First data modification unit 504 is mainly used in the first data transmission unit in received server-side to client
In the case of 503 data records for sending, the data record that this is received according to server end, in modification server-side database
Data, and by data modification result phase notify client.
Interim table maintenance unit 505 is arranged in client, is mainly used in being sent out when server end does not receive the first data
During the data record for sending unit 503 to send or when client does not receive the data modification result phase of server end transmission or work as
Client receives the data modification result phase of server end transmission when being status of fail, and inquiry pre-sets in client
With the presence or absence of the id field identical id field of the data record obtained with the first data capture unit 502 in interim table;If depositing
, then the corresponding time field of the id field for being obtained according to the first data capture unit 502, the id field in the interim table of modification
Corresponding time field;If not existing, the data record correspondence of the acquisition of the first data capture unit 502 is inserted in interim table
Id field and time field.
Off-line data sync section includes the second data capture unit 511, the first query unit 512, the second data modification
Unit 513.
Second data capture unit 511 is arranged at client, is mainly used in inquiring client terminal database interim with above-mentioned
Id field in the interim table that table maintenance unit 505 is safeguarded and time field identical id field and time field, and obtain visitor
Id field data record corresponding with time field in the client database of family, and the data record is sent to into server end.
First query unit 512 is arranged at server end, is mainly used in what is sent according to received server-side to client
Data record, with the presence or absence of identical with the id field of the data record in inquiry server-side database, and time field is less than
The data record of the time field of the data record.
Second data modification unit 513 is mainly used in existing in server-side database the data note sent with client
The id field of record is identical, and in the case of data record of the time field less than the time field of the data record, according to reception
The data record that the client for arriving sends, changes the data in server-side database, and data modification result phase is notified
To client.
It should be noted that sending with client when the first query unit 512 is not inquired in server-side database
Data record id field it is identical, and time field less than the data record time field data record in the case of,
Data modification result phase is directly set to data modification success status and notifies that client data changes result by server end.
When the data modification result phase that the server that client is received sends is data modification success status, will face
When table in the data record successfully modified with the second data modification unit 513 id field and time field identical id field with
Time field is deleted, to discharge the space of interim table.
A kind of method of data synchronization and device of heterogeneous database that the present invention is provided, including online real-time data synchronization portion
Divide and offline timing data sync section.Wherein, the data behaviour during online data sync section is by monitoring client database
Make, obtain the data record that changes in database, and these data records are sent to into server end, server end according to
The data record that client sends, changes the data in server-side database, and data modification result phase is notified into client
End.Off-line data sync section obtain client database in the interim table for pre-setting in id field and time field phase
Id field together and the corresponding data record of time field, and these data records are sent to into server end, server termination
These data records are received, the inquiry in server-side database whether there is and aforementioned id field identical id field, but should
The corresponding time field of id field is less than the data record of above-mentioned time field, if existing, according to the data that client sends
Record, changes the data in server-side database.The method of data synchronization provided by the present invention, is adopted number of mechanisms phase
With reference to mode, realize and ensure real time data synchronization under presence, in off-line state, will in client database send out
The data record preserve of changing is got up, after network is reconnected, it is ensured that data syn-chronization, that is, realize it is online and from
Data syn-chronization is can guarantee that under line states, while using number of mechanisms, such as online data sync section adopts trigger method, from
Line number adopts timestamp method according to sync section, overcomes and use merely a kind of shortcoming of method, while compared with the method for prior art
Also there is very big flexibility.
Embodiment three, a kind of data syn-chronization method of calibration of heterogeneous database.The present invention is carried with reference to Fig. 6 and Fig. 7
For data syn-chronization method of calibration be described in detail.
Referring to Fig. 6 and Fig. 7, wherein, in Fig. 6, S601, complete isomery beforehand through the method for data synchronization of heterogeneous database
The data syn-chronization of database.
Specifically, the data syn-chronization of heterogeneous database is realized by the method for embodiment one, now, it is possible to server end
Data in database are unmodified successful or situations such as modification error, can now adopt the method for the present embodiment to number clients
Data syn-chronization verification is carried out according to the data in the data in storehouse and server-side database.
S602, the id field and time field that obtain data record in client database, and these ID words that will be obtained
Section is sent to server end with time field.
Specifically, in order to reduce the data volume of collection, the resource of system is saved, improves operating efficiency, this step is taken only
Primary fields data in extraction client database, such as id field and time field, certainly, in addition it is also necessary to obtain the id field
The table name of the table being located with time field.During data check, verification is periodically gone according to predetermined time interval, can be with
Make data in data in client database and server-side database being consistent property at any time.When extracting number clients
After the table name of table, the id field of data record and the time field that are located according to data record in storehouse, send these data to
Server end.
After id field that S603, received server-side send to client and time field, server-side database is inquired about
In with the presence or absence of id field it is identical with aforementioned id field, and time field less than aforesaid time field data record.
Specifically, when table name, id field and the time field that received server-side to client sends, according to number clients
According to the one-to-one relationship of the table name in the table name in storehouse and server-side database, search in own database with it is above-mentioned
The corresponding table of table name, then according to above-mentioned id field and time field, whether lookup is inquired about in the corresponding table of server end
Have that id field is identical with aforementioned id field, and time field is less than the data record of aforesaid time field.
S604, exist in server-side database and to meet the data record of step S603 conditional in the case of, will take
The id field of these data records for meeting condition in the database at business device end feeds back to client.
Specifically, the data of id field unique mark one record in database, certain in server-side database
The id field that the id field of data record sends with client is identical, and the time field of this data record is sent out less than client
The time field sent, then show this data record not state-of-the-art record, needs to update.Now, server end will can need more
The id field of new data record feeds back to client.
The id field that S605, client send according to the server end for receiving, with the ID in acquisition client database
The corresponding data record of field identical id field, and the data record is sent to into server end.
S607, server end change the data in server-side database and notify visitor according to the data record for receiving
Family end data is successfully modified.
Specifically, when there is the data record for needing to update in server-side database, the number that these needs are updated
Client is fed back to according to corresponding id field is recorded, client obtains client database according to the id field of server feedback
In data record corresponding with the id field identical id field, then these data records are sent to into server end, service
Device end according to these data to update own database in data, make data in server-side database keep newest shape
State, and be consistent with the data in client database, finally notify that client data is successfully modified.So far, data syn-chronization
Verification is completed.
The data syn-chronization check system of example IV, a kind of heterogeneous database.With reference to the number that Fig. 8 is provided the present invention
It is described in detail according to synchronization check system.
In Fig. 8, the data syn-chronization check system that the present invention is provided includes the data synchronization unit 801, word of heterogeneous database
Section acquiring unit 802, the second query unit 803, feedback unit 804, the 3rd data capture unit 805 and the 3rd data modification list
Unit 806.
The data synchronization unit 801 of heterogeneous database is used to realize the data syn-chronization of heterogeneous database, concrete implementation number
Embodiment two is may refer to according to synchronous process, is not repeated.
Field acquiring unit 802 is used to obtain the id field of data record and time field in client database, and will
The id field of acquisition is sent to server end with time field.
Second query unit 803 is arranged at server end, for the id field sent in received server-side to client
It is identical with the id field of received server-side with the presence or absence of id field in inquiry server-side database after time field, and
Data record of the time field less than the time field that received server-side is arrived.
Feedback unit 804 is used to inquire the feelings that presence meets the data record of above-mentioned condition in the second query unit 803
Under condition, the id field for meeting the data record of condition is fed back to into client.
3rd data capture unit 805 is arranged in client, for the feedback unit 804 received according to client
The id field sent, obtains data record corresponding with the id field identical id field in client database, and these are counted
Server end is sent to according to record.
3rd data modification unit 806, is arranged at server end, and the client for being arrived according to received server-side sends
Data record, change the data in server-side database and simultaneously notify that client data is successfully modified.
It should be noted that during data syn-chronization is verified, the data communication between client and server is
Realized by WebService modes, specific technical characteristic may refer to an embodiment part, not be repeated.
The data syn-chronization method of calibration and system of a kind of heterogeneous database that the present invention is provided, by extracting client data
The id field of data record and time field in storehouse, and the id field of extraction and time field are sent to into server service device
Whether there is in end inquiry own database with the id field identical id field for receiving and time field less than receiving
Time field data record, if exist, the id field for meeting the data record of condition is fed back to into client, client exists
The corresponding data record of the id field is obtained in own database and server end is sent to, received server-side is to these data
Record, according to these data records, changes the data in server-side database.The present invention combines control table method and timestamp method
The mode for combining realizes data syn-chronization verification, for the data transformation by occurring during above-mentioned method of data synchronization
The consistent situation of the data transformation of client and server caused by the failure of consistent or data modification, this method is mended
Fill, it is ensured that the data in client are consistent with the data of server end.
In addition, being to realize data by WebService between client and server in above-mentioned whole process
Transmission, realize all in the form of binary code in the transmitting procedure of network, it is ensured that the security of data.
Provided herein algorithm and display be not inherently related to any certain computer, virtual system or miscellaneous equipment.
Various general-purpose systems can also be used together based on teaching in this.As described above, construct required by this kind of system
Structure be obvious.Additionally, the present invention is also not for any certain programmed language.It is understood that, it is possible to use it is various
Programming language realizes the content of invention described herein, and the description done to language-specific above is to disclose this
Bright preferred forms.
In specification mentioned herein, a large amount of details are illustrated.It is to be appreciated, however, that the enforcement of the present invention
Example can be put into practice in the case of without these details.In some instances, known method, structure is not been shown in detail
And technology, so as not to obscure the understanding of this description.
Similarly, it will be appreciated that in order to simplify the disclosure and help understand one or more in each inventive aspect, exist
Above in the description of the exemplary embodiment of the present invention, each feature of the present invention is grouped together into single enforcement sometimes
In example, figure or descriptions thereof.However, the method for the disclosure should be construed to reflect following intention:I.e. required guarantor
The more features of feature that the application claims ratio of shield is expressly recited in each claim.More precisely, such as following
Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore,
Thus the claims for following specific embodiment are expressly incorporated in the specific embodiment, wherein each claim sheet
Body is all as the separate embodiments of the present invention.
Those skilled in the art are appreciated that can be carried out adaptively to the module in the equipment in embodiment
Change and they are arranged in one or more equipment different from the embodiment.Can be the module or list in embodiment
Unit or component are combined into a module or unit or component, and can be divided in addition multiple submodule or subelement or
Sub-component.In addition at least some in such feature and/or process or unit is excluded each other, can adopt any
Combine to all features disclosed in this specification (including adjoint claim, summary and accompanying drawing) and so disclosed
Where all processes or unit of method or equipment are combined.Unless expressly stated otherwise, this specification is (including adjoint power
Profit is required, summary and accompanying drawing) disclosed in each feature can it is identical by offers, be equal to or the alternative features of similar purpose carry out generation
Replace.
Although additionally, it will be appreciated by those of skill in the art that some embodiments described herein include other embodiments
In included some features rather than further feature, but the combination of the feature of different embodiments means in of the invention
Within the scope of and form different embodiments.For example, in the following claims, embodiment required for protection appoint
One of meaning can in any combination mode using.
Client can be realized with Andriod in the embodiment of the present invention, and server end can be realized with PC, or with one
The software module run on individual or multiple processors realizes, or with combinations thereof realization.Those skilled in the art should
Work as understanding, can be realized using microprocessor or digital signal processor (DSP) in practice according to embodiments of the present invention
Data processing equipment and data handling system in some or all parts some or all functions.The present invention is also
The some or all equipment or program of device for performing method as described herein be can be implemented as (such as computer
Program and computer program).Such program for realizing the present invention can be stored on a computer-readable medium, Huo Zheke
In the form of with one or more signal.Such signal can be downloaded from internet website and obtained, or in carrier
There is provided on signal, or provide in any other form.
It should be noted that above-described embodiment the present invention will be described rather than limits the invention, and this
Art personnel can design without departing from the scope of the appended claims alternative embodiment.In claim
In, any reference symbol between bracket should not be configured to limitations on claims.Word "comprising" is not excluded for depositing
In element or step not listed in the claims.Word "a" or "an" before element do not exclude the presence of it is multiple this
The element of sample.The present invention can be by means of the Andriod for including some different elements and by means of properly programmed calculating
Machine is realizing.If in the unit claim for listing equipment for drying, several in these devices can be by same
Andriod items are embodying.Word first, second and third use do not indicate that any order.Can be by these words
It is construed to title.
Claims (10)
1. a kind of method of data synchronization of heterogeneous database, it is characterised in that include:
Online data sync section and off-line data sync section;
The online data sync section includes:
Step S101, the data manipulation for monitoring client database in real time;
Step S102, when the data in listening to client database change, obtain the data record that changes;
The data record is sent to server end by step S103, client;
Step S104, in the case of the data record that received server-side to client sends, server end is according to the number
According to record, the data in server-side database are changed, and data modification result phase is notified into client;
The off-line data sync section includes:
Id field and time field all same in step S111, the interim table inquired about in client database and pre-set
Id field and time field, and obtain the data record corresponding with time field of id field described in client database, general
The data record of the acquisition is sent to server end;
Step S112, received server-side whether there is and the number to the data record in inquiry server-side database
Id field according to record is identical, and time field is less than the data record of the time field of the data record;
Step S113, exist in server-side database identical with the id field of the data record, and time field is less than
In the case of the data record of the time field of the data record, the data that server end sends according to the client for receiving
Record, changes the data in server-side database, and data modification result phase is notified to client.
2. method of data synchronization as claimed in claim 1, it is characterised in that the online data sync section also includes:
When server end does not receive the data record of client transmission or when client does not receive the number of server end transmission
According to during modification result phase or when the data modification result phase that client receives server end transmission is status of fail, look into
Ask the ID words that whether there is in the interim table that client pre-sets with the data record changed in client database
Section identical id field;If existing, according to the time field of the data record changed in the client database, repair
Change the time field in interim table;If not existing, the number changed in the client database is inserted in interim table
According to recording corresponding id field and time field.
3. method of data synchronization as claimed in claim 1, it is characterised in that off-line data sync section also includes:
Do not exist in server-side database it is identical with the id field of the data record, and time field be less than the data
In the case of the data record of the time field of record, data modification result phase is directly set to data modification by server end
Success status simultaneously notify that client data changes result.
4. the method for data synchronization as described in claim 1 or 3, it is characterised in that also include:
When the data modification result phase that client receives server end transmission is data modification success status, by interim table
In id field corresponding with data record successfully modified in server-side database and time field delete.
5. a kind of data synchronization unit of heterogeneous database, it is characterised in that include:
Online data sychronisation and off-line data sychronisation;
The online data sychronisation includes:
Monitoring unit, is arranged at client, for the data manipulation for monitoring client database in real time;
First data capture unit, is arranged at client, for when the data in listening to client database change,
The data record that acquisition changes;
First data transmission unit, is arranged at client, for the data record to be sent to into server end;
First data modification unit, is arranged at server end, for the data record sent in received server-side to client
In the case of, according to the data record, the data in server-side database are changed, and data modification result phase is notified
Client;
The off-line data sychronisation includes:
Second data capture unit, it is interim for what is inquired about in client database and pre-set in being arranged at client
The id field of id field and time field all same in table and time field, and obtain id field described in client database
Data record corresponding with time field, and the data record is sent to into server end;
First query unit, is arranged at server end, for according to received server-side to the data record, inquiring about server
With the presence or absence of identical with the id field of the data record in client database, and time field is less than the time of the data record
The data record of field;
Second data modification unit, is arranged at server end, for existing in server-side database and the data record
Id field it is identical, and time field less than the data record time field data record in the case of, according to reception
The data record that the client for arriving sends, changes the data in server-side database, and data modification result phase is notified
To client.
6. data synchronization unit as claimed in claim 5, it is characterised in that the online data sychronisation also includes:
Interim table maintenance unit, is arranged at client, during for the data record that client transmission is not received when server end
Or send when client does not receive the data modification result phase of server end transmission or when client receives server end
Data modification result phase be status of fail when, inquire about in the interim table that client pre-sets whether there is and client
The id field identical id field of the data record changed in database;If existing, according to the client database
In the time field of data record that changes, change the time field in interim table;If not existing, insert in interim table
Enter the corresponding id field of the data record changed in the client database and time field.
7. data synchronization unit as claimed in claim 5, it is characterised in that the off-line data sychronisation also includes:
Status setting device, is arranged at server end, for not existing in server-side database and the data record
Id field is identical, and in the case of data record of the time field less than the time field of the data record, in server end
Directly data modification result phase is set to into data modification success status and notifies that client data changes result.
8. the data synchronization unit as described in claim 5 or 7, it is characterised in that also include:
Unit is deleted, the data modification result phase for receiving server end transmission when client is data modification into an account of somebody's meritorious service
During state, the corresponding id field of successfully modified in interim table and in server-side database data record and time field are deleted
Remove.
9. a kind of data verification method of heterogeneous database, it is characterised in that include:
Step S601, beforehand through the method for data synchronization of the heterogeneous database described in any one of claim 1-4, complete isomery
The data syn-chronization of database;
Step S602, the id field and time field that obtain data record in client database, and by the ID words of the acquisition
Section is sent to server end with time field;
Whether step S603, received server-side are deposited to after the id field and time field in inquiry server-side database
It is identical with the id field in id field, and time field is less than the data record of the time field;
Step S604, to there is in server-side database id field identical with the id field, and time field is less than described
In the case that time field data is recorded, the id field that server end is met the data record of condition feeds back to client;
The id field that step S605, the server end received according to client send, obtain in client database with it is described
The corresponding data record of id field identical id field, and the data record is sent to into server end;
Step S606, server end change the data in server-side database and notify visitor according to the data record for receiving
Family end data is successfully modified.
10. a kind of data verification system of heterogeneous database, it is characterised in that beforehand through described in any one of claim 5-8
Heterogeneous database data synchronization unit, complete the data syn-chronization of heterogeneous database, and the data verification system includes:
Field acquiring unit, is arranged at client, for obtaining client database in data record id field and time word
Section, and the id field of the acquisition and time field are sent to into server end;
Second query unit, is arranged at server end, after received server-side to the id field and time field, inquiry
It is identical with the id field with the presence or absence of id field in server-side database, and time field is less than the number of the time field
According to record;
Feedback unit, it is identical with the id field for there is id field in the database of server end, and time field is little
In the case of the data record of the time field, the id field that server end is met the data record of condition feeds back to visitor
Family end;
3rd data capture unit, in being arranged at client, the ID words that the server end for being received according to client sends
Section, obtains data record corresponding with the id field identical id field in client database, and the data record is sent out
Give server end;
3rd data modification unit, is arranged at server end, for the data record arrived according to received server-side, modification service
Data in device client database simultaneously notify that client data is successfully modified.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410192546.1A CN103984715B (en) | 2014-05-08 | 2014-05-08 | Data synchronizing and checking method, device and system of isomerous database |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410192546.1A CN103984715B (en) | 2014-05-08 | 2014-05-08 | Data synchronizing and checking method, device and system of isomerous database |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103984715A CN103984715A (en) | 2014-08-13 |
CN103984715B true CN103984715B (en) | 2017-04-12 |
Family
ID=51276688
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410192546.1A Expired - Fee Related CN103984715B (en) | 2014-05-08 | 2014-05-08 | Data synchronizing and checking method, device and system of isomerous database |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103984715B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107330003A (en) * | 2017-06-12 | 2017-11-07 | 上海藤榕网络科技有限公司 | Method of data synchronization, system, memory and data syn-chronization equipment |
CN109101627A (en) * | 2018-08-14 | 2018-12-28 | 交通银行股份有限公司 | heterogeneous database synchronization method and device |
Families Citing this family (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104462477B (en) * | 2014-12-18 | 2018-03-30 | 深圳市科漫达智能管理科技有限公司 | The method, apparatus and system of data syn-chronization based on timestamp |
CN105530125B (en) * | 2015-12-12 | 2019-04-12 | 公安部交通管理科学研究所 | Data exchange system between a kind of net |
CN105808643A (en) * | 2016-02-25 | 2016-07-27 | 浪潮通信信息系统有限公司 | Redis memory database refreshing method |
CN107885804A (en) * | 2017-11-02 | 2018-04-06 | 平安科技(深圳)有限公司 | Database synchronization method, application server and computer-readable recording medium |
CN108009223B (en) * | 2017-11-24 | 2021-12-07 | 中体彩科技发展有限公司 | Method and device for detecting consistency of transaction data |
CN110019269A (en) * | 2017-12-04 | 2019-07-16 | 北京京东尚科信息技术有限公司 | Method, system and the terminal device of data check |
CN108763387A (en) * | 2018-05-20 | 2018-11-06 | 湖北九州云仓科技发展有限公司 | Big data fusion method, electronic equipment, storage medium and the system of heterogeneous platform |
CN109284287B (en) * | 2018-08-22 | 2024-02-02 | 平安科技(深圳)有限公司 | Data backtracking and reporting method and device, computer equipment and storage medium |
CN109284332B (en) * | 2018-08-29 | 2021-01-05 | 江苏奇异点网络有限公司 | Data processing method, client, server and computer readable storage medium |
CN109933596A (en) * | 2019-02-27 | 2019-06-25 | 深圳市轱辘汽车维修技术有限公司 | A kind of method of data synchronization, device and terminal device |
CN110719326B (en) * | 2019-10-08 | 2021-11-12 | 中国电子科技集团公司第二十八研究所 | Data synchronization method in high-availability software system adapting to low-quality communication link |
CN113760923B (en) * | 2020-10-27 | 2023-09-05 | 北京京东振世信息技术有限公司 | Data heterogeneous method, device, system and storage medium |
CN113495890A (en) * | 2021-07-08 | 2021-10-12 | 上海二三四五网络科技有限公司 | Automatic comparison system, method and equipment for batch heterogeneous data sources |
CN113485994A (en) * | 2021-07-21 | 2021-10-08 | 中共四川省委组织部 | Domestic database-based double-track operation method |
CN114500569A (en) * | 2022-01-27 | 2022-05-13 | 中国工商银行股份有限公司 | Data synchronization method, device, equipment and storage medium |
CN115242717B (en) * | 2022-09-15 | 2022-12-09 | 四川汉唐云分布式存储技术有限公司 | Centralized storage system based on end-side calculation and control method |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101615199A (en) * | 2009-07-31 | 2009-12-30 | 深圳市珍爱网信息技术有限公司 | Heterogeneous database synchronization method and system |
CN102231161A (en) * | 2011-06-30 | 2011-11-02 | 北京新媒传信科技有限公司 | Method for synchronously verifying and monitoring databases |
CN103020112A (en) * | 2012-11-06 | 2013-04-03 | 深圳中兴网信科技有限公司 | Heterogeneous database synchronizing system and heterogeneous database synchronizing method |
CN103605809A (en) * | 2013-12-10 | 2014-02-26 | 厦门诚创网络有限公司 | Data synchronization method |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8510270B2 (en) * | 2010-07-27 | 2013-08-13 | Oracle International Corporation | MYSQL database heterogeneous log based replication |
-
2014
- 2014-05-08 CN CN201410192546.1A patent/CN103984715B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101615199A (en) * | 2009-07-31 | 2009-12-30 | 深圳市珍爱网信息技术有限公司 | Heterogeneous database synchronization method and system |
CN102231161A (en) * | 2011-06-30 | 2011-11-02 | 北京新媒传信科技有限公司 | Method for synchronously verifying and monitoring databases |
CN103020112A (en) * | 2012-11-06 | 2013-04-03 | 深圳中兴网信科技有限公司 | Heterogeneous database synchronizing system and heterogeneous database synchronizing method |
CN103605809A (en) * | 2013-12-10 | 2014-02-26 | 厦门诚创网络有限公司 | Data synchronization method |
Non-Patent Citations (1)
Title |
---|
郑祥云等.数据库同步中差异数据捕获方案设计与实现.《电脑知识与技术》.2009,第5卷(第7期), * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107330003A (en) * | 2017-06-12 | 2017-11-07 | 上海藤榕网络科技有限公司 | Method of data synchronization, system, memory and data syn-chronization equipment |
CN109101627A (en) * | 2018-08-14 | 2018-12-28 | 交通银行股份有限公司 | heterogeneous database synchronization method and device |
CN109101627B (en) * | 2018-08-14 | 2022-03-22 | 交通银行股份有限公司 | Heterogeneous database synchronization method and device |
Also Published As
Publication number | Publication date |
---|---|
CN103984715A (en) | 2014-08-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103984715B (en) | Data synchronizing and checking method, device and system of isomerous database | |
US11055302B2 (en) | Method and system for implementing target model configuration metadata for a log analytics system | |
US20200089666A1 (en) | Secure data isolation in a multi-tenant historization system | |
EP3508985B1 (en) | Scalable synchronization with cache and index management | |
CN103024052B (en) | Realize the system and method that browser data synchronizes | |
US10417103B2 (en) | Fault-tolerant methods, systems and architectures for data storage, retrieval and distribution | |
CN109522363B (en) | Cloud platform synchronization method, system, equipment and storage medium based on block chain | |
CN103595807B (en) | A kind of data synchronization updating method and device | |
US10990629B2 (en) | Storing and identifying metadata through extended properties in a historization system | |
WO2016155492A1 (en) | Remote data synchronization method and apparatus for database | |
CN112100265A (en) | Multi-source data processing method and device for big data architecture and block chain | |
JP2018200683A (en) | Method and design of automated examination system | |
US20150363484A1 (en) | Storing and identifying metadata through extended properties in a historization system | |
US20170199903A1 (en) | System for backing out data | |
US20080133543A1 (en) | System and Method for Dynamic and On-Demand Data Transfer and Synchronization Between Isolated Networks | |
US10114874B2 (en) | Source query caching as fault prevention for federated queries | |
US20220391368A1 (en) | Cryptography system for using associated values stored in different locations to encode and decode data | |
CN104899312A (en) | Data updating method for multi-layer classification data system | |
WO2016074412A1 (en) | Compatibility administration method based on network configuration protocol, storage medium and device | |
US11539791B1 (en) | Methods, apparatuses and computer program products for synchronizing data objects between and among application service systems | |
US8849755B2 (en) | Configuration information management apparatus and dictionary generation method of configuration information management apparatus | |
CN107633026B (en) | data synchronization exception handling method and device and server | |
CN106776754A (en) | Collecting method, apparatus and system | |
EP3145120A1 (en) | Data acquisition method, device and system | |
CN105991316B (en) | A kind of real-time management method and device of transmission network resource data |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20170412 Termination date: 20210508 |
|
CF01 | Termination of patent right due to non-payment of annual fee |