CN101944114A - Data synchronization method between memory database and physical database - Google Patents

Data synchronization method between memory database and physical database Download PDF

Info

Publication number
CN101944114A
CN101944114A CN 201010285234 CN201010285234A CN101944114A CN 101944114 A CN101944114 A CN 101944114A CN 201010285234 CN201010285234 CN 201010285234 CN 201010285234 A CN201010285234 A CN 201010285234A CN 101944114 A CN101944114 A CN 101944114A
Authority
CN
China
Prior art keywords
sql
database
grammer
memory database
data
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.)
Granted
Application number
CN 201010285234
Other languages
Chinese (zh)
Other versions
CN101944114B (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.)
Shenzhen Tydic Information Technology Co ltd
Original Assignee
Shenzhen Tydic Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Tydic Information Technology Co ltd filed Critical Shenzhen Tydic Information Technology Co ltd
Priority to CN2010102852347A priority Critical patent/CN101944114B/en
Publication of CN101944114A publication Critical patent/CN101944114A/en
Application granted granted Critical
Publication of CN101944114B publication Critical patent/CN101944114B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention relates to a data synchronization method between an memory database and a physical database. The method comprises the following steps: 1) representing the operation to the source database in the mode of SQL operation, decomposing the SQL operation to an SQL syntax and the corresponding SQL parameters, registering the SQL syntax and the SQL parameters of the operation source database, storing the registered SQL syntax and the SQL parameters in an SQL management region to manage; 2) for a data change of the source database, combining the SQL syntax with the SQL parameters to generate a logical log; and 3) regenerating the logical log of the step 2) in the target database according to the registered SQL syntax and the SQL parameters. The data synchronization method of the invention utilizes the prepare mechanism once and the execute mechanism many times to greatly increase the synchronization efficiency; the size of the logical log is reduced, the transmission loss of the system and the waste of the disk space are reduced; and the synchronization application and the corresponding SQL changes can be supported, and the updating and extending of the system can be supported.

Description

Method of data synchronization between memory database and physical database
Technical field
The present invention relates to data processing method, relate in particular to the method for data synchronization between a kind of memory database and physical database.
Background technology
Modern communications is more and more stronger to the computer technology dependence, in the continuous development of telecom operators, set up the various information system, comprise Operation Network system, comprehensive accounting system, charge system, the office automation system, customer service system, big customer's management system, performance analysis and decision system or the like, these systems have accumulated the valuable data information of magnanimity, by these data are carried out data mining, query analysis and on-line analysis, can discern the market opportunity, formulate market strategy, further improve customer relationship.But, these data informations are too huge, the record strip number is easily in hundred million, with the China Mobile is example, its national mobile phone user's sum surpasses 300,000,000, and the userbase of many provinces company all surpasses ten million, for huge data volume like this, traditional physical database based on disk (RMDB) management system more and more is difficult to deal with, so memory database (MDB) has occurred at field of telecommunications.
Because the fast development of market and technology, telecommunication service is in continuous expansion, its operation and management is continued to optimize, the framework of some traditional support systems can not satisfy growing business need and customer demand gradually, introduces some new technology and solves the problem that we run in producing and be inevitable.By adopting memory database to replace former share memory technology, make to comprise non-type thing in internal memory originally interface, form and managed all standardization.
Memory database is placed on data the database of direct control in the internal memory exactly.With respect to disk, the reading and writing data speed of internal memory will exceed several magnitude, saves the data in to compare in the internal memory from the disk visit greatly to improve the performance of application.Memory database has been abandoned the traditional approach of data in magnetic disk management simultaneously, all in internal memory, redesigned architecture based on total data, and aspect metadata cache, fast algorithm, parallel work-flow, also carried out corresponding improvement, so data processing speed is more a lot of soon than the data processing speed of traditional database, generally all more than 10 times.
With respect to utilizing program development means invoke memory to handle, memory database is had its own advantage.At first, memory database is the database management language of commercialization, has greatly shortened the construction cycle; Secondly, memory database has open platform and interface, and program development and transplanting are convenient more flexibly, also is convenient to safeguard and secondary development; The 3rd, can be by using the unified sql like language data in the audit memory easily; At last, can in database, ensure safety of data and integrality.These advantages safeguard it all is favourable for quick deployment and simplification.
Always in constantly changing, this just relates to data and physical database (disk database) data synchronization problem in the memory database to data in telecommunication business data and the charge system.Data sync in the system comprises two parts: from the memory database to the physical database synchronous (reverse sync) and synchronous (forward is synchronous) from the physical database to the memory database.
1, forward is synchronous.This part data sync adopts the mode of increment list, and the newly-increased or data updated of business system or CRM (customer relation management) will be generated in the increment list of physical database, then synchronization program these data sync in memory database.Because the data volume of increment list is very little, and data sync is real-time, can not influence accounting routine.
2, reverse sync.Because the charging backstage wholesale price of physical database, tired account data nearly all have been loaded in the memory database, so the tables of data of physical database correspondence will be mainly used in the data query that the data backup and the periphery of memory database are used.In order to guarantee that periphery uses the correctness obtain data, the change formation logic daily record of memory table, then by synchronization program real-time in physical database synchronously.
Existing data sync mode need write down a large amount of logic logs, and data synchronization efficiency is not high, therefore needs improvement badly.
Summary of the invention
The object of the present invention is to provide the method for data synchronization between a kind of high efficiency memory database and physical database.
For achieving the above object, the invention provides the method for data synchronization between a kind of memory database and physical database, comprising:
Step 1, represent operation to source database with the form of SQL operation, the SQL operation is decomposed into SQL grammer and corresponding SQL parameter, the SQL grammer and the SQL parameter of registration operate source database, and the SQL grammer of registration and SQL parameter be stored in the SQL directorial area managed;
Step 2, for the data movement of source database, with of the form formation logic daily record of SQL grammer in conjunction with the SQL parameter;
Step 3, according to the registration SQL grammer and SQL parameter, the logic log in the step 2 is reformed in the destination data storehouse.
Wherein, in the step 3, every related SQL grammer of logic log, when carrying out the reforming of destination data storehouse, at first search SQL grammer after the preparation,, and then carry out the SQL grammer and reformed in the destination data storehouse if not then carry out the preparation of SQL grammer by the SQL grammer of registering in the directorial area.
On the one hand, for the data sync from the memory database to the physical database:
In the step 1, when the application process that can operate memory database in the system brings into operation, this application process is at first registered SQL grammer and SQL parameter to memory database, generates a copy simultaneously and is stored in the SQL directorial area, and this copy is for the daily record of the execution physical database usefulness of reforming;
In the step 2, the application process in the capture systems is to the operation of memory database, with the form formation logic daily record of SQL grammer in conjunction with the SQL parameter;
In the step 3,, the logic log in the step 2 is reformed in physical database according to the SQL grammer and the SQL parameter of registration.
Wherein, make each application process to the corresponding SQL operational group of the operation of memory database, each SQL operational group comprises several SQL operations, and each SQL operation is made up of SQL grammer and SQL parameter group.
Wherein, also comprise:, set up the relation, application process of apply names and corresponding application process and the relation of corresponding SQL operational group for all need carry out the application process of data sync in the system.
Wherein, after the formation logic daily record, system also collects the logic log that generates in the step 2: corresponding to the related affairs buffer zone of each thread of application process, be used for storing the logic log that an office generates; Use buffer zone corresponding to related one of each application process, be used for storing the logic log that this all example of application process is generated; Each application process stores the logic log that is generated in the message queue into more then; From message queue, obtain the logic log of application process and be placed in the system buffer, and the logic log in the system buffer is written in the journal file of memory database.
Wherein, in the step 3, at first load and resolve the journal file of memory database,, according to the SQL grammer and the SQL parameter of registration, the logic log of generation is reformed in physical database then by resolving the logic log that journal file obtains in the step 2 being generated.
Wherein, in the step 3, when carrying out the reforming of physical database, search the SQL grammer after the preparation in the SQL grammer of at first in directorial area, registering,, and then carry out the SQL grammer physical database is reformed if not then carry out the preparation of SQL grammer.
On the other hand, for the data sync from the physical database to the memory database:
In the step 1,, SQL syntax table and SQL parameter list are set in the SQL directorial area, are used for registering the SQL grammer and the SQL parameter of operating physical database respectively according to the journal file of physical database;
In the step 2,, the logic log table is set, when the data of physical database change,, the data that change is write the logic log table by the trigger mechanism that physical database provides according to the journal file of physical database;
In the step 3, real time scan logic log table according to the SQL grammer and the SQL parameter of registration, is reformed the logic log of step 2 correspondence at memory database.
Wherein, in the step 3, when carrying out the reforming of memory database:
Step 3.1, get access to logic log after, obtain SQL grammer after the preparation according to the SQL syntax table;
If step 3.2 is obtained the SQL grammer success after the preparation, directly execution in step 3.3; If obtain the SQL grammer failure after the preparation, then in the SQL syntax table, obtain the SQL grammer, carry out the beamhouse operation of memory database then, and in the SQL parameter list, get parms, carry out the Wire Parameters operation of memory database then, thereby finish reforming of memory database;
Step 3.3, split out all SQL parameters, set gradually in the SQL grammer, carry out reforming of memory database then according to logic log.
In sum, the method for data synchronization between memory database of the present invention and physical database has utilized prepare and execute mechanism repeatedly, has improved synchronous efficiency greatly; Reduce the size of logic log, reduced the waste of system transmissions loss and disk space; Support the variation of synchronous applications and corresponding SQL, supported the upgrading and the expansion of system.
Description of drawings
Below in conjunction with accompanying drawing,, will make technical scheme of the present invention and other beneficial effects apparent by the specific embodiment of the present invention is described in detail.
In the accompanying drawing,
Fig. 1 is the process flow diagram of the method for data synchronization between memory database of the present invention and physical database;
Fig. 2 is the structural representation of reverse sync system of having used a preferred embodiment of the method for data synchronization between memory database of the present invention and physical database;
Fig. 3 is the data flow diagram of the reverse sync of reverse sync system shown in Figure 2;
Fig. 4 is the data flow diagram of forward synchro system of having used a preferred embodiment of the method for data synchronization between memory database of the present invention and physical database.
Embodiment
Figure 1 shows that the process flow diagram of the method for data synchronization between memory database of the present invention and physical database.This method comprises: step 1, represent operation to source database with the form of SQL operation, the SQL operation is decomposed into SQL grammer and corresponding SQL parameter, the SQL grammer and the SQL parameter of registration operate source database, and the SQL grammer of registration and SQL parameter be stored in the SQL directorial area managed; Step 2, for the data movement of source database, with of the form formation logic daily record of SQL grammer in conjunction with the SQL parameter; Step 3, according to the registration SQL grammer and SQL parameter, the logic log in the step 2 is reformed in the destination data storehouse.
In the step 3, the related SQL grammer of every logic log when carrying out the reforming of destination data storehouse, is at first searched SQL grammer after the preparation by the SQL grammer of registering in the directorial area, if not then carry out the preparation of SQL grammer, and then carry out the SQL grammer and reformed in the destination data storehouse.The present invention is by splitting into SQL statement SQL grammer and dynamic parameter, and logic log is made up of SQL grammer numbering and dynamic parameter, has reduced the size of logic log so greatly, has reduced the waste of system transmissions loss and disk space.Make full use of a prepare (preparation) of SQL grammer and execute (execution) mechanism repeatedly simultaneously, improved synchronous efficiency greatly, reduced the time delay of data sync.
Method of data synchronization between memory database of the present invention and physical database is applicable to the system that has memory database and physical database simultaneously, such system can be made up of some main frames, memory database and physical database can be provided with simultaneously and be also can be separately positioned on the different main frames on the main frame.For example, such system can be the business data and the charge system of telecommunications.Can support the operation of various application (application program) in the system, the application that is in running status in the system is called application process.Method of data synchronization between memory database of the present invention and physical database is supported from the memory database to the physical database synchronous (reverse sync) and synchronous (forward is synchronous) from the physical database to the memory database simultaneously.
Figure 2 shows that the structural representation of reverse sync system of a preferred embodiment of the method for data synchronization of having used between memory database of the present invention and physical database.This preferred embodiment is by using method of the present invention, in the system that has between memory database and physical database, realized supporting that the reverse sync and the forward of data are synchronous, according to the direction of data sync, this preferred embodiment can be divided into reverse sync system and forward synchro system two parts.
At first describe the reverse sync system of this preferred embodiment in detail with reference to Fig. 2.
1 reverse sync
In this preferred embodiment, the daily record that reverse sync the is based on database mechanism of reforming realizes, thereby can support the hybrid programming pattern of multi-process and multithreading.Reverse sync program (reverse sync system) externally provides operation memory database API (Application Programming Interface, application programming interface) and secondary development bag (the mdbutil kit of dynamic base, be used to connect memory database), use based on the reverse sync program (reverse sync system) of this interface exploitation and support memory database synchronous to physical database.Application process in the system (using 1) is to the operation of memory database, caught and be recorded in the logic log of memory database by internal storage data mdbutil kit, carry out the persistence (writing journal file) of daily record by reverse sync program (reverse sync system) then and the daily record of physical database is reformed.The mdbutil kit is made up of application management, SQL management and log management three big modules.All management information all is stored in the shared memory of system, has guaranteed the safety of system information.The structure of reverse sync system specifies as follows.
1.1 system architecture
1.1.1 application management
All need synchronous application process in the management host (system), for all need carry out the application process of data sync in the system, safeguard the relation of relation, application process and the corresponding SQL operational group of setting up apply names and corresponding application process.At first call the initialization action of mdbutil during the reverse sync program start, corresponding simultaneously apply names, progress information are registered in the synchro system.
1.1.2SQL management
The SQL administration module is responsible for the SQL grammer in the memory database and the management of corresponding parameter.That is to say, corresponding to step 1 of the present invention, the SQL statement of expression SQL operation is decomposed into the form of SQL grammer and corresponding parameters, simultaneously, when the application beginning forms application process in internal memory, the SQL grammer that may use when application process is registered this apply changes memory database and corresponding parameters generate a copy simultaneously and are stored in the SQL directorial area to memory database, and this copy is for the daily record of the execution physical database usefulness of reforming.Describe with sql like language, the main data structure in the SQL directorial area is as follows:
//SQL grammer
typedef?struct
{
TUINT8id:8; // application numbers
TUINT8oper:8; // operation sequence number
TINT8sql[MDBUTIL_SYNC_SQL_LEN-2]; //SQL statement
}SSQLSyntax;
//SQL parameter
typedef?struct
{
TUINT32type; // parameter type
TUINT32size; // parameter size
}SSQLParam;
//SQL parameter group
typedef?struct
{
TINT32num; // number of parameters
TINT32unused; // placeholder
SSQLParam?array[MDBUTIL_SYNC_SQL_PARAM_NUM];
}SSQLParams;
//SQL operation
typedef?struct
{
SSQLSyntax syntax; //SQL grammer
SSQLParams params; //SQL parameter
}SDMLOper;
//SQL operational group
typedef?struct
{
SSemLock lock; // atom lock
TUINT32 id:8; / application numbers
TUINT32 flag:8; // service marking
TUINT32 num:16; //SQL number
TUINT32 unused; // placeholder
SDMLOper?group[MDBUTIL_SYNC_SQL?KIND_SIZE];
}SDMLOperGroup;
The definition of data structure is ascending, makes each application process all can a corresponding SQL operational group (SDMLOperGroup) to the operation of memory database.Each SQL operational group comprises several SQL operations, and each SQL operation all is made up of SQL grammer (SSQLSyntax) and SQL parameter group (SSQLParams).
1.1.3 log management
Main generation, the packing (collection of logic log) of being responsible for logic log, land (generate journal file, journal file is the comprehensive of all logic logs) and reform (to physical database).Corresponding to step 2 of the present invention, the application process in the reverse sync program capture systems is to the operation of memory database, with the form formation logic daily record of SQL grammer in conjunction with the SQL parameter.Describe with sql like language, the organization definition of logic log of the present invention is as follows:
// logic log head
typedef?struct
{
TUINT32 id:8; // application numbers
TUINT32 oper:8; //SQL numbering
TUINT32 len:16; // daily record length
TUINT32 seq; // log-sequence numbers
}SLogicHead;
//type-length-value
typedef?struct
{
TUINT32 type:4; // data type
TUINT32 len:12; // data length
TUINT8 value[2]; // numerical value
TUINT8?unused[MDBUTIL_SYNC_PARAM_LEN];
}STLV;
// logic log body
typedef?struct
{
STLV tlv[1]; // array
}SLogicBody;
// logic log
typedef?struct
{
SLogicHead?head;
SLogicBody?body;
}SLogicLog;
// public buffer head
typedef?struct
{
TUINTL id; // numbering
TUINT32 num; // number
TUINT32 len; // length
}SLogBufHead;
// affairs logic log buffer head
typedef?struct
{
SLogBufHead com; // public part
TUINT32 start; // the start time
TUINT32 group; // operational group
TUINT64?unused;
}STransLogBufHead;
// affairs logic log buffering
typedef?struct
{
STransLogBufHead head; // sew drift
TINT8buf[MDBUTIL_SYNC_PLACE HOLD]; // data buffering
}STransLogBuf;
Wherein, logic log is the least unit of operating database, and transaction journal is the least unit of synchronous operation, and transaction journal is made up of one or more logic logs.
1.1.3.1 logic log
Logic log is made up of daily record head and daily record body two parts, and wherein the daily record body is made up of one group of parameter (number can be 0), and each parameter is stored by TLV (type-length-value, type one length-value) structure.The daily record head is made up of id (numbering), oper (operation), len (length) and seq (sequence number), and wherein id and oper are used to refer to unique SQL operation, the length of len presentation logic daily record, and seq represents the sequence number in the affairs.
1.1.3.2 transaction journal
Affairs are combinations of logic log, are made up of buffer head and buffer zone two parts.Buffer head is made up of id, num (number), len, start (start time) and group (operational group), and wherein id is an affairs sequence number of carrying out memory database.Logic log is to store in the buffer zone according to execution sequence.
According to step 3 of the present invention, the formation logic daily record can be reformed in physical database according to SQL grammer of registering in the SQL directorial area and SQL parameter, because the formation logic daily record is the structure of SQL grammer in conjunction with the SQL parameter, make full use of a prepare (preparation) of SQL grammer and execute (execution) mechanism repeatedly, improved synchronous efficiency greatly.
It more than is the system architecture of reverse sync system, illustrated among the present invention and used and SQL statement (being decomposed into grammer and parameter), the relation of SQL statement and logic log, application is represented with the SQL statement that is decomposed into SQL grammer and parameter the operation of memory database, uses SQL grammer and parameter to generate logic log simultaneously.Compared to existing method of data synchronization, the dynamic increase that synchronization program support of the present invention is used and SQL operates, thus supported that system carries out level and smooth upgrading.By the fractionation of SQL grammer and parameter, reduced data transmission greatly, improved synchronous execution efficient.
For process synchronous from the memory database to the physical database, it is whole synchronous core content that logic log is reformed, and logic log packing is arranged, logic log land and logic log in execution of physical database or the like.
As shown in Figure 3, it is the data flow diagram of the reverse sync of reverse sync system shown in Figure 2, shows synchronous mode of operation by dynamic logic log among Fig. 3.
1.2 data circulation
If data stream alternation of hosts's expression daily record collection process from less to more, buffering (T Buf) from the logic log to affairs arrives and uses buffering (App Buf), arrive message queue (Queue) again, to system buffer (SysBuf),, finally carry out physical database to journal file (Log file).Whole collection process is similar to the formation of seawater, brook, river, Jiang Hehai.
At first, be used for storing the logic log of affairs corresponding to related affairs buffer zone of each thread of application process (use 1, use 2......); There is one to use buffer zone corresponding to each application, is used for storing the daily record that this uses all examples; Again logic log is stored in the message queue by each application then.The reverse sync program is obtained the application daily record and is placed in the system buffer (SysBuf) from message queue, and the logic log in the system buffer is written in the journal file.Last synchronization program loads and resolves journal file, and logic log is reformed in physical database.
The whole circulation process of data has made full use of a prepare (preparation) of SQL grammer and execute (execution) mechanism repeatedly.Improve synchronous efficiency greatly, reduced the time delay of data sync.Every logic log can related SQL grammer, when carrying out the physical database operation, at first searches the SQL grammer behind the prepare, if not then carry out the prepare of SQL grammer, and then carries out SQL grammer execute.By the delay of SQL grammer, supported the dynamic increase of application and SQL.
1.3 dynamic synchronization
With reference to existing data synchronous system, if the logic log of catching is SQL statement (not having dynamic parameter), system itself just supports synchronously dynamic so.But the existing this method of synchronization has increased record logic log amount on the one hand, has wasted a large amount of disk storage spaces; Do not make full use of prepare of database and execute mechanism repeatedly simultaneously, data synchronization efficiency is not high, is not enough to support real-time transaction system and uses.
And in the present invention, at first by SQL statement being split into SQL grammer and dynamic parameter, logic log is made up of SQL grammer numbering and dynamic parameter.Reduce the size of logic log so greatly, reduced the waste of system transmissions loss and disk space.Prepare and execute mechanism have repeatedly been utilized simultaneously, improved synchronous efficiency greatly, when carrying out the reforming of physical database, search the SQL grammer after the preparation in the SQL grammer of at first in directorial area, registering, if not then carry out the preparation of SQL grammer, and then carry out the SQL grammer physical database is reformed.
Secondly the variation of synchronous applications and corresponding SQL has been supported in the dynamic increase of application and SQL among the present invention, has supported the upgrading and the expansion of system; By postponing the prepare of physical database SQL grammer, guaranteed that initiate SQL grammer can reform.The prepare of the dynamic increase of SQL and delay SQL grammer has finished reverse dynamic synchronization jointly.Whole in fact synchronizing process also is many execute of a prepare.
2 forwards are synchronous
In this preferred embodiment, the trigger mechanism that forward synchro system (forward synchronization program) is based on physical database realizes that this is because the storage mode and the mode of operation of physical database are different from memory database.At first, because the performance of physical database own is not high, the performance loss of trigger itself is little to the influence of physical database application performance; Secondly, the operation entry of physical database is more, OCI interface of foreground, database terminal, application (ORACLE calling interface) or the like can be as the operation entry of physical database, so trigger can be used as unique inlet of physical database data movement.When the data of physical database change,, the data that change are write the logic log table of physical database by the trigger mechanism that physical database self provides.Then by the logic log table of forward synchronization program (forward synchro system) real time scan physical database, and counterlogic day is aimed at memory database reform.
As shown in Figure 4, it is the data flow diagram of forward synchro system of having used a preferred embodiment of the method for data synchronization between memory database of the present invention and physical database.In this preferred embodiment, use (OCI interface of foreground, database terminal, application or the like) is reflected to physical database by trigger mechanism to the operation of physical database logic log table, forward synchronization program (forward synchro system) is got in touch by interface table and physical database, and the interface table is made up of the logic log table of physical database and the SQL syntax table and the SQL parameter list of SQL directorial area.
During data sync from the physical database to the memory database, according to step 1 of the present invention, according to the journal file of physical database, SQL syntax table and SQL parameter list are set in the SQL directorial area, be used for registering the SQL grammer and the SQL parameter of operating physical database respectively; According to step 2 of the present invention,, the logic log table is set then, when the data of physical database change,, the data that change is write the logic log table by the trigger mechanism that physical database provides according to the journal file of physical database; According to step 3 of the present invention, real time scan logic log table according to the SQL grammer and the SQL parameter of registration, is reformed the logic log of step 2 correspondence at memory database.In this preferred embodiment, the design of interface table is as follows:
2.1 interface table design
2.1.1 logic log table
Figure BSA00000274494200131
Figure BSA00000274494200141
2.1.2SQL syntax table
Figure BSA00000274494200142
2.1.3SQL parameter list
Figure BSA00000274494200151
2.1 the data stream when carrying out reforming of memory database according to step 3 of the present invention
2.1.1 after the forward synchronization program gets access to logic log, obtain SQL grammer behind the prepare according to the TABLE_ID in the SQL syntax table and OPR_TYPE.
2.1.2 obtain the SQL grammer success behind the prepare, directly carry out next step.Otherwise, obtain the SQL grammer according to TABLE_ID and OPR_TYPE at the SQL syntax table, carry out the prepare operation of memory database then; In the SQL parameter list, get parms, carry out the Wire Parameters operation of memory database then successively, thereby finish reforming of memory database.
2.1.3 according to the SYN_DATA in the logic log, split out all parameters, set gradually in the SQL grammer, carry out the execute operation of memory database then, finally finished reforming of internal storage data, made the data of memory database and the data sync in the physical database.
Method of data synchronization between memory database of the present invention and physical database has been realized the data bridge of memory database and physical database, and unified Data View externally is provided; By between application and database, adding the Data Control layer, can when finishing normal data manipulation, data movement be copied in the destination data storehouse.
In sum, the method for data synchronization between memory database of the present invention and physical database has utilized prepare and execute mechanism repeatedly, has improved synchronous efficiency greatly; Reduce the size of logic log, reduced the waste of system transmissions loss and disk space; Support the variation of synchronous applications and corresponding SQL, supported the upgrading and the expansion of system.
The above; for the person of ordinary skill of the art; can make other various corresponding changes and distortion according to technical scheme of the present invention and technical conceive, and all these changes and distortion all should belong to the protection domain of accompanying Claim of the present invention.

Claims (10)

1. the method for data synchronization between memory database and physical database is characterized in that, comprising:
Step 1, represent operation to source database with the form of SQL operation, the SQL operation is decomposed into SQL grammer and corresponding SQL parameter, the SQL grammer and the SQL parameter of registration operate source database, and the SQL grammer of registration and SQL parameter be stored in the SQL directorial area managed;
Step 2, for the data movement of source database, with of the form formation logic daily record of SQL grammer in conjunction with the SQL parameter;
Step 3, according to the registration SQL grammer and SQL parameter, the logic log in the step 2 is reformed in the destination data storehouse.
2. the method for data synchronization between memory database as claimed in claim 1 and physical database, it is characterized in that, in the step 3, every related SQL grammer of logic log, when carrying out the reforming of destination data storehouse, at first search SQL grammer after the preparation,, and then carry out the SQL grammer and reformed in the destination data storehouse if not then carry out the preparation of SQL grammer by the SQL grammer of registering in the directorial area.
3. the method for data synchronization between memory database as claimed in claim 2 and physical database is characterized in that, for the data sync from the memory database to the physical database:
In the step 1, when the application process that can operate memory database in the system brings into operation, this application process is at first registered SQL grammer and SQL parameter to memory database, generates a copy simultaneously and is stored in the SQL directorial area, and this copy is for the daily record of the execution physical database usefulness of reforming;
In the step 2, the application process in the capture systems is to the operation of memory database, with the form formation logic daily record of SQL grammer in conjunction with the SQL parameter;
In the step 3,, the logic log in the step 2 is reformed in physical database according to the SQL grammer and the SQL parameter of registration.
4. the method for data synchronization between memory database as claimed in claim 3 and physical database, it is characterized in that, make each application process to the corresponding SQL operational group of the operation of memory database, each SQL operational group comprises several SQL operations, and each SQL operation is made up of SQL grammer and SQL parameter group.
5. the method for data synchronization between memory database as claimed in claim 4 and physical database, it is characterized in that, also comprise:, set up the relation, application process of apply names and corresponding application process and the relation of corresponding SQL operational group for all need carry out the application process of data sync in the system.
6. the method for data synchronization between memory database as claimed in claim 3 and physical database, it is characterized in that, in the step 2 after the formation logic daily record, system also collects the logic log that generates: corresponding to the related affairs buffer zone of each thread of application process, be used for storing the logic log that an office generates; Use buffer zone corresponding to related one of each application process, be used for storing the logic log that this all example of application process is generated; Each application process stores the logic log that is generated in the message queue into more then; From message queue, obtain the logic log of application process and be placed in the system buffer, and the logic log in the system buffer is written in the journal file of memory database.
7. the method for data synchronization between memory database as claimed in claim 6 and physical database, it is characterized in that, in the step 3, at first load and resolve the journal file of memory database, by resolving the logic log that journal file obtains in the step 2 being generated, according to the SQL grammer and the SQL parameter of registration, the logic log that generates is reformed in physical database then.
8. the method for data synchronization between memory database as claimed in claim 3 and physical database, it is characterized in that, in the step 3, when carrying out the reforming of physical database, search the SQL grammer after the preparation in the SQL grammer of at first in directorial area, registering, if not then carry out the preparation of SQL grammer, and then carry out the SQL grammer physical database is reformed.
9. the method for data synchronization between memory database as claimed in claim 2 and physical database is characterized in that, for the data sync from the physical database to the memory database:
In the step 1,, SQL syntax table and SQL parameter list are set in the SQL directorial area, are used for registering the SQL grammer and the SQL parameter of operating physical database respectively according to the journal file of physical database;
In the step 2,, the logic log table is set, when the data of physical database change,, the data that change is write the logic log table by the trigger mechanism that physical database provides according to the journal file of physical database;
In the step 3, real time scan logic log table according to the SQL grammer and the SQL parameter of registration, is reformed the logic log of step 2 correspondence at memory database.
10. the method for data synchronization between memory database as claimed in claim 9 and physical database is characterized in that, in the step 3, when carrying out the reforming of memory database:
Step 3.1, get access to logic log after, obtain SQL grammer after the preparation according to the SQL syntax table;
If step 3.2 is obtained the SQL grammer success after the preparation, directly execution in step 3.3; If obtain the SQL grammer failure after the preparation, then in the SQL syntax table, obtain the SQL grammer, carry out the beamhouse operation of memory database then, and in the SQL parameter list, get parms, carry out the Wire Parameters operation of memory database then, thereby finish reforming of memory database;
Step 3.3, split out all SQL parameters, set gradually in the SQL grammer, carry out reforming of memory database then according to logic log.
CN2010102852347A 2010-09-16 2010-09-16 Data synchronization method between memory database and physical database Active CN101944114B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2010102852347A CN101944114B (en) 2010-09-16 2010-09-16 Data synchronization method between memory database and physical database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2010102852347A CN101944114B (en) 2010-09-16 2010-09-16 Data synchronization method between memory database and physical database

Publications (2)

Publication Number Publication Date
CN101944114A true CN101944114A (en) 2011-01-12
CN101944114B CN101944114B (en) 2012-07-25

Family

ID=43436105

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2010102852347A Active CN101944114B (en) 2010-09-16 2010-09-16 Data synchronization method between memory database and physical database

Country Status (1)

Country Link
CN (1) CN101944114B (en)

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102289469A (en) * 2011-07-26 2011-12-21 国电南瑞科技股份有限公司 Method for supporting universal database to synchronize data based on physical isolating equipment
CN102393860A (en) * 2011-12-06 2012-03-28 方正国际软件有限公司 Database data migration system
CN102937955A (en) * 2011-11-29 2013-02-20 Ut斯达康通讯有限公司 Main memory database achieving method based on My structured query language (SQL) double storage engines
CN103136231A (en) * 2011-11-25 2013-06-05 中国移动通信集团江苏有限公司 Data synchronization method and system for heterogeneous databases
CN103164384A (en) * 2011-12-15 2013-06-19 中国银联股份有限公司 Synchronous achieving method and system of multimachine system shared memory
CN103488690A (en) * 2013-09-02 2014-01-01 用友软件股份有限公司 Data integrating system and data integrating method
CN103870357A (en) * 2012-12-17 2014-06-18 中国移动通信集团河南有限公司 Method and system for carrying out data replication
CN104408054A (en) * 2014-10-29 2015-03-11 深圳市金证科技股份有限公司 Database management system
CN105701190A (en) * 2016-01-07 2016-06-22 深圳市金证科技股份有限公司 Data synchronizing method and device
CN106709043A (en) * 2016-12-30 2017-05-24 江苏瑞中数据股份有限公司 Data synchronous loading method based on database log
CN106874389A (en) * 2017-01-11 2017-06-20 腾讯科技(深圳)有限公司 The moving method and device of data
CN106919494A (en) * 2015-12-25 2017-07-04 阿里巴巴集团控股有限公司 The implementation method and device of Android application daily record
CN107679232A (en) * 2017-10-24 2018-02-09 安徽马钢自动化信息技术有限公司 A kind of synchronous method of SAP HANA source databases and other databases
CN107870826A (en) * 2017-11-07 2018-04-03 西安科技大学 A kind of safety management system based on database detection function
CN108073660A (en) * 2016-11-18 2018-05-25 腾讯科技(深圳)有限公司 It is a kind of to realize data cached synchronous method and system
CN110807065A (en) * 2019-10-30 2020-02-18 浙江大华技术股份有限公司 Memory table implementation method, memory and data node of distributed database
CN111930686A (en) * 2020-07-15 2020-11-13 杭州海康威视系统技术有限公司 Method and device for storing log and computer equipment
TWI735518B (en) * 2017-01-24 2021-08-11 香港商阿里巴巴集團服務有限公司 Service provision method and system of database
CN113626423A (en) * 2021-06-29 2021-11-09 欧电云信息科技(江苏)有限公司 Log management method, device and system of service database
CN113792340A (en) * 2021-09-09 2021-12-14 烽火通信科技股份有限公司 Method and device for auditing logical logs of database

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6405205B1 (en) * 1999-03-03 2002-06-11 Nec Corporation Message display method and system for reproduction of DML objects in relational databases
CN101187888A (en) * 2007-12-11 2008-05-28 浪潮电子信息产业股份有限公司 Method for coping database data in heterogeneous environment
CN101369283A (en) * 2008-09-25 2009-02-18 中兴通讯股份有限公司 Data synchronization method and system for internal memory database physical data base

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6405205B1 (en) * 1999-03-03 2002-06-11 Nec Corporation Message display method and system for reproduction of DML objects in relational databases
CN101187888A (en) * 2007-12-11 2008-05-28 浪潮电子信息产业股份有限公司 Method for coping database data in heterogeneous environment
CN101369283A (en) * 2008-09-25 2009-02-18 中兴通讯股份有限公司 Data synchronization method and system for internal memory database physical data base

Cited By (27)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102289469A (en) * 2011-07-26 2011-12-21 国电南瑞科技股份有限公司 Method for supporting universal database to synchronize data based on physical isolating equipment
CN103136231B (en) * 2011-11-25 2016-03-02 中国移动通信集团江苏有限公司 Method of data synchronization between a kind of heterogeneous database and system
CN103136231A (en) * 2011-11-25 2013-06-05 中国移动通信集团江苏有限公司 Data synchronization method and system for heterogeneous databases
CN102937955A (en) * 2011-11-29 2013-02-20 Ut斯达康通讯有限公司 Main memory database achieving method based on My structured query language (SQL) double storage engines
CN102393860A (en) * 2011-12-06 2012-03-28 方正国际软件有限公司 Database data migration system
CN103164384A (en) * 2011-12-15 2013-06-19 中国银联股份有限公司 Synchronous achieving method and system of multimachine system shared memory
CN103870357A (en) * 2012-12-17 2014-06-18 中国移动通信集团河南有限公司 Method and system for carrying out data replication
CN103488690B (en) * 2013-09-02 2017-06-30 用友网络科技股份有限公司 Data integrated system and data integrating method
CN103488690A (en) * 2013-09-02 2014-01-01 用友软件股份有限公司 Data integrating system and data integrating method
CN104408054B (en) * 2014-10-29 2017-10-31 深圳市金证科技股份有限公司 A kind of data base management system
CN104408054A (en) * 2014-10-29 2015-03-11 深圳市金证科技股份有限公司 Database management system
CN106919494A (en) * 2015-12-25 2017-07-04 阿里巴巴集团控股有限公司 The implementation method and device of Android application daily record
CN105701190A (en) * 2016-01-07 2016-06-22 深圳市金证科技股份有限公司 Data synchronizing method and device
CN108073660A (en) * 2016-11-18 2018-05-25 腾讯科技(深圳)有限公司 It is a kind of to realize data cached synchronous method and system
CN108073660B (en) * 2016-11-18 2021-10-15 腾讯科技(深圳)有限公司 Method and system for realizing cache data synchronization
CN106709043A (en) * 2016-12-30 2017-05-24 江苏瑞中数据股份有限公司 Data synchronous loading method based on database log
CN106874389A (en) * 2017-01-11 2017-06-20 腾讯科技(深圳)有限公司 The moving method and device of data
TWI735518B (en) * 2017-01-24 2021-08-11 香港商阿里巴巴集團服務有限公司 Service provision method and system of database
CN107679232A (en) * 2017-10-24 2018-02-09 安徽马钢自动化信息技术有限公司 A kind of synchronous method of SAP HANA source databases and other databases
CN107870826A (en) * 2017-11-07 2018-04-03 西安科技大学 A kind of safety management system based on database detection function
CN110807065A (en) * 2019-10-30 2020-02-18 浙江大华技术股份有限公司 Memory table implementation method, memory and data node of distributed database
CN111930686A (en) * 2020-07-15 2020-11-13 杭州海康威视系统技术有限公司 Method and device for storing log and computer equipment
CN111930686B (en) * 2020-07-15 2024-02-20 杭州海康威视系统技术有限公司 Method and device for storing logs and computer equipment
CN113626423A (en) * 2021-06-29 2021-11-09 欧电云信息科技(江苏)有限公司 Log management method, device and system of service database
CN113626423B (en) * 2021-06-29 2024-01-30 欧电云信息科技(江苏)有限公司 Log management method, device and system of business database
CN113792340A (en) * 2021-09-09 2021-12-14 烽火通信科技股份有限公司 Method and device for auditing logical logs of database
CN113792340B (en) * 2021-09-09 2023-09-05 烽火通信科技股份有限公司 Method and device for auditing logical logs of database

Also Published As

Publication number Publication date
CN101944114B (en) 2012-07-25

Similar Documents

Publication Publication Date Title
CN101944114B (en) Data synchronization method between memory database and physical database
Marcu et al. Spark versus flink: Understanding performance in big data analytics frameworks
CN101436207B (en) Data restoring and synchronizing method based on log snapshot
CN102521406B (en) Distributed query method and system for complex task of querying massive structured data
US9619512B2 (en) Memory searching system and method, real-time searching system and method, and computer storage medium
CN104933160B (en) A kind of ETL frame design method towards safety monitoring business diagnosis
CN110674154B (en) Spark-based method for inserting, updating and deleting data in Hive
CN103853727A (en) Method and system for improving large data volume query performance
CN105550293A (en) Background refreshing method based on Spark-SQL big data processing platform
CN102779138B (en) The hard disk access method of real time data
CN107220310A (en) A kind of database data management system, method and device
CN103294731A (en) Real-time index creating and real-time searching method and device
CN101986649B (en) Shared data center used in telecommunication industry billing system
CN104317957B (en) A kind of open platform of report form processing, system and report processing method
CN104050276A (en) Cache processing method and system of distributed database
CN101794247A (en) Real-time database failure recovery method under nested transaction model
CN105183698A (en) Control processing system and method based on multi-kernel DSP
CN102214236A (en) Method and system for processing mass data
CN109542907A (en) Database caches construction method, device, computer equipment and storage medium
CN102043859A (en) Data updating method and device
CN112000649B (en) Method and device for synchronizing incremental data based on map reduce
CN104765651A (en) Data processing method and device
CN106294205A (en) caching data processing method and device
CN115687468A (en) System for processing data in distributed service by ETL process button
CN108536833A (en) A kind of distributed, database and its construction method towards big 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
C14 Grant of patent or utility model
GR01 Patent grant