CN1286288C - Method of internal data base main-spare synchronous - Google Patents

Method of internal data base main-spare synchronous Download PDF

Info

Publication number
CN1286288C
CN1286288C CN 200410006155 CN200410006155A CN1286288C CN 1286288 C CN1286288 C CN 1286288C CN 200410006155 CN200410006155 CN 200410006155 CN 200410006155 A CN200410006155 A CN 200410006155A CN 1286288 C CN1286288 C CN 1286288C
Authority
CN
China
Prior art keywords
record
data
area
database
image area
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
Application number
CN 200410006155
Other languages
Chinese (zh)
Other versions
CN1561022A (en
Inventor
肖旸
周晶
陈于锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CN 200410006155 priority Critical patent/CN1286288C/en
Publication of CN1561022A publication Critical patent/CN1561022A/en
Application granted granted Critical
Publication of CN1286288C publication Critical patent/CN1286288C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Abstract

The present invention discloses a method of the main-spare synchronization of an internal database, which comprises the following steps: databases are initialized; a list to be synchronized is registered in a step-out mapping register region, and a corresponding step-out mapping region and a step-out queue are initialized; when a main database is varied, a varied record number of a varied list is written in the step-out queue of a corresponding list, and corresponding variation is recorded in the corresponding step-out napping region; step-out records are packed and sent to a database of a receiving terminal, and at the same time, corresponding records in the step-out napping region and the step-out queue are deleted; the database of the receiving terminal receives the data and updates the records of a corresponding list, and answering messages are returned; after synchronization confirmation is received, other step-out data continues to be synchronized. All the varied records can be recorded, and real-time synchronization can be carried out continuously with high efficiency through the transmission of control number step records of a transmission and control data region by the method that the step-out napping region is used for recording the variation of the records.

Description

The active and standby synchronous method of a kind of memory database
Technical field
The present invention relates to the DB Backup technology, in particular to a kind of method that database is recovered synchronously.
Background technology
The major technique of handling bust is a DB Backup.Generally, all database and daily record will periodically be backed up on the expensive storage medium.When system runs into bust, can from recent backup, reload database, and start-up system.
Upgrade for all of avoiding losing after Last Backup, will system journal be backuped to the slack storage medium with higher frequency usually.Because system journal is more much smaller than database, therefore can back up more continually.The user just can not lose all affairs after the last backup like this.By in the daily record all submitted to affairs to recover can be the state of database recovery to when collapse.In addition, all to begin a new daily record after each DB Backup.Therefore when the slack storage media failure recovers, at first according to DB Backup last on the slack storage medium, create database on primary storage medium, the backup according to system journal recovers submitting affairs to then.
Since very high to the database rate request of switch, therefore must adopt memory database.Equally, when master data base breaks down, resume speed is the factor that override is considered, therefore traditional backup according to system journal recovers can not satisfy system requirements to submitting affairs to, requirement can in time have ready-made database available, like this, active and standby storage medium should have identical performance, and the master/slave data storehouse should be synchronous in real time.Just must propose one overlaps main standby synchronous method efficiently for this, to guarantee that when master data base breaks down backup database can in time use.
Chinese patent " method of active and standby plate real time data synchronization in 02103019.7 communication system " provides a kind of main standby synchronous method of memory database.This patent respectively is provided with a data buffer zone in active and standby plate; When the mainboard data modification, in its buffering area, write the data that mainboard was revised; Buffering area is handled data; When buffer area data volume reaches one regularly, the real-time synchronized process of mainboard read data and send to the real-time synchronized process of slave board from buffering area; Upgrade the slave board database, and operating result is returned to mainboard; If operating result is synchronous success, corresponding data in the delete buffer then, otherwise resend data, in buffering area, be recorded as sky.The described technical scheme of this patent realize active and standby when synchronous, vicissitudinous data are all write buffering area, if all data all might change, for guaranteeing not obliterated data, then buffering area must be identical with the database size, if database is quite big, buffering area is big too, then undoubtedly can wasting space; If the size of buffering area less than database, can occur losing the possibility of data so again.
Summary of the invention
Purpose of the present invention proposes a kind ofly can either save memory space exactly, can avoid the active and standby synchronous method of memory database of loss of data again.
The technical scheme that the present invention proposes is: the active and standby synchronous method of a kind of memory database comprises the following steps:
(1) step-out map Acceditation Area, step-out image area, out-of-synchronization queue and the transmission control data area in initialization data storehouse; Described step-out map Acceditation Area be used to put down in writing the association attributes and the method for operation of synchronous meter possibly; Described step-out image area is made up of step-out sign and segmentation tag field, and the step-out sign is used for the type that the storage list record changes, and when record took place to revise, segmentation tag was used to store the field that changes; Described out-of-synchronization queue is used to store the recording mechanism that changes; Described transmission control data area is used to store control of communication data between the master/slave data storehouse;
(2) register in step-out map Acceditation Area carrying out synchronous table in the database, and corresponding step-out image area of initialization and out-of-synchronization queue;
When (3) master data base changes, the change records of change list number is write in the out-of-synchronization queue of respective table, and in the corresponding variation of corresponding step-out image area record;
(4) start real-time synchronized process, the packing of step-out record is sent to the receiving terminal database, simultaneously the respective record in step-out image area and the out-of-synchronization queue is deleted;
(5) the receiving terminal database is accepted data, and upgrades respective table record, echo reply message;
(6) receive confirmation of synchronization after, continue other step-out data synchronously.
In the above-mentioned steps (6), if receive synchronization failure or do not receive synchronous response message in the time of appointment, the step-out record that then carries out certain number of times again transmits.
Above-mentioned synchronous driving is periodically to transmit; When preamble period finishes, stopping synchronously, when start next synchronizing cycle, beginning synchronously from current step-out enrollment.
Data content in the described transmission control data area comprises the database current state, and being used for the judgment data storehouse is in normal operating conditions or at active and standby switching state; Serial number is used for the sequential delivery of controlling packet; Delivery status is used for differentiation and is in idle condition or transmission state; The number of giving out a contract for a project, field is used for the occupation rate of Controlled CPU; Current bag is retransmitted number of times, is used to avoid send same bag always; Current bag sends length, and package operation is conciliate in the packing that is used for control data; When preamble image area number, be used for the table that locking phase is answered the image area correspondence; Step-out image area collection is used to store all and wants synchronous step-out table.
In the described step (4) step-out record packing is sent to the receiving terminal database and is meant according to current step-out map area code traversal out-of-synchronization queue, according to the type packing of step-out record: when the step-out type when inserting, the step-out recorded content is whole record; When the step-out type was deletion, the step-out recorded content was empty; When the step-out type was modification, two bytes of step-out recorded content were the step-out label, were the field value of revising subsequently.
Compared with prior art, set up the change information that step-out image area object is used to describe the correspondence table object in the technical scheme that the present invention proposes, only use less space to write down variation, avoided opening up the directly difficult problem of how to open up buffer size during the storage change record of buffering area.We can store all changes information with less space under this mechanism, thus the call drop of avoiding factor loss of data according to synchronously the time to cause.
The present invention is by managing the step-out recording mechanism with the chained list of array representation, and all connection indications all are to finish by array index, and search all is direct location to data in all operations, has improved whole service speed.
Characteristics in conjunction with exchange data: during data variation, or be to insert, delete, or be the modification of local a small amount of field.At this situation, in the data variation type, have and revise this, this kind variation has avoided each bar record all will transmit the situation of whole piece record, has reduced whole transmission load.
Because the real-time requirement of exchange data, when real-time synchronized process starts, as long as losing step data exists, transmission data in capital are simultaneously because the existence of three kinds of step-out types can't make datagram reach fixing length naturally, therefore in this mechanism, only stipulated the maximum length of packet,, reduced of the waste of regular length bag the data space by increasing the read-write of a small amount of control field control data bag.
Because when data sync, switch also has other business and is handling, so will avoid factor according to causing the situation that other business can't normal process synchronously.Therefore in the transmission control data area, increase packet that relevant field prevents that continuous synchronization always from not responding and lasting step-out record synchronously.
The present invention also is provided with check field to guarantee the correct transmission of packet in transmission package, simultaneously, owing in database, adopted OO method to organize, can carry out heavy duty at the concrete synchronous method of different table object record, needn't revise the primitive of bottom encapsulation and expand.
Description of drawings
Fig. 1 is the main flow chart of technical solution of the present invention;
Fig. 2 is the data structure schematic diagram of transmission control data area of the present invention;
Fig. 3 is the packing format structure figure of step-out record of the present invention;
Fig. 4 is the data format schematic diagram of step-out record bag of the present invention;
Fig. 5 is a step-out record description schematic diagram of the present invention.
Embodiment
The present invention is described in further detail below in conjunction with drawings and Examples.
Fig. 1 is the main flow chart of technical solution of the present invention.As shown in Figure 1, the active and standby synchronous method of memory database of the present invention's proposition comprises the following steps: step-out map Acceditation Area, step-out image area, out-of-synchronization queue and the transmission control data area in (1) initialization data storehouse.In the present invention, created following data structure:
Step-out map Acceditation Area: be used to put down in writing the association attributes and the method for operation of synchronous meter possibly;
The step-out image area: be made up of step-out sign and segmentation tag field, the step-out sign is used for the type that the storage list record changes, and when record took place to revise, segmentation tag was used to store the field that changes;
Out-of-synchronization queue: be used to store the recording mechanism that changes;
Transmission control data area: be used to store control of communication data between the master/slave data storehouse.
(2) register in step-out map Acceditation Area carrying out synchronous table in the database, and initial corresponding step-out image area and out-of-synchronization queue.
When (3) master data base changes, the change records of change list number is write in the out-of-synchronization queue of respective table, and in the corresponding variation of corresponding step-out image area record.
(4) start real-time synchronized process, the packing of step-out record is sent to the receiving terminal database, simultaneously the respective record in step-out image area and the out-of-synchronization queue is deleted.
(5) the receiving terminal database is accepted data, and upgrades respective table record, echo reply message.
(6) receive confirmation of synchronization after, continue other step-out data synchronously.
In the time of appointment, do not receive response or wrong responses, can retransmit certain number of times (for example 3 times), during re-transmission, use same serial number to control.When abandoning packet, need reset to existing type in the step-out image area according to step-out type in the bag, consistent to guarantee with difference in the master/slave data storehouse.
In order to realize above-mentioned technology better, described synchronous driving can be periodically transmission: if transmit number of times in predetermined number of times, then repeat top process, up to same EOS, wait for time cycle next time then.If in predetermined number of times, do not finish synchronously, also to stop synchronously because continue may to influence synchronously the execution of other operations, when beginning to start synchronizing cycle, the next one begins synchronously from current step-out enrollment.
Fig. 2 is the data structure schematic diagram of transmission control data area.Can be synchronous by the timer log-on data.When beginning synchronously, at first fill the transmission control data area, it is synchronous to be used for control data, as shown in Figure 2, field " database current state " is used for the judgment data storehouse in normal operating conditions, still at active and standby switching state, if at switching state, forbid active and standby synchronous.If the active and standby first time is synchronous, field: " number of giving out a contract for a project ", " current bag repeating transmission number of times ", " bust this bag number " put 0." serial number " field is used for the sequential delivery of controlling packet, and whether relatively can differentiate with the serial number field in the bag with this field is the bag of current transmission." delivery status " field is used for differentiation and is in idle condition or transmission state, forbids transmitting simultaneously." number of giving out a contract for a project " field is used for the occupation rate of Controlled CPU, in order to avoid influence the speed of other operations." current bag repeating transmission number of times " is used to avoid send same bag always." current bag transmission length " field is used for the packing of control data and conciliates package operation." transmit the failed packets number " and be used for statistical observation.Data base manipulation " when preamble image area number " locking phase is answered the table of image area correspondence." step-out image area collection " is used to store all and wants synchronous step-out table, and when beginning was synchronous, the step-out map area code of showing write step-out image area collection with changing.
Fig. 3 is the packing format structure figure of step-out record.According to current step-out map area code traversal out-of-synchronization queue, according to the type packing of step-out record.As shown in Figure 2, insert record length, step-out type, recording mechanism respectively.Step-out recorded content field is different and different by the step-out type:
When the step-out type was insertion, the step-out recorded content was whole record;
When the step-out type was deletion, the step-out recorded content was empty;
When the step-out type was modification, two bytes of step-out recorded content were the step-out label, were the field value of revising subsequently;
Therefore, the record length in the bag is indefinite, and unpacking is to determine single record by record length.Because for the record in the database, be to insert record, deletion record or be to revise certain or field seldom, it is quite few the probability that a record only has the minority field not revise to occur, so this kind do not wait longer transmission effectively to reduce data quantity transmitted with a small amount of cost.
Reading the packing of step-out type from the step-out image area when, empty the respective record in the image area, and from out-of-synchronization queue, discharge.
Fig. 4 is the data format schematic diagram of step-out record bag.As shown in Figure 4,, caused the bag in the maximum length scope not isometric, therefore need and unpack record digital section control packing in packet length, table current record number, bag current pointer, the bag because the record in the bag is not isometric.The packet check code is used to guarantee the correct transmission of packet.
After the bag transmission, be set the response time of timer with the control backup database, after backup database is received packet, according to specifying the step-out type to revise corresponding record, with keep active and standby synchronously, and echo reply message.
Fig. 5 is a step-out record description schematic diagram.When system initialization, initialization step-out map Acceditation Area and transmitting control data district, to need synchronous table in step-out map Acceditation Area, to register then, describing the attribute and the method for this step-out map Acceditation Area correspondence, and corresponding step-out image area and the out-of-synchronization queue of each table of initialization.
" step-out image area handle " in the step-out map Acceditation Area is used to identify this data object, " parent object relation table handle " is used for representing that certain of database of this object correspondence opens table, " step-out recording mechanism single-track link table " points to the out-of-synchronization queue of this object correspondence, " step-out image area address " points to the step-out image area of this object correspondence, the step-out information that writes down in this object correspondence table of storage in the step-out image area, the method that respectively adopts at three kinds of step-out types when " the transmission log formation methods of three kinds of step-out type correspondences " are illustrated in the transmission of step-out packing data, " step-out of three kinds of step-out type correspondences writes down update methods " is illustrated in the method for the formation data-base recording that respectively adopts at three kinds of step-out types when receiving the step-out packet that transmits, the method for employing when table record inserts and deletes in " insertion of relation table and delet method " expression database.
When a certain record executable operations of his-and-hers watches, the out-of-synchronization queue that current record number is added table, and with the array index of the step-out image area of the corresponding current table of recording mechanism, add step-out sign and segmentation tag therein, as: recording mechanism is that 5 record changes, and then this variation is described in the 5th element of step-out image area, so promptly can store a field less, can locate fast again, be improved from efficient.
In sum, the method for synchronous of the present invention's proposition combines switch to the data processing requirements The efficient height, real-time characteristics can record transmission according to not synchronous/asynchronous type, with Make transmission quantity be reduced to minimum level. Can guarantee real-time, correct transmission by above method Data and do not affect other normal operatings of database.

Claims (7)

1, the active and standby synchronous method of a kind of memory database is characterized in that comprising the following steps:
(1) step-out map Acceditation Area, step-out image area, out-of-synchronization queue and the transmission control data area in initialization data storehouse; Described step-out map Acceditation Area be used to put down in writing the association attributes and the method for operation of synchronous meter possibly; Described step-out image area is made up of step-out sign and segmentation tag field, and the step-out sign is used for the type that the storage list record changes, and when record took place to revise, segmentation tag was used to store the field that changes; Described out-of-synchronization queue is used to store the recording mechanism that changes; Described transmission control data area is used to store control of communication data between the master/slave data storehouse;
(2) register in step-out map Acceditation Area carrying out synchronous table in the database, and corresponding step-out image area of initialization and out-of-synchronization queue;
When (3) master data base changes, the change records of change list number is write in the out-of-synchronization queue of respective table, and in the corresponding variation of corresponding step-out image area record;
(4) start real-time synchronized process, the packing of step-out record is sent to the receiving terminal database, simultaneously the respective record in step-out image area and the out-of-synchronization queue is deleted;
(5) the receiving terminal database is accepted data, and upgrades respective table record, echo reply message;
(6) receive confirmation of synchronization after, continue other step-out data synchronously.
2, the active and standby synchronous method of a kind of memory database according to claim 1, it is characterized in that in the described step (6), if receive synchronization failure or do not receive synchronous response message in the time of appointment, the step-out record that then carries out certain number of times again transmits.
3, the active and standby synchronous method of a kind of memory database according to claim 2 is characterized in that described number of retransmissions is 3 times.
4, the active and standby synchronous method of a kind of memory database according to claim 1 is characterized in that described synchronous driving is for periodically transmitting; When preamble period finishes, stopping synchronously, when start next synchronizing cycle, beginning synchronously from current step-out enrollment.
5, the active and standby synchronous method of a kind of memory database according to claim 4 is characterized in that described data sync starts by timer.
6, the active and standby synchronous method of a kind of memory database according to claim 1, it is characterized in that the data content in the described transmission control data area comprises the database current state, being used for the judgment data storehouse is in normal operating conditions or at active and standby switching state; Serial number is used for the sequential delivery of controlling packet; Delivery status is used for differentiation and is in idle condition or transmission state; The digital section of giving out a contract for a project is used for the occupation rate of Controlled CPU; Current bag is retransmitted number of times, is used to avoid send same bag always; Current bag sends length, and package operation is conciliate in the packing that is used for control data; When preamble image area number, be used for the table that locking phase is answered the image area correspondence; Step-out image area collection is used to store the corresponding step-out map area code that changes and show.
7, the active and standby synchronous method of a kind of memory database according to claim 1, it is characterized in that in the described step (4) packing of step-out record being sent to the receiving terminal database is meant according to current step-out map area code traversal out-of-synchronization queue, type packing according to the step-out record: when the step-out type was insertion, the step-out recorded content was whole record; When the step-out type was deletion, the step-out recorded content was empty; When the step-out type was modification, two bytes of step-out recorded content were the step-out label, were the field value of revising subsequently.
CN 200410006155 2004-03-04 2004-03-04 Method of internal data base main-spare synchronous Expired - Fee Related CN1286288C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200410006155 CN1286288C (en) 2004-03-04 2004-03-04 Method of internal data base main-spare synchronous

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200410006155 CN1286288C (en) 2004-03-04 2004-03-04 Method of internal data base main-spare synchronous

Publications (2)

Publication Number Publication Date
CN1561022A CN1561022A (en) 2005-01-05
CN1286288C true CN1286288C (en) 2006-11-22

Family

ID=34439718

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200410006155 Expired - Fee Related CN1286288C (en) 2004-03-04 2004-03-04 Method of internal data base main-spare synchronous

Country Status (1)

Country Link
CN (1) CN1286288C (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101299710B (en) * 2007-04-30 2012-10-10 中兴通讯股份有限公司 Method for synchronization of memory database data

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100397803C (en) * 2005-02-01 2008-06-25 北京北方烽火科技有限公司 N+1 duplicates data real-time synchronising method
CN100369038C (en) * 2005-02-24 2008-02-13 中兴通讯股份有限公司 Method for implementing realtime database routine operation
CN100433880C (en) * 2005-05-17 2008-11-12 中兴通讯股份有限公司 Method for carrying out active-standby increment backup protection on data area resource facing object
CN100463444C (en) * 2005-07-20 2009-02-18 中兴通讯股份有限公司 Method for main and spare synchronization of call data
CN100449548C (en) * 2007-04-11 2009-01-07 华为技术有限公司 Method and system for synchronizing data base
CN101526940B (en) * 2008-03-19 2011-03-16 中兴通讯股份有限公司 Method for synchronizing data of physical database and main memory database of application system
CN101446972B (en) * 2008-12-12 2013-03-20 中兴通讯股份有限公司 Method and system for dynamic data synchronization
CN102023974B (en) * 2009-09-14 2012-08-22 中国移动通信集团公司 Method, device and system for processing message by message queue
CN102043686B (en) * 2009-10-20 2012-11-14 华为技术有限公司 Disaster tolerance method, backup server and system of memory database
CN102238206A (en) * 2010-04-23 2011-11-09 英业达集团(天津)电子技术有限公司 Image file packet retransmission method
CN102495849B (en) * 2011-11-18 2017-07-14 南京中兴新软件有限责任公司 The method and device of distributed system data syn-chronization
CN104111937A (en) * 2013-04-18 2014-10-22 中兴通讯股份有限公司 Master database standby database and data consistency testing and repairing method and device of master database and standby database
CN105528366B (en) * 2014-09-30 2018-11-06 阿里巴巴集团控股有限公司 A kind of data synchronization control method and device
CN105468475A (en) * 2015-11-16 2016-04-06 北京奇虎科技有限公司 Backup method and backup device of database
CN105447136A (en) * 2015-11-20 2016-03-30 上海斐讯数据通信技术有限公司 Method and system for improving database writing speed on the basis of WiFi (Wireless Fidelity) smart socket
CN107426237A (en) * 2017-08-10 2017-12-01 汪清翼嘉电子商务有限公司 The big data network verifying system and method for a kind of userspersonal information
CN108549651A (en) * 2018-03-05 2018-09-18 陈玉洪 A kind of active and standby database synchronization method and system
CN112087514A (en) * 2020-09-10 2020-12-15 麦碳翁工业技术南京有限公司 Method for managing oil tank area by information management platform

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101299710B (en) * 2007-04-30 2012-10-10 中兴通讯股份有限公司 Method for synchronization of memory database data

Also Published As

Publication number Publication date
CN1561022A (en) 2005-01-05

Similar Documents

Publication Publication Date Title
CN1286288C (en) Method of internal data base main-spare synchronous
CN1079552C (en) Real time data migration system and method employing sparse files
CN1725186A (en) Multiple data base data syne method
CN1093660C (en) System method for efficiently transferring datastreams in multimedia system
CN110196844B (en) Data migration method, system and storage medium
CN1264304C (en) Real-time synchronizing method for data in both main and spare board in communication system
CN1099785C (en) Data management system and method for replicated data
EP1940107A1 (en) A method for processing data synchronization and client terminal, server and data synchronization system thereof
CN101510838B (en) Method for implementing perdurable data queue
CN1619544A (en) Method and apparatus for data processing
CN101102577A (en) Incremental synchronization method for data in tables of frontground and background database of wireless communication base station system
CN101854388A (en) Method and system concurrently accessing a large amount of small documents in cluster storage
CN101051925A (en) Method for realizing network communication list data synchronization
CN1869933A (en) Computer processing system for implementing data update and data updating method
CN101526958A (en) Method and system for synchronizing data between IPTV system modules
CN109271098A (en) A kind of data migration method and device
CN1522530A (en) Receiver apparatus and method
US7818390B2 (en) Method for transferring data between terminal apparatuses in a transparent computation system
CN102939593A (en) Endless memory
CN102014076B (en) PCIe retry buffer area and realization method thereof
CN1804822A (en) Multi-interruption cache device and method
CN1351299A (en) Method and device for accessing database
CN1426244A (en) Main and spare internal memory data processing method
CN101051267A (en) Extendable file model and method for managing file model
CN1234074C (en) Mirror method for files based on Internet

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20061122

Termination date: 20150304

EXPY Termination of patent right or utility model