CN102063494A - Database synchronizing method and device - Google Patents
Database synchronizing method and device Download PDFInfo
- Publication number
- CN102063494A CN102063494A CN2010106160519A CN201010616051A CN102063494A CN 102063494 A CN102063494 A CN 102063494A CN 2010106160519 A CN2010106160519 A CN 2010106160519A CN 201010616051 A CN201010616051 A CN 201010616051A CN 102063494 A CN102063494 A CN 102063494A
- Authority
- CN
- China
- Prior art keywords
- version number
- client
- row version
- database
- central
- 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
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides database synchronizing method and device. The database synchronizing method comprises the following steps of: establishing a central row versioning number table in a central database, and correspondingly establishing a client row versioning number table in each client database, wherein names of tables to be synchronized and changed central row versioning numbers are saved in the central row versioning number table, while names of tables to be synchronized, changed client row versioning numbers, client row versioning numbers before changed and changed central versioning numbers are saved in the client versioning number table; and synchronizing corresponding tables to be synchronized in the client database and the central database. Through correspondingly establishing a central row versioning number table and a client row versioning number table in the central database and the client database, the phenomenon that data is repeatedly synchronized is avoided, the phenomenon that the data is disordered when the database is synchronized is reduced, and the synchronization efficiency is improved.
Description
Technical field
The present invention relates to database technical field, relate in particular to a kind of database synchronization method and device.
Background technology
At present, along with development of database, database is widely used in all trades and professions, sets up a plurality of dissimilar tables in the database usually, carries different data by each souvenir.Database of the prior art generally includes central database and a plurality of client database, client database can and central database between carry out data upload and download, thereby make each client database can be synchronous, to have all data with central database.In the prior art in the process of carrying out client database and central database synchrodata, usually existing data of client database and central database occur and repeat synchronously, thereby it is lower to cause database synchronization of the prior art the phenomenon and the synchronous efficiency of data corruption to occur.
Summary of the invention
The invention provides a kind of database synchronization method and device, in order to solve phenomenon and the lower defective of synchronous efficiency that data corruption appears in database synchronization of the prior art, the phenomenon of data corruption occurs and improve synchronous efficiency when realizing by database synchronization method minimizing database synchronization.
The invention provides a kind of database synchronization method, comprising:
In central database, set up central row version number table, and correspondence is set up client row version number table in each client database; Described central row version number table is preserved the title that needs synchronous table, the central row version number after the change, and described client row version number table is preserved title, the client row version number after the change, the client row version number before the change and the central row version number after the described change that needs synchronous table;
According to described central row version number table and described client row version number table, the synchronous table of needs of correspondence in synchronous described client database and the described central database.
Database synchronization method provided by the invention, set up central row version number table and client row version number table by correspondence in central database and client database, can be at central row version number table and the corresponding corresponding information that needs synchronous table of preserving of client row version number table, when central database and client database carry out data sync, data after content in showing according to described central row version number table and described client row version number will be changed are accurately carried out synchronously, repeat synchronous phenomenon and effectively avoid occurring data, occur the phenomenon of data corruption when having reduced database synchronization, and improved synchronous efficiency by database synchronization method.
The invention provides a kind of database synchronization device, comprising:
Build the table module, be used for setting up central row version number table, and correspondence is set up client row version number table in each client database at central database; Described central row version number table is preserved the title that needs synchronous table, the central row version number after the change, and described client row version number table is preserved title, the client row version number after the change, the client row version number before the change and the central row version number after the described change that needs synchronous table;
Synchronization module is used for according to described central row version number table and described client row version number table, the synchronous table of needs of correspondence in synchronous described client database and the described central database.
Database synchronization device provided by the invention, set up central row version number table and client row version number table by correspondence in central database and client database, can be at central row version number table and the corresponding corresponding information that needs synchronous table of preserving of client row version number table, when central database and client database carry out data sync, data after content in showing according to described central row version number table and described client row version number will be changed are accurately carried out synchronously, repeat synchronous phenomenon and effectively avoid occurring data, occur the phenomenon of data corruption when having reduced database synchronization, and improved synchronous efficiency by database synchronization method.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art, to do one to the accompanying drawing of required use in embodiment or the description of the Prior Art below introduces simply, apparently, accompanying drawing in describing below is some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 is the process flow diagram of database synchronization method embodiment of the present invention;
Fig. 2 is the structural representation of central row version number table among the database synchronization method embodiment of the present invention;
Fig. 3 is the structural representation of client row version number table among the database synchronization method embodiment of the present invention;
Fig. 4 is the structural representation of database synchronization device embodiment of the present invention.
Embodiment
For the purpose, technical scheme and the advantage that make the embodiment of the invention clearer, below in conjunction with the accompanying drawing in the embodiment of the invention, technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
Fig. 1 is the process flow diagram of database synchronization method embodiment of the present invention.As shown in Figure 1, the present embodiment database synchronization method comprises:
Concrete, the present embodiment database synchronization method is set up central row version number table in central database, and correspondence is set up client row version number table in each client database.Central row version number table is preserved the title that needs synchronous table, and is corresponding, also preserves the title of the synchronous table of the needs corresponding with central row version number epiphase in the client row version number table.As shown in Figure 2, the central row version number after the change in the central row version number of the present embodiment table can comprise the central row version number field of current interpolation and the central row version number field of current renewal.As shown in Figure 3, the client row version number after the change in the client row version number of the present embodiment table comprises the client row version number field of current interpolation and the client row version number field of current renewal; Client row version number before the change comprises the client row version number field of subsynchronous interpolation and the client row version number field of last subsynchronous renewal.
Concrete, after setting up central row version number table and client row version number and show by step 1, the relevant information of the table that the relevant needs of the record in just can showing according to central row version number table and client row version number are synchronous is carried out data sync with central database and each client database.Data sync is divided following two kinds of situations:
(1) when client database when central database is uploaded data, step 2 is specially: according to the client row version number before client row version number after the change and the change, with data upload corresponding between the client row version number before client row version number after the change in the client database and the change in the synchronous table of the needs in the central database.Concrete, when client database when central database is uploaded data, between the client row version number before client row version number after step 2 will be changed and the change in the synchronous table of corresponding data upload corresponding needs in the central database, thereby the data before the client row version number before change need not to repeat synchronously.
(2) when client database during from the central database data download, step 2 is specially: according to the central row version number after the change, data corresponding between the central row version number after the change in the central database are downloaded in the synchronous table of needs in the client database.Concrete, when client database during from the central database data download, the data of the central row version number correspondence after step 2 will be changed download in the synchronous table of needs in the client database, thereby need not to repeat synchronously in data before.
Further, for the more synchronous corresponding synchronous table of needs in central database and the client database, the present embodiment database synchronization method also comprised before step 1: step 10, the client address field of row version number field and change of increasing in the synchronous table of needs.Concrete, capable version number field in the synchronous table of the needs of central database correspondence is the information of the central row version number correspondence after changing, and the row version number field is the information of the client row version number correspondence after changing in the synchronous table of the needs of client database correspondence.In addition, be increased in the synchronous table of needs, can effectively avoid same client database from central database, to repeat synchrodata by the client address field that will change.
In addition, for deleted data following two kinds of processing modes are arranged synchronously: 1, logic deletion, the logic deletion is to finish by certain sign of revising the row that will delete, can finish synchronously by upgrading, and does not need to do special processing.2, physics deletion, the physics deletion need be saved in the address of the table name of the table that will delete and line data or condition in the deleting history table, and the deleting history table is present in respectively in client database and the consolidated storage database as table that can be synchronous.Synchronously can come synchronous deleted data according to the record in the delete list during deleted data.
The present embodiment database synchronization method, set up central row version number table and client row version number table by correspondence in central database and client database, can be at central row version number table and the corresponding corresponding information that needs synchronous table of preserving of client row version number table, when central database and client database carry out data sync, data after content in showing according to described central row version number table and described client row version number will be changed are accurately carried out synchronously, repeat synchronous phenomenon and effectively avoid occurring data, occur the phenomenon of data corruption when having reduced database synchronization, and improved synchronous efficiency by database synchronization method.
Fig. 4 is the structural representation of database synchronization device embodiment of the present invention.As shown in Figure 4, present embodiment database synchronization device comprises: build table module 1, synchronization module 2 and increase module 3.
Build table module 1 and be used for setting up central row version number table, and correspondence is set up client row version number table in each client database at central database; Central row version number table is preserved the title that needs synchronous table, the central row version number after the change, and client row version number table is preserved title, the client row version number after the change, the client row version number before the change and the central row version number after the change that needs synchronous table.Wherein, the central row version number after the change comprises the central row version number field of current interpolation and the central row version number field of current renewal; Client row version number after the change comprises the client row version number field of current interpolation and the client row version number field of current renewal; The client row version number field of subsynchronous interpolation and the client row version number field of last subsynchronous renewal in the client row version number before the change.
Increase the client address field that module 3 is used for increasing at the synchronous table of needs row version number field and change.
Particularly, building table module 1, synchronization module 2 and increasing module 3 concrete principle of work in the present embodiment can not repeat them here referring to the record of database synchronization method embodiment of the present invention.
Present embodiment database synchronization device, set up central row version number table and client row version number table by correspondence in central database and client database, can be at central row version number table and the corresponding corresponding information that needs synchronous table of preserving of client row version number table, when central database and client database carry out data sync, data after content in showing according to described central row version number table and described client row version number will be changed are accurately carried out synchronously, repeat synchronous phenomenon and effectively avoid occurring data, occur the phenomenon of data corruption when having reduced database synchronization, and improved synchronous efficiency by database synchronization method.
It should be noted that at last: above embodiment only in order to technical scheme of the present invention to be described, is not intended to limit; Although with reference to previous embodiment the present invention is had been described in detail, those of ordinary skill in the art is to be understood that: it still can be made amendment to the technical scheme that aforementioned each embodiment put down in writing, and perhaps part technical characterictic wherein is equal to replacement; And these modifications or replacement do not make the essence of appropriate technical solution break away from the spirit and scope of various embodiments of the present invention technical scheme.
Claims (10)
1. a database synchronization method is characterized in that, comprising:
In central database, set up central row version number table, and correspondence is set up client row version number table in each client database; Described central row version number table is preserved the title that needs synchronous table, the central row version number after the change, and described client row version number table is preserved title, the client row version number after the change, the client row version number before the change and the central row version number after the described change that needs synchronous table;
According to described central row version number table and described client row version number table, the synchronous table of needs of correspondence in synchronous described client database and the described central database.
2. database synchronization method according to claim 1 is characterized in that, set up central row version number table described in central database, and correspondence comprises also before setting up client row version number table in each client database:
In the synchronous table of needs, increase the client address field of row version number field and change.
3. database synchronization method according to claim 2, it is characterized in that, when described client database when described central database is uploaded data, describedly show according to described central row version number table and described client row version number, the synchronous table of needs in synchronous described client database and the described central database is specially:
According to client row version number after the described change and the client row version number before the described change, with data upload corresponding between client row version number after the change described in the described client database and the client row version number before the described change in the synchronous table of the needs in the described central database.
4. database synchronization method according to claim 2, it is characterized in that, when described client database during from described central database data download, describedly show according to described central row version number table and described client row version number, the synchronous table of needs in synchronous described client database and the described central database is specially:
According to the central row version number after the described change, the data of central row version number correspondence after the change described in the described central database are downloaded in the synchronous table of needs in the described client database.
5. according to the arbitrary described database synchronization method of claim 1-4, it is characterized in that the central row version number after the described change comprises the central row version number field of current interpolation and the central row version number field of current renewal;
Client row version number after the described change comprises the client row version number field of current interpolation and the client row version number field of current renewal;
Client row version number before the described change comprises the client row version number field of subsynchronous interpolation and the client row version number field of last subsynchronous renewal.
6. a database synchronization device is characterized in that, comprising:
Build the table module, be used for setting up central row version number table, and correspondence is set up client row version number table in each client database at central database; Described central row version number table is preserved the title that needs synchronous table, the central row version number after the change, and described client row version number table is preserved title, the client row version number after the change, the client row version number before the change and the central row version number after the described change that needs synchronous table;
Synchronization module is used for according to described central row version number table and described client row version number table, the synchronous table of needs of correspondence in synchronous described client database and the described central database.
7. database synchronization device according to claim 6 is characterized in that, also comprises:
Increase module, be used for increasing the client address field of row version number field and change at the synchronous table of needs.
8. database synchronization device according to claim 7, it is characterized in that, when described client database when described central database is uploaded data, described synchronization module also is used for according to client row version number after the described change and the client row version number before the described change, with data upload corresponding between client row version number after the change described in the described client database and the client row version number before the described change in the synchronous table of the needs in the described central database.
9. database synchronization device according to claim 7, it is characterized in that, when described client database during from described central database data download, described synchronization module also is used for according to the central row version number after the described change, and the data of central row version number correspondence after the change described in the described central database are downloaded in the synchronous table of needs in the described client database.
10. according to the arbitrary described database synchronization device of claim 6-9, it is characterized in that the central row version number after the described change comprises the central row version number field of current interpolation and the central row version number field of current renewal;
Client row version number after the described change comprises the client row version number field of current interpolation and the client row version number field of current renewal;
Client row version number before the described change comprises the client row version number field of subsynchronous interpolation and the client row version number field of last subsynchronous renewal.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2010106160519A CN102063494A (en) | 2010-12-31 | 2010-12-31 | Database synchronizing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2010106160519A CN102063494A (en) | 2010-12-31 | 2010-12-31 | Database synchronizing method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102063494A true CN102063494A (en) | 2011-05-18 |
Family
ID=43998769
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2010106160519A Pending CN102063494A (en) | 2010-12-31 | 2010-12-31 | Database synchronizing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102063494A (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103324716A (en) * | 2013-06-25 | 2013-09-25 | 四川九洲电器集团有限责任公司 | Application database updating method based on Android system |
CN103532920A (en) * | 2012-07-06 | 2014-01-22 | 腾讯科技(深圳)有限公司 | Cookie update method and cookie update system |
WO2015196962A1 (en) * | 2014-06-24 | 2015-12-30 | Tencent Technology (Shenzhen) Company Limited | Method and apparatus for detecting changed data |
WO2017114111A1 (en) * | 2015-12-31 | 2017-07-06 | 语联网(武汉)信息技术有限公司 | Asynchronous data synchronization method for distributed system |
CN108197268A (en) * | 2018-01-04 | 2018-06-22 | 国网福建省电力有限公司 | Data center analyzes numeric field data Synchronous fluorimetry method for improving |
CN108920522A (en) * | 2018-06-04 | 2018-11-30 | 上海点融信息科技有限责任公司 | Data processing method, system and computer readable storage medium for database |
CN110543469A (en) * | 2019-08-28 | 2019-12-06 | 贝壳技术有限公司 | Database version management method and server |
CN113556371A (en) * | 2020-04-26 | 2021-10-26 | 深信服科技股份有限公司 | Data synchronization method, system, equipment and computer readable storage medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101064630A (en) * | 2006-04-24 | 2007-10-31 | 华为技术有限公司 | Data synchronization method and system |
-
2010
- 2010-12-31 CN CN2010106160519A patent/CN102063494A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101064630A (en) * | 2006-04-24 | 2007-10-31 | 华为技术有限公司 | Data synchronization method and system |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103532920A (en) * | 2012-07-06 | 2014-01-22 | 腾讯科技(深圳)有限公司 | Cookie update method and cookie update system |
CN103532920B (en) * | 2012-07-06 | 2018-01-23 | 腾讯科技(深圳)有限公司 | Cookie update methods and cookie more new systems |
CN103324716A (en) * | 2013-06-25 | 2013-09-25 | 四川九洲电器集团有限责任公司 | Application database updating method based on Android system |
CN103324716B (en) * | 2013-06-25 | 2016-08-10 | 四川九洲电器集团有限责任公司 | A kind of application database update method based on Android system |
WO2015196962A1 (en) * | 2014-06-24 | 2015-12-30 | Tencent Technology (Shenzhen) Company Limited | Method and apparatus for detecting changed data |
US10540600B2 (en) | 2014-06-24 | 2020-01-21 | Tencent Technology (Shenzhen) Company Limited | Method and apparatus for detecting changed data |
WO2017114111A1 (en) * | 2015-12-31 | 2017-07-06 | 语联网(武汉)信息技术有限公司 | Asynchronous data synchronization method for distributed system |
CN108197268A (en) * | 2018-01-04 | 2018-06-22 | 国网福建省电力有限公司 | Data center analyzes numeric field data Synchronous fluorimetry method for improving |
CN108920522A (en) * | 2018-06-04 | 2018-11-30 | 上海点融信息科技有限责任公司 | Data processing method, system and computer readable storage medium for database |
CN110543469A (en) * | 2019-08-28 | 2019-12-06 | 贝壳技术有限公司 | Database version management method and server |
CN113556371A (en) * | 2020-04-26 | 2021-10-26 | 深信服科技股份有限公司 | Data synchronization method, system, equipment and computer readable storage medium |
CN113556371B (en) * | 2020-04-26 | 2022-09-30 | 深信服科技股份有限公司 | Data synchronization method, system, equipment and computer readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102063494A (en) | Database synchronizing method and device | |
CN102426611B (en) | Database synchronization method and device thereof | |
AU2010265607B2 (en) | Method for finding, updating and synchronizing modified record item and data synchronizing device | |
CN103136200B (en) | Data fresh information acquisition methods, device and method of data synchronization, device | |
CN102857570A (en) | Cloud synchronized method of files and cloud storage server | |
CN103914458A (en) | Mass data migration method and device | |
CN103581231A (en) | UGC primary standby data synchronization method and system thereof | |
CN102984357B (en) | Contact person information managing method and managing device | |
CN102811260A (en) | File cloud synchronizing system and method | |
CN105701218A (en) | Method for realizing data synchronism of different terminals on database | |
CN105900093A (en) | Keyvalue database data table updating method and data table updating device | |
CN110597821B (en) | Method and device for changing database table structure | |
CN103188305A (en) | Multithreading breakpoint resume method and system | |
CN105447105A (en) | NoSQL-based single field section index query method for distributed Internet of things data | |
CN104219639A (en) | Method and device for displaying text message record | |
CN104503868B (en) | Method of data synchronization, device and system | |
CN105447168A (en) | Method for restoring and recombining fragmented files in MP4 format | |
CN102291453A (en) | Data synchronization method and device | |
CN109165210A (en) | A kind of method and device of cluster Hbase Data Migration | |
CN103593922B (en) | Improve the method and system of network billing system client printing invoice speed | |
CN106161498A (en) | The multi-platform dissemination method of a kind of contribution and system | |
CN103092768A (en) | Method and device of data processing in application system | |
CN105138562A (en) | Data processing method and device of relational database | |
EP2814211A1 (en) | Method and device for displaying conversation information | |
CN103117883B (en) | A kind of packet equipment running status synchronous method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20110518 |