WO2011134231A1 - 一种数据库间数据同步的方法、系统及设备 - Google Patents

一种数据库间数据同步的方法、系统及设备 Download PDF

Info

Publication number
WO2011134231A1
WO2011134231A1 PCT/CN2010/077267 CN2010077267W WO2011134231A1 WO 2011134231 A1 WO2011134231 A1 WO 2011134231A1 CN 2010077267 W CN2010077267 W CN 2010077267W WO 2011134231 A1 WO2011134231 A1 WO 2011134231A1
Authority
WO
WIPO (PCT)
Prior art keywords
lcr
database
data
format
generated
Prior art date
Application number
PCT/CN2010/077267
Other languages
English (en)
French (fr)
Inventor
丁奇鹏
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Priority to MX2012010377A priority Critical patent/MX2012010377A/es
Priority to BR112012022608-8A priority patent/BR112012022608B1/pt
Priority to EP10850562.9A priority patent/EP2533160A4/en
Publication of WO2011134231A1 publication Critical patent/WO2011134231A1/zh

Links

Classifications

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

Definitions

  • the present invention relates to the field of computers, and in particular, to a method, system and device for data synchronization between databases. Background technique
  • the database With its data storage, backup and other data functions, the database becomes one of the indispensable infrastructures in information systems. Any large information system needs to rely on the database.
  • the current mainstream data synchronization technologies include Oracle's Streams, Sybase's Replication Server, etc.
  • the basic principle is to capture the logical change record (LCR, Logical Change Record) in the database log (redolog) file in the source database, and then to the destination database.
  • the captured LCR is applied in the order in which the LCR occurs, so that the data synchronization between the destination database and the source database is achieved.
  • the content of the synchronization message not only used by the source database and the destination database is similar, and the format of each of the synchronization messages must be universal, in order to synchronize the data.
  • the format of the synchronization messages supported by the source database and the destination database are not necessarily the same, even the versions and architectures of the source database and the destination database are different, resulting in inflexible architecture of data synchronization, source database and purpose. Data synchronization may not be implemented correctly between databases.
  • the embodiment of the invention provides a method, a system and a device for synchronizing data between databases, which are used to solve the problem that the format of the synchronization message supported by the source database and the destination database is not common in the prior art, resulting in a relationship between the source database and the destination database.
  • the problem of data synchronization failure is not present in the prior art, resulting in a relationship between the source database and the destination database.
  • a method for data synchronization between databases comprising the following steps:
  • the LCR format supported by the destination database is detected, and the LCR generated in the obtained source database is converted into a format supported by the destination database, and then sent to the destination database.
  • a system for data synchronization between databases comprising:
  • Source database used to record the logical change LCR generated after the data operation
  • the data synchronization device is configured to obtain the LCR generated in the source database, and detect the LCR format supported by the destination database, and convert the generated LCR generated in the source database into a format supported by the destination database, and then send the format to the destination database;
  • a destination database for receiving LCRs from data synchronization devices is provided.
  • An inter-database data synchronization device comprising:
  • a collection module configured to obtain a logical change record LCR generated after performing data operations in the source database
  • the application module is configured to detect the LCR format supported by the destination database, and convert the generated LCR generated in the source database into a format supported by the destination database, and then send the format to the destination database.
  • the embodiment of the present invention does not directly synchronize the LCR generated in the source database to the destination database, but after obtaining the LCR generated in the source database, negotiates with the destination database the LCR format that the destination database can support, and the obtained source database
  • the generated LCR is converted to the format supported by the destination database and then sent to the destination database, so that the source database and the destination data can enable the destination database to correctly identify the LCR generated in the source database regardless of the message format supported.
  • the identified LCR is separately applied in the destination database to achieve data synchronization between the source database and the destination database.
  • FIG. 1 is a schematic diagram of a method for data synchronization between databases according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of a method for data synchronization between databases according to Embodiment 3 of the present invention
  • FIG. 3 is a schematic structural diagram of a system for data synchronization between databases according to Embodiment 5 of the present invention
  • FIG. 4 is a schematic structural diagram of a data synchronization device between databases according to Embodiment 6 of the present invention. detailed description
  • the LCR involved in various embodiments of the present invention embodies a specific data operation on a specific record in the source database, where the content includes: the transaction ID (optional), the operation type (insert, update, delete), the change field list , the value before the field change, the value after the field change, the primary key field name, the primary key field value, etc., the destination database can reproduce this data operation according to the information in the LCR.
  • Embodiment 1 is a diagrammatic representation of Embodiment 1:
  • FIG. 1 it is a schematic diagram of a method for data synchronization between databases in the first embodiment of the present invention.
  • the embodiment mainly includes the following steps:
  • Step 101 Obtain an LCR generated after performing data operations in the source database.
  • the execution entity of this step is an inter-database data synchronization device (referred to as a data synchronization device).
  • a data synchronization device The manners of obtaining the LCR generated in the source database are various, including but not limited to the following two methods:
  • the source database generates a redolog file after the data is manipulated.
  • the source database actively parses the LCR from the redolog file.
  • the LCR format parsed by the source database is supported by the source database. Format.
  • the source database may actively push the parsed LCR to the data synchronization device, or the data synchronization device may request the LCR from the source database.
  • the data synchronization device Grab the LCR in the source database.
  • the LCR is not parsed, but the redolog file is pushed to the synchronization device, or the data synchronization device requests the source database to obtain the redolog file.
  • the data synchronization device obtains the redolog file, it resolves the LCR by using the application programming interface (API, Application Programming Interface) or the open redolog file format provided by the source database to parse the redolog file.
  • API Application Programming Interface
  • Step 102 Detect the LCR format supported by the destination database.
  • the execution entity data synchronization device may perform handshake negotiation with the destination database to determine at least one LCR format that the destination database can support, such as a Structured Query Language (SQL) format.
  • SQL Structured Query Language
  • Step 103 Convert the LCR generated in the source database to a format supported by the destination database and send it to the destination database.
  • the execution entity data synchronization device is connected through ODBC (Open Data Base Connectivity), Java Database Connectivity (JDBC, Java Data Base Connectivity), or Oracle Caller Interface ( OCI, Oracle Caller Interface) / A special interface library such as the old version of the Sybase client library (DB-LIB, Database Library) / new version of the Sybase client library (CT-LIB, Client Library), which is connected to various types of destination databases, and is in the source database.
  • DB-LIB the old version of the Sybase client library
  • C-LIB new version of the Sybase client library
  • the destination database supports any efficient warehousing mode such as array binding, it can be implemented in this step.
  • the execution body data synchronization device of the first embodiment can perform optimization processing on the LCR from the source database. Therefore, before performing optimization processing on the LCR, the data synchronization device can further perform the following steps between step 101 and step 102:
  • Step 101a Convert the LCR format generated in the source database to a standard format.
  • the standard format can be an optional format for any type of LCR.
  • step 103 Since the LCR format of the source database is converted to the standard format before step 102, in step 103, the LCR converted to the standard format needs to be converted again into the format supported by the destination database and then transmitted.
  • Embodiment 2 is a diagrammatic representation of Embodiment 1:
  • the second embodiment of the present invention illustrates the solution of the first embodiment through a typical application scenario. Assume that both the source and destination databases maintain a demo tag (DEMO-TAB), defined as follows:
  • FLD-A, FLD-B and FLD-C represent three data types.
  • Step 1 Perform a set of operations on the data in FLD-A, FLD-B, and FLD-C in the source database:
  • Step 3 Convert the acquired three LCRs into a standard format and perform a grid with the destination database.
  • Step 4 Convert the standard format LCR to the format supported by the destination database, and convert the fifth step: The destination database applies the LCR received in turn to the DEMO-TAB maintained by itself.
  • the data synchronization method between databases provided by the first embodiment and the second embodiment of the present invention enables the LCR generated in the source database to be converted into a format supported by the destination database regardless of the LCR format supported by the source database and the destination database. To the destination database, therefore, the destination database can apply the received LCR to its own data to complete the synchronization of the data in the source database and the destination database.
  • Embodiment 3 is a diagrammatic representation of Embodiment 3
  • the solution in the third embodiment is an optimization scheme for the first embodiment, and the LCR from the source database is optimized and then sent to the destination database.
  • FIG. 2 it is a schematic flowchart of a method according to Embodiment 3 of the present invention, which includes the following steps:
  • Step 201 Obtain an LCR generated after the data operation in the source database.
  • Step 202 Convert the LCR format generated in the obtained source database into a standard format.
  • Step 203 For the LCR generated by the same transaction operation, allocate a data buffer represented by the transaction ID of the transaction.
  • a transaction refers to a set of multiple operations. When multiple operations combined into one transaction are successfully executed, it indicates that the transaction is successfully executed; at least one of the multiple operations merged into one transaction is unsuccessful. When executed, it indicates that the transaction failed.
  • the LCR generated for the same transaction operation includes the LCR of the transaction control type and the LCR of the Data Manipulation Language (DML) type.
  • the transaction control type of LCR includes: Continue to run (commit) type of LCR and rollback (rollback) type One of the LCRs, and the LCR of the type of begin tran; the LCR of the DML type includes: at least one of an insert type LCR, an update type LCR, and a delete type LCR.
  • the transaction control type of LCR includes: Continue to run (commit) type of LCR and rollback (rollback) type One of the LCRs, and the LCR of the type of begin tran;
  • the LCR of the DML type includes: at least one of an insert type LCR, an update type LCR, and a delete type LCR.
  • step 203 The specific execution process of step 203 is as follows:
  • step 208 it is determined whether the source database has the ability to support transactions. If the source database does not have the ability to support transactions, then directly jump to step 208; otherwise, further determine whether the transaction operation performed by the source database is filtered, and whether the provided LCR is Is the LCR that executed the successful transaction; if so, jumps directly to step 208; otherwise, allocates the data buffer represented by the transaction ID of the transaction.
  • the source database can be considered to have no ability to support transactions; if other source conditions are confirmed by other configuration conditions, the LCR from the source database is not
  • the LCR containing the transaction control type can be considered as the source database to filter the transaction operation, and whether the provided LCR is the LCR of the transaction that executed successfully.
  • step 203 when the LCR of the begin tran type is identified from the LCR from the source database, the beginning of a new transaction is considered, a data buffer is allocated for the transaction, and the plurality of data buffers are correspondingly passed.
  • the transaction ID is distinguished.
  • Step 204 Determine the LCR of the DML type from the LCRs having the same transaction ID.
  • the LCR of the insert type, the LCR of the update type, and the delete type LCR are LCRs of the DML type.
  • Step 205 Store the determined LCRs in the data cache indicated by the same transaction ID in the generated chronological order.
  • the arranged LCRs are then stored in the data buffer so that the order of the LCRs received by the subsequent destination database is the same as the sequence in which the source database operates on the data to generate the LCR.
  • the data in the source database and the destination database is "ABC”.
  • the source database performs two operations on the data in succession, namely, deleting "A” and updating to "ABCD”. Therefore, after performing the above two operations,
  • the data in the source database is "ABCD"; if the two LCRs received by the destination database in the order of operation execution are deleted "A” and updated to "ABCD", then the destination database is applied to the two LCRs received by the application.
  • Data synchronization with the source database is implemented; if the destination database first applies the LCR updated to "ABCD” and then applies the LCR that deletes "A”, then after applying two LCRs, the destination database does not synchronize data with the source
  • step 206 it is determined that the LCR containing the commit type in the LCR having the same transaction ID is also the LCR including the rollback type. If the LCR of the commit type is included, step 208 is performed; if the LCR of the rollback type is included, step 207 is performed.
  • the LCR having the same transaction ID includes the LCR of the commit type, indicating that the corresponding transaction is successfully executed, the subsequent data synchronization operation is continued; if the LCR of the rollback type is included, the corresponding transaction needs to be returned. Rolling, there is no need to continue the data synchronization operation.
  • Step 207 Release all the LCRs having the same transaction ID, and end data synchronization for the released LCR.
  • step 207 After the execution of step 207 is completed, if there are other LCRs that are not released for data synchronization, the subsequent steps are continued; otherwise, it is possible to jump to step 201 or end the data synchronization operation.
  • step 203 to step 207 are optimization steps, and further, based on ensuring data synchronization between the source database and the destination database, further determining whether the transaction operation is successful, and generating LCR for the transaction that is not successfully executed. Will not be sent to the destination database, reducing the transmission of useless information, and reducing the useless data synchronization made by the destination database.
  • Step 208 For each LCR, determine whether there is an LCR having the same keyword as the obtained LCR in the LCR data buffer pool, and if yes, execute step 209; otherwise, perform steps
  • an LCR data buffer pool is maintained for buffering a plurality of LCRs of each record, and LCRs corresponding to the same record entering the LCR data buffer pool have the same keyword.
  • Step 209 merge the LCR into the LCR data buffer pool, and then jump to the step
  • Step 210 Save the LCR into the LCR data buffer pool, and then go to step 211.
  • LCRs having the same keyword can be merged.
  • the source database and the destination database are population information census databases.
  • a record with the keyword "ID number: 0123456789" is saved: Name: Zhang San / ID number: 0123456789 / Age: 25 / Residence : Beijing.
  • the period of data operation in the source database is Is, and the period of data synchronization in the destination database is 3s; in the first, the "age" item in the above record is updated to 26, and the LCR-1 of the update type is generated, due to For the first LCR of the above record, LCR 1 is stored in the LCR data buffer pool; in the 2s deletion, the "residence" item in the above record is deleted, and the LCR-2 of the delete type is generated, and the LCR-2 is generated. LCR-1 and LCR-2 are merged before being stored in the LCR data buffer pool. Since LCR-1 and LCR-2 cannot reduce the carried information, the merge of LCR-1 and LCR 2 can be regarded as not operating.
  • LCR-2 directly deposit LCR-2 into the LCR data buffer pool; in the 3s, update the "age” item in the above record to 25 again, generate LCR 3 of update type, and merge LCR l , LCR 2 and LCR 3 , LCR 1 and LCR 3 are merged into LCR-3, and the LCR-2 and LCR-3 obtained after the merge are performed. Further, since the implementation of LCR-1 and LCR-3 in the source database is equivalent to the "age" item in the source database is not modified, LCR-1, LCR 2 and LCR-3 can be merged to obtain only LCR. 2 follow-up operations.
  • the foregoing steps 208 to 210 are optimization steps, which can further reduce the number of transmitted LCRs and reduce the destination data on the basis of ensuring data synchronization between the source database and the destination database.
  • the data synchronization operation of the library is described in detail below.
  • Step 211 Detect the LCR format supported by the destination database.
  • Step 212 Convert the LCR obtained in step 211 into a format supported by the destination database, and send it to the destination database.
  • step 211 after step 206, or jump to the scheme of step 208 after step 202.
  • Embodiment 4 is a diagrammatic representation of Embodiment 4:
  • the fourth embodiment of the present invention illustrates the solution of the third embodiment through a typical application scenario. Assume that both the source and destination databases maintain a demo tag (DEMO-TAB), defined as follows:
  • FLD-A, FLD-B and FLD-C represent three data types.
  • Step 1 Perform a transaction in the source database.
  • Step 2 Collect the 4 LCRs of the begin tran type, insert type, update type, and commit type generated in the first step.
  • Step 3 Open a data buffer for the above 4 LCRs.
  • Step 4 Store the LCR of insert type and update type in the data cache in the order of generation Area.
  • Step 5 After receiving the LCR of the commit type, the transaction is considered to be over. Save the pool.
  • Step 7 The LCR stored in the LCR data buffer pool is merged with the existing LCR for the same record.
  • Step 8 Convert the merged LCR to the format supported by the destination database and send it to the destination database.
  • the number of LCRs to be transmitted and the number of data synchronization operations to be performed by the destination database are further reduced on the basis of successfully completing data synchronization between the source database and the destination database.
  • Embodiment 5 is a diagrammatic representation of Embodiment 5:
  • a fifth embodiment of the present invention provides a system for data synchronization between databases, the system comprising: a source database 11, a data synchronization device 12, and a destination database 13, wherein: the source database 11 is configured to perform data The logical change record LCR generated after the operation; the data synchronization device 12 is configured to obtain the LCR generated in the source database, and detect the LCR format supported by the destination database, and convert the LCR generated in the obtained source database into the format supported by the destination database. And sent to the destination database 13; the destination database 13 is for receiving the LCR from the data synchronization device.
  • the data synchronization device 12 is specifically configured to convert the LCR format generated in the obtained source database 11 into a standard format and then convert it into a format supported by the destination database 13.
  • the data synchronization device 12 is further configured to allocate, according to the LCR generated by the same transaction operation, a data buffer represented by the transaction ID of the transaction, and determine an LCR of the data operation DML type from the LCR having the same transaction ID, and determine the LCR.
  • the LCRs are stored in the data buffer indicated by the same transaction ID in the generated chronological order, and it is judged whether there is an LCR that continues to run the commit type or an LCR that has the rollback rollback type in the LCR having the same transaction ID.
  • the LCR stored in the data buffer is converted into a format supported by the destination database, and then sent; if there is an LCR of the rollback type, the data buffer is released, and data synchronization between the databases is ended.
  • the data synchronization device 12 is further configured to: for each LCR, determine whether there is an LCR having the same keyword as the obtained LCR in the LCR data buffer pool, and if not, deposit the obtained LCR into the LCR Data cache pool; otherwise, merge LCRs with the same keyword, and store the merged LCR into the LCR data cache pool; and convert the LCR stored in the LCR data cache pool to the destination database support The format is sent after.
  • the system in the fifth embodiment is the system under the same inventive concept as the first embodiment to the fourth embodiment, and the data synchronization device 12 can be the execution body of each step in the first embodiment and the third embodiment.
  • FIG. 4 it is a schematic structural diagram of an inter-database data synchronization device 12 according to Embodiment 6 of the present invention.
  • the device includes: a collection module 21 and an application module 22, where: a collection module 21 is configured to obtain data in a source database.
  • the logic change record LCR generated after the operation; the application module 22 is configured to detect the LCR format supported by the destination database, and convert the LCR generated in the obtained source database into a format supported by the destination database, and then send the format to the destination database.
  • the application module 22 is specifically configured to convert the LCR format generated in the obtained source database into a standard format and then convert it into a format supported by the destination database.
  • the device further includes a transaction cache module 23 for allocating a data buffer represented by a transaction ID of the transaction for an LCR generated by the same transaction operation, and determining an LCR of a data operation DML type from an LCR having the same transaction ID, The determined LCRs are stored in the data buffer indicated by the same transaction ID in the generated chronological order, and it is determined whether there is an LCR that continues to run the commit type or an LCR that has a rollback rollback type in the LCR having the same transaction ID. If there is an LCR of the commit type, the application module 22 is triggered by the LCR stored in the data buffer; if there is an LCR of the rollback type, the data buffer is released. And end the data synchronization between the databases.
  • a transaction cache module 23 for allocating a data buffer represented by a transaction ID of the transaction for an LCR generated by the same transaction operation, and determining an LCR of a data operation DML type from an LCR having the same transaction ID, The determined LCRs are stored in the data buffer indicated by
  • the device further includes a merging module 24, configured to determine, for each LCR, whether there is an LCR having the same keyword as the obtained LCR in the LCR data buffer pool, and if not, storing the obtained LCR into the The LCR data buffer pool; otherwise, the LCRs having the same keyword are merged, and the merged LCR is stored in the LCR data buffer pool; the application module 22 is specifically configured to convert the LCR stored in the LCR data buffer pool. Sended after the format supported by the destination database.
  • embodiments of the present application can be provided as a method, system, or computer program product.
  • the application can be in the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware.
  • the application can be in the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

一种数据库间数据同步的方法、 系统及设备 技术领域
本发明涉及计算机领域, 尤其涉及一种数据库间数据同步的方法、 系 统及设备。 背景技术
数据库以其数据存储、 备份等数据功能, 成为信息系统中必不可少的 基础设施之一, 任何一个大型的信息系统都需要依靠数据库而存在。
在实际应用中, 由于业务逻辑的复杂性和功能的模块化设计, 往往一 个信息系统中会部署多套数据库, 而这多套数据库之间需要协同合作共享 数据, 这就要求各数据库之间能够实现数据同步。 目前的主流数据同步技 术包括 Oracle的 Streams, Sybase的 Replication Server等, 其基本原理都是 抓取源数据库中数据库日志( redolog )文件中的逻辑变化记录( LCR, Logical Change Record ), 然后到目的数据库上按照 LCR发生的顺序分别应用抓取 的 LCR, 从而实现目的数据库与源数据库的数据同步。
在上述数据库之间的数据同步方式中, 源数据库与目的数据库不仅使 用的同步消息的内容是类似的, 且各自传递同步消息的格式也必须是通用 的, 才能进行数据的同步。 应用在实际的同步过程中, 由于源数据库和目 的数据库支持的同步消息的格式不一定相同, 甚至于源数据库和目的数据 库的版本和架构的不同, 导致数据同步的架构不灵活, 源数据库和目的数 据库之间可能无法正确实现数据同步。
综上所述, 在目前的数据库同步方式下, 存在源数据库和目的数据库 支持的同步消息的格式不通用, 导致源数据库和目的数据库之间数据同步 失败的问题。 发明内容
本发明实施例提供一种数据库间数据同步的方法、 系统及设备, 用以 解决现有技术中存在的由于源数据库和目的数据库支持的同步消息的格式 不通用, 导致源数据库和目的数据库之间数据同步失败的问题。
一种数据库间数据同步的方法, 所述方法包括以下步骤:
得到源数据库中进行数据操作后生成的逻辑变化记录 LCR;
检测目的数据库支持的 LCR格式,并将得到的源数据库中生成的 LCR 转换为目的数据库支持的格式后, 发送给目的数据库。
一种数据库间数据同步的系统, 所述系统包括:
源数据库, 用于在进行数据操作后生成的逻辑变化记录 LCR;
数据同步设备, 用于得到源数据库中生成的 LCR, 并检测目的数据库 支持的 LCR格式,并将得到的源数据库中生成的 LCR转换为目的数据库支 持的格式后, 发送给目的数据库;
目的数据库, 用于接收来自数据同步设备的 LCR。
一种数据库间数据同步设备, 所述设备包括:
收集模块, 用于得到源数据库中进行数据操作后生成的逻辑变化记录 LCR;
应用模块, 用于检测目的数据库支持的 LCR格式, 并将得到的源数据 库中生成的 LCR转换为目的数据库支持的格式后, 发送给目的数据库。
本发明实施例有益效果如下:
本发明实施例通过并不直接将源数据库中生成的 LCR同步至目的数据 库, 而是在得到源数据库中生成的 LCR后, 与目的数据库协商目的数据库 能够支持的 LCR格式,将得到的源数据库中生成的 LCR转换为目的数据库 支持的格式后再发送给目的数据库, 使得源数据库和目的数据不论支持何 种消息格式, 都能够使目的数据库正确地识别源数据库中生成的 LCR, 进 而在目的数据库中分别应用识别的 LCR, 以达到源数据库和目的数据库之 间的数据同步。 附图说明
图 1为本发明实施例一在数据库间数据同步的方法示意图;
图 2为本发明实施例三在数据库间数据同步的方法示意图;
图 3为本发明实施例五数据库间数据同步的系统结构示意图; 图 4为本发明实施例六数据库间数据同步设备的结构示意图。 具体实施方式
下面结合说明书附图, 对本发明实施例进行详细的描述。
本发明各实施例中涉及的 LCR体现了源数据库中一条特定记录上的一 次特定数据操作, 其中内容包含了: 所属事务 ID (可选),操作类型(插入、 更新、 删除), 变动字段列表, 字段变化前值, 字段变化后值, 主键字段名, 主键字段值等, 目的数据库依据 LCR中的信息, 就可以将这个数据操作复 现。
实施例一:
如图 1所示, 为本发明实施例一中在数据库间数据同步的方法示意图, 本实施例主要包括以下步骤:
步骤 101 : 得到源数据库中进行数据操作后生成的 LCR。
假设本步骤的执行主体是数据库间数据同步设备(简称数据同步设 备), 本步骤中的多种得到源数据库中生成的 LCR 的方式, 包括但不限于 以下两种方式:
第一种方式:
源数据库在对数据进行操作后产生 redolog 文件, 源数据库主动从 redolog文件解析出 LCR, 源数据库解析出的 LCR格式是源数据库支持的 格式。 在源数据库解析出 LCR后, 源数据库可以向数据同步设备主动推送 解析出的 LCR, 也可以由数据同步设备向源数据库请求获得 LCR, 在源数 据库接受数据同步设备的请求后, 数据同步设备从源数据库中抓取 LCR。
第二种方式:
源数据库在对数据进行操作后产生 redolog文件后不解析 LCR,而是将 redolog文件推送给据同步设备, 或是由数据同步设备向源数据库请求获得 redolog文件。数据同步设备获得 redolog文件后,利用源数据库提供的可以 解析 redolog 文件的应用程序编程接口 (API , Application Programming Interface )或者开放的 redolog文件格式, 解析出 LCR。
步骤 102: 检测目的数据库支持的 LCR格式。
在本步骤中, 执行主体数据同步设备可以与目的数据库进行握手协商, 确定目的数据库能够支持的至少一种 LCR格式,如结构化查询语言( SQL, Structured Query Language )格式。
步骤 103: 将源数据库中生成的 LCR转换为目的数据库支持的格式后 发送给目的数据库。
在本步骤中, 执行主体数据同步设备通过开放数据库互连(ODBC , Open Data Base Connectivity )、 Java数据库互连 ( JDBC , Java Data Base Connectivity )、 或 Oracle调用者接口 ( OCI, Oracle Caller Interface ) /Sybase 客户端库老版本 (DB-LIB , Database Library ) /Sybase 客户端库新版本 ( CT-LIB, Client Library )等专用接口库, 与多种类型的目的数据库进行连 接, 并在将源数据库中生成的 LCR格式转化为目的数据库能够识别的格式 后,将 LCR发送给目的数据库,使目的数据库能够根据接收到的 LCR确定 源数据库中的操作, 并将源数据库中对数据的操作应用在目的数据库中。
在本发明实施例的方案中, 如果目的数据库支持如数组绑定等任何高 效的入库方式, 都可以在本步骤实现。 在本实施例一的执行主体数据同步设备可以对来自源数据库的 LCR进 行优化处理, 因此, 在对 LCR进行优化处理之前, 数据同步设备可以进一 步在步骤 101与步骤 102之间执行以下步骤:
步骤 101a: 将源数据库中生成的 LCR格式转换为标准格式。
所述标准格式可以为任——种 LCR的可选格式。
由于在步骤 102之前,将源数据库的 LCR格式转换为标准格式, 因此, 在步骤 103中, 需要将已转换为标准格式的 LCR再次转换为目的数据库支 持的格式后发送。
实施例二:
本发明实施例二通过一个典型的应用场景来说明实施例一的方案。 假设源数据库和目的数据库都有维护一张演示标签( DEMO— TAB ),定 义如下:
CREATE TABLE DEMO_TAB( //创建一个演示标签
FLD A NUMBER PRIMARY KEY,
FLD— B CHAR(IOO),
FLD C VARCHAR(IOO))
上述 FLD— A、 FLD— B和 FLD— C三个字段代表了三种数据类型。
第一步: 在源数据库中对 FLD— A、 FLD— B和 FLD— C中的数据进行一 组操作:
INSERT INTO DEMO— TAB VALUES (1 , 'CHAR1 ' , ,VARCHAR1,); //Insert操作
UPDATE DEMO— TAB SET //Update操作
FLD— B=,CHAR2,, FLD— C=, VARCHAR2' WHERE A=l;
DELETE FROM DEMO— TAB WHERE FLD— A= 1; //Delete操作 第二步: 获取 INSERT, UPDATE和 DELETE三个 LCR。
第三步: 将获取的三个 LCR转换为标准格式, 并与目的数据库进行格 式协商。
第四步: 将标准格式的 LCR转换为目的数据库支持的格式, 并将转换 第五步: 目的数据库将依次接收到的 LCR 应用到自身维护的 DEMO— TAB。
通过本发明实施例一和实施例二提供的数据库间数据同步的方法, 使 得不论源数据库和目的数据库支持何种 LCR格式, 都可以将源数据库中生 成的 LCR转换为目的数据库能够支持的格式发送给目的数据库, 因此, 目 的数据库可以将接收到的 LCR应用到自身的数据中, 完成源数据库和目的 数据库中的数据同步。
实施例三:
在本实施例三的方案是对实施例一的优化方案, 对来自源数据库的 LCR进行优化后再发送给目的数据库。 如图 2所示, 为本发明实施例三的 方法流程示意图, 包括以下步骤:
步骤 201: 得到源数据库中进行数据操作后生成的 LCR。
步骤 202: 将得到的源数据库中生成的 LCR格式转换为标准格式。 步骤 203: 针对同一事务操作生成的 LCR, 分配以该事务的事务 ID表 示的数据緩存区。
在本实施例中, 事务是指多个操作的集合, 合并成一个事务的多个操 作全部成功执行时, 表示该事务执行成功; 当合并成一个事务的多个操作 中有至少一个操作未成功执行时, 表示该事物执行失败。
如果在步骤 201中得到的 LCR是源数据库中对至少一个事务操作后生 成的 LCR, 则针对同一事务操作生成的 LCR包括事务控制类型的 LCR和 数据操作 (DML, Data Manipulation Language )类型的 LCR。 事务控制类 型的 LCR包括: 继续运行(commit )类型的 LCR和回滚(rollback )类型 的 LCR中的一种, 以及开始执行(begin tran )类型的 LCR; DML类型的 LCR包括: 插入(insert )类型的 LCR、 更新(update )类型的 LCR和删除 ( delete )类型的 LCR中的至少一个。
步骤 203的具体执行过程如下:
首先, 判断源数据库是否具有支持事务的能力, 若源数据库不具有支 持事务的能力, 则直接跳转至步骤 208; 否则, 进一步判断源数据库进行的 事务操作是否进行了过滤, 提供的 LCR是否都是执行成功的事务的 LCR; 若是, 则直接跳转至步骤 208; 否则, 分配以该事务的事务 ID表示的数据 緩存区。
如果接收到的来自源数据库的 LCR不包含事务控制类型的 LCR,则可 以认为源数据库不具有支持事务的能力; 如果通过其他配置条件确认源数 据库具有支持事务的能力, 且来自源数据库的 LCR不包含事务控制类型的 LCR, 则可以认为源数据库对事务操作进行了过滤, 提供的 LCR是否都是 执行成功的事务的 LCR。
在步骤 203中, 当从来自源数据库的 LCR中识别出 begin tran类型的 LCR时, 认为一个新事务的开始, 为该事务分配一个数据緩冲区, 多个数 据緩冲区之间通过对应的事务 ID进行区分。
步骤 204: 从具有相同事务 ID的 LCR中确定 DML类型的 LCR。 针对同一事务操作生成的 LCR中, insert类型的 LCR、 update类型的 LCR和 delete类型 LCR是 DML类型的 LCR。
步骤 205: 将确定出的 LCR按照生成的时间先后顺序存储在相同事务 ID表示的数据緩存区中。 然后将排列好的 LCR存储到数据緩存区中, 使得后续目的数据库接收到的 LCR的顺序与源数据库对数据进行操作生成 LCR的顺序相同。 例如: 在源数据库和目的数据库中的数据是 " ABC" , 源数据库对数据 先后进行了两次操作, 分别是删除 "A" 和更新为 "ABCD" , 因此, 在执 行完上述两个操作后, 源数据库中的数据是 "ABCD" ; 如果目的数据库按 照操作执行先后顺序接收的两个 LCR分别是删除 "A"和更新为 "ABCD" , 则目的数据库在应用接收到的两个 LCR后,实现了与源数据库的数据同步; 如果目的数据库先应用更新为 "ABCD"的 LCR,再应用删除 "A"的 LCR, 则应用两个 LCR后, 目的数据库没有与源数据库实现数据同步。
步骤 206:判断具有相同事务 ID的 LCR中包含 commit类型的 LCR还 是包含 rollback类型的 LCR,若包含 commit类型的 LCR,则执行步骤 208; 若包含 rollback类型的 LCR, 则执行步骤 207。
在本实施例中, 如果具有相同事务 ID的 LCR中包含 commit类型的 LCR, 则表示对应的事务成功执行, 则继续后续的数据同步操作; 如果包 含 rollback类型的 LCR, 则表示对应的事务需要回滚, 不需要继续执行数 据同步操作。
步骤 207: 将所述具有相同事务 ID的 LCR全部释放, 结束针对已释放 的 LCR的数据同步。
在步骤 207执行完成之后, 如果还有其他未释放的需要进行数据同步 的 LCR时, 则继续执行后续步骤; 否则, 可以跳转至步骤 201 , 或是结束 数据同步操作。
在本实施例中, 步骤 203〜步骤 207是优化步骤, 可以在确保源数据库 和目的数据库之间数据同步的基础上, 进一步对事务操作是否成功进行判 断, 对于没有成功执行的事务生成的 LCR将不会发送到目的数据库, 减少 了无用信息的传输, 也减少了目的数据库所作的无用的数据同步。
步骤 208: 针对每一个 LCR, 判断 LCR数据緩存池中是否存在与得到 的 LCR具有相同关键字的 LCR, 若是, 则执行步骤 209; 否则, 执行步骤 在本实施例中维护一个 LCR数据緩存池, 用于緩存每一条记录的多个 LCR, 进入 LCR数据緩存池的对应同一条记录的 LCR具有相同的关键字。
步骤 209: 将 LCR进行归并后存入 LCR数据緩存池, 然后跳转至步骤
211。
步骤 210: 将 LCR存入所述 LCR数据緩存池, 然后跳转至步骤 211。 在本实施例中, 为了减少针对同一条记录的多次 DML操作, 可以将具 有相同关键字的 LCR进行归并。 例如: 源数据库和目的数据库是人口信息 普查数据库, 在初始时都保存了一条关键字为 "身份证号码: 0123456789" 的记录: 姓名: 张三 /身份证号码: 0123456789/年龄: 25/居住地: 北京。 在 源数据库中进行数据操作的周期是 Is, 在目的数据库中进行数据同步的周 期是 3s; 在第 Is将上述记录中的 "年龄" 一项更新为 26, 生成 update类 型的 LCR— 1 , 由于是针对上述记录的第一条 LCR, 则 LCR 1存入 LCR数 据緩存池; 在第 2s删除将上述记录中的 "居住地" 一项删除, 生成 delete 类型的 LCR— 2 ,在将 LCR— 2存入 LCR数据緩存池之前,将 LCR— 1和 LCR— 2 进行归并, 由于 LCR— 1和 LCR— 2无法缩减携带的信息, 因此, LCR— 1和 LCR 2的归并可以看作是不进行操作, 直接将 LCR— 2存入 LCR数据緩存 池; 在第 3s将上述记录中的 "年龄" 一项再次更新为 25 , 生成 update类型 的 LCR 3 , 并将 LCR l , LCR 2和 LCR 3进行归并, 将 LCR 1和 LCR 3 归并为 LCR— 3 , 并将归并后得到的 LCR— 2和 LCR— 3执行后续操作。 进一 步地,由于在源数据库中执行 LCR— 1和 LCR— 3后相当于源数据库中"年龄" 一项没有修改, 再将 LCR— 1、 LCR 2和 LCR— 3进行归并后也可以只得到 LCR 2进行后续操作。
上述步骤 208〜步骤 210是优化步骤, 可以在确保源数据库和目的数据 库之间数据同步的基础上, 进一步减少发送的 LCR的数量, 减少目的数据 库的数据同步操作。
步骤 211 : 检测目的数据库支持的 LCR格式。
步骤 212: 将步骤 211中得到的 LCR转换为目的数据库支持的格式后 发送给目的数据库。
在本实施例中也不限于在步骤 206后跳转至步骤 211 的方案, 或是在 步骤 202之后跳转至步骤 208的方案。
实施例四:
本发明实施例四通过一个典型的应用场景来说明实施例三的方案。 假设源数据库和目的数据库都有维护一张演示标签( DEMO— TAB ),定 义如下:
CREATE TABLE DEMO_TAB( //创建一个演示标签
FLD A NUMBER PRIMARY KEY,
FLD— B CHAR(IOO),
FLD C VARCHAR(IOO))
上述 FLD— A、 FLD— B和 FLD— C三个字段代表了三种数据类型。
第一步: 在源数据库中执行一个事务。
BEGIN TRAN //Begin tran操作
INSERT INTO DEMO— TAB VALUES (1 , 'CHAR1 ' , ,VARCHAR1,); //Insert操作
UPDATE DEMO— TAB SET //Update操作
FLD— B=,CHAR2,, FLD— C=, VARCHAR2' WHERE A=l;
COMMIT; //Commit操作
第二步: 收集在第一步中生成的 begin tran类型、 insert类型、 update 类型和 commit类型的 4个 LCR。
第三步: 为上述 4个 LCR开辟一个数据緩存区。
第四步: 将 insert类型和 update类型的 LCR按生成顺序存入数据緩存 区。
第五步: 在收到 commit类型的 LCR后, 认为事务结束。 存池。
第七步: 存入 LCR数据緩存池的 LCR与已有的针对同一记录的 LCR 归并。
第八步: 将归并后的 LCR转换为目的数据库支持的格式后发送给目的 数据库。
通过本发明实施例三和实施例四的方案, 在源数据库和目的数据库之 间成功完成数据同步的基础上, 进一步减少需要传输的 LCR的数量以及目 的数据库需要执行的数据同步操作次数, 减少了系统资源的占用。
实施例五:
如图 3 所示, 本发明实施例五提供一种数据库间数据同步的系统, 所 述系统包括: 源数据库 11、 数据同步设备 12和目的数据库 13 , 其中: 源 数据库 11 , 用于在进行数据操作后生成的逻辑变化记录 LCR; 数据同步设 备 12, 用于得到源数据库中生成的 LCR, 并检测目的数据库支持的 LCR 格式, 将得到的源数据库中生成的 LCR转换为目的数据库支持的格式后, 发送给目的数据库 13 ; 目的数据库 13 ,用于接收来自数据同步设备的 LCR。
数据同步设备 12具体用于, 将得到的源数据库 11中生成的 LCR格式 转换为标准格式后再次转换为目的数据库 13支持的格式。
所述数据同步设备 12还用于, 针对同一事务操作生成的 LCR, 分配以 该事务的事务 ID表示的数据緩存区, 从具有相同事务 ID的 LCR中确定数 据操作 DML类型的 LCR, 将确定出的 LCR按照生成的时间先后顺序存储 在相同事务 ID表示的数据緩存区中, 以及判断具有相同事务 ID的 LCR中 是否存在继续运行 commit类型的 LCR或是存在回滚 rollback类型的 LCR, 若存在 commit类型的 LCR, 则将存入数据緩存区中的 LCR转换为目的数 据库支持的格式后发送; 若存在 rollback类型的 LCR, 则将所述数据緩存 区释放, 并结束数据库间数据同步。
所述数据同步设备 12还用于, 针对每一个 LCR, 判断 LCR数据緩存 池中是否存在与得到的 LCR具有相同关键字的 LCR, 若不存在, 则将所述 得到的 LCR存入所述 LCR数据緩存池; 否则, 将具有相同关键字的 LCR 进行归并,, 并将归并后的 LCR存入所述 LCR数据緩存池; 以及, 将存入 所述 LCR数据緩存池的 LCR转换为目的数据库支持的格式后发送。
本实施例五中的系统是与实施例一至实施例四属于同一发明构思下的 系统, 数据同步设备 12可以是实施例一和实施例三中各步骤的执行主体。
实施例六:
如图 4所示, 为本发明实施例六中数据库间数据同步设备 12的结构示 意图, 所述设备包括: 收集模块 21和应用模块 22, 其中: 收集模块 21 , 用于得到源数据库中进行数据操作后生成的逻辑变化记录 LCR; 应用模块 22, 用于检测目的数据库支持的 LCR格式, 并将得到的源数据库中生成的 LCR转换为目的数据库支持的格式后, 发送给目的数据库。
应用模块 22具体用于, 将得到的源数据库中生成的 LCR格式转换为 标准格式后再次转换为目的数据库支持的格式。
所述设备还包括事务緩存模块 23 ,用于针对同一事务操作生成的 LCR, 分配以该事务的事务 ID表示的数据緩存区, 从具有相同事务 ID的 LCR中 确定数据操作 DML类型的 LCR, 将确定出的 LCR按照生成的时间先后顺 序存储在相同事务 ID表示的数据緩存区中, 以及判断具有相同事务 ID的 LCR中是否存在继续运行 commit类型的 LCR或是存在回滚 rollback类型 的 LCR, 若存在 commit类型的 LCR, 则利用存入数据緩存区中的 LCR触 发应用模块 22; 若存在 rollback类型的 LCR, 则将所述数据緩存区释放, 并结束数据库间数据同步。
所述设备还包括归并模块 24,用于针对每一个 LCR,判断 LCR数据緩 存池中是否存在与得到的 LCR具有相同关键字的 LCR, 若不存在, 则将所 述得到的 LCR存入所述 LCR数据緩存池;否则,将具有相同关键字的 LCR 进行归并, 并将归并后的 LCR存入所述 LCR数据緩存池; 应用模块 22具 体用于将存入所述 LCR数据緩存池的 LCR转换为目的数据库支持的格式后 发送。
本领域内的技术人员应明白, 本申请的实施例可提供为方法、 系统、 或计算机程序产品。 因此, 本申请可釆用完全硬件实施例、 完全软件实施 例、 或结合软件和硬件方面的实施例的形式。 而且, 本申请可釆用在一个 或多个其中包含有计算机可用程序代码的计算机可用存储介质 (包括但不 限于磁盘存储器、 CD-ROM、 光学存储器等)上实施的计算机程序产品的 形式。
本申请是参照根据本申请实施例的方法、 设备(系统)、 和计算机程序 产品的流程图和 /或方框图来描述的。 应理解可由计算机程序指令实现流 程图和 /或方框图中的每一流程和 /或方框、 以及流程图和 /或方框图中 的流程和 /或方框的结合。 可提供这些计算机程序指令到通用计算机、 专 用计算机、 嵌入式处理机或其他可编程数据处理设备的处理器以产生一个 机器, 使得通过计算机或其他可编程数据处理设备的处理器执行的指令产 生用于实现在流程图一个流程或多个流程和 /或方框图一个方框或多个方 框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理 设备以特定方式工作的计算机可读存储器中, 使得存储在该计算机可读存 储器中的指令产生包括指令装置的制造品, 该指令装置实现在流程图一个 流程或多个流程和 /或方框图一个方框或多个方框中指定的功能。 这些计算机程序指令也可装载到计算机或其他可编程数据处理设备 上, 使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机 实现的处理, 从而在计算机或其他可编程设备上执行的指令提供用于实现 在流程图一个流程或多个流程和 /或方框图一个方框或多个方框中指定的 功能的步骤。
尽管已描述了本申请的优选实施例, 但本领域内的技术人员一旦得知 了基本创造性概念, 则可对这些实施例做出另外的变更和修改。 所以, 所 附权利要求意欲解释为包括优选实施例以及落入本申请范围的所有变更和 修改。 本发明的精神和范围。 这样, 倘若本发明的这些修改和变型属于本发明权 利要求及其等同技术的范围之内, 则本发明也意图包含这些改动和变型在 内。

Claims

权利要求书
1、 一种数据库间数据同步的方法, 其特征在于, 所述方法包括以下步 骤:
得到源数据库中进行数据操作后生成的逻辑变化记录 ( LCR );
检测目的数据库支持的 LCR格式,并将得到的源数据库中生成的 LCR 转换为目的数据库支持的格式后, 发送给目的数据库。
2、 如权利要求 1所述的方法, 其特征在于, 在得到源数据库中生成的 LCR后, 检测目的数据库支持的 LCR格式之前, 所述方法还包括:
将得到的源数据库中生成的 LCR格式转换为标准格式;
将得到的源数据库中生成的 LCR转换为目的数据库支持的格式,包括: 将转换为标准格式的 LCR再次转换为目的数据库支持的格式。
3、 如权利要求 2所述的方法, 其特征在于, 得到的 LCR是源数据库 中对至少一个事务操作后生成的 LCR;
在将所述 LCR 的格式转换为设定格式之后, 检测目的数据库支持的 LCR格式之前, 所述方法还包括:
针对同一事务操作生成的 LCR,分配以该事务的事务 ID表示的数据緩 存区;
从具有相同事务 ID的 LCR中确定数据操作 ( DML )类型的 LCR; 将确定出的 LCR按照生成的时间先后顺序存储在相同事务 ID表示的 数据緩存区中;
判断具有相同事务 ID的 LCR中是否存在继续运行(commit )类型的 LCR或是存在回滚( rollback )类型的 LCR, 若存在 commit类型的 LCR, 则利用数据緩存区中存储的 LCR执行检测目的数据库支持的 LCR格式的步 骤; 若存在 rollback类型的 LCR, 则将所述数据緩存区释放, 并结束数据 库间数据同步。
4、 如权利要求 3所述的方法, 其特征在于, 所述数据操作类型包括插 入(insert ), 更新 (update )和删除(delete ) 中的至少一个。
5、 如权利要求 1、 2或 3所述的方法, 其特征在于, 在得到源数据库 生成的 LCR之后,检测目的数据库支持的 LCR格式之前,所述方法还包括: 针对得到的每一个 LCR, 判断 LCR数据緩存池中是否存在与得到的 LCR具有相同关键字的 LCR;
若不存在, 则将所述得到的 LCR存入所述 LCR数据緩存池; 否则, 将 具有相同关键字的 LCR进行归并, 并将归并后的 LCR存入所述 LCR数据 緩存池;
将得到的源数据库中生成的 LCR转换为目的数据库支持的格式,包括: 将存入所述 LCR数据緩存池的 LCR转换为目的数据库支持的格式。
6、 一种数据库间数据同步的系统, 其特征在于, 所述系统包括: 源数据库, 用于在进行数据操作后生成的逻辑变化记录(LCR );
数据同步设备, 用于得到源数据库中生成的 LCR, 并检测目的数据库 支持的 LCR格式,将得到的源数据库中生成的 LCR转换为目的数据库支持 的格式后, 发送给目的数据库;
目的数据库, 用于接收来自数据同步设备的 LCR。
7、 如权利要求 6所述的系统, 其特征在于,
所述数据同步设备, 具体用于将得到的源数据库中生成的 LCR格式转 换为标准格式后再次转换为目的数据库支持的格式。
8、 如权利要求 7所述的系统, 其特征在于,
所述数据同步设备, 还用于针对同一事务操作生成的 LCR, 分配以该 事务的事务 ID表示的数据緩存区, 从具有相同事务 ID的 LCR中确定数据 在相同事务 ID表示的数据緩存区中, 以及判断具有相同事务 ID的 LCR中 是否存在继续运行( commit )类型的 LCR或是存在回滚( rollback )类型的 LCR, 若存在 commit类型的 LCR, 则将存入数据緩存区中的 LCR转换为 目的数据库支持的格式后发送; 若存在 rollback类型的 LCR, 则将所述数 据緩存区释放, 并结束数据库间数据同步。
9、 如权利要求 6、 7或 8所述的系统, 其特征在于,
所述数据同步设备, 还用于针对每一个 LCR, 判断 LCR数据緩存池中 是否存在与得到的 LCR具有相同关键字的 LCR, 若不存在, 则将所述得到 的 LCR存入所述 LCR数据緩存池; 否则, 将具有相同关键字的 LCR进行 归并,, 并将归并后的 LCR存入所述 LCR数据緩存池; 以及, 将存入所述 LCR数据緩存池的 LCR转换为目的数据库支持的格式后发送。
10、 一种数据库间数据同步设备, 其特征在于, 所述设备包括: 收集模块, 用于得到源数据库中进行数据操作后生成的逻辑变化记录 ( LCR );
应用模块, 用于检测目的数据库支持的 LCR格式, 并将得到的源数据 库中生成的 LCR转换为目的数据库支持的格式后, 发送给目的数据库。
11、 如权利要求 10所述的设备, 其特征在于,
应用模块, 具体用于将得到的源数据库中生成的 LCR格式转换为标准 格式后再次转换为目的数据库支持的格式。
12、 如权利要求 11所述的设备, 其特征在于, 所述设备还包括: 事务緩存模块, 用于针对同一事务操作生成的 LCR, 分配以该事务的 事务 ID表示的数据緩存区, 从具有相同事务 ID的 LCR中确定数据操作 DML类型的 LCR, 将确定出的 LCR按照生成的时间先后顺序存储在相同 事务 ID表示的数据緩存区中, 以及判断具有相同事务 ID的 LCR中是否存 在继续运行 ( commit )类型的 LCR或是存在回滚(rollback )类型的 LCR, 若存在 commit类型的 LCR, 则利用存入数据緩存区中的 LCR触发应用模 块; 若存在 rollback类型的 LCR, 则将所述数据緩存区释放, 并结束数据 库间数据同步。
13、 如权利要求 10、 11或 12所述的设备, 其特征在于, 所述设备还 包括:
归并模块, 用于针对每一个 LCR, 判断 LCR数据緩存池中是否存在与 得到的 LCR具有相同关键字的 LCR, 若不存在, 则将所述得到的 LCR存 入所述 LCR数据緩存池; 否则, 将具有相同关键字的 LCR进行归并, 并将 归并后的 LCR存入所述 LCR数据緩存池;
应用模块,具体用于将存入所述 LCR数据緩存池的 LCR转换为目的数 据库支持的格式后发送。
PCT/CN2010/077267 2010-04-26 2010-09-25 一种数据库间数据同步的方法、系统及设备 WO2011134231A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
MX2012010377A MX2012010377A (es) 2010-04-26 2010-09-25 Metodo, sistema y aparato para la sincronizacion de datos entre bases de datos.
BR112012022608-8A BR112012022608B1 (pt) 2010-04-26 2010-09-25 método para sincronização de dados entre bases de dados, sistema para sincronização de dados entre bases de dados e aparelho para sincronização de dados entre bases de dados
EP10850562.9A EP2533160A4 (en) 2010-04-26 2010-09-25 METHOD, SYSTEM AND DEVICE FOR DATA SYNCHRONIZATION BETWEEN DATA BANKS

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010159165.5A CN101807210B (zh) 2010-04-26 2010-04-26 一种数据库间数据同步的方法、系统及设备
CN201010159165.5 2010-04-26

Publications (1)

Publication Number Publication Date
WO2011134231A1 true WO2011134231A1 (zh) 2011-11-03

Family

ID=42609002

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/077267 WO2011134231A1 (zh) 2010-04-26 2010-09-25 一种数据库间数据同步的方法、系统及设备

Country Status (5)

Country Link
EP (1) EP2533160A4 (zh)
CN (1) CN101807210B (zh)
BR (1) BR112012022608B1 (zh)
MX (1) MX2012010377A (zh)
WO (1) WO2011134231A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111046100A (zh) * 2019-11-25 2020-04-21 武汉达梦数据库有限公司 一种关系型数据库到非关系型数据库的同步方法和系统
CN111090648A (zh) * 2019-12-07 2020-05-01 杭州安恒信息技术股份有限公司 一种关系型数据库数据同步冲突解决方法
CN112559546A (zh) * 2020-12-23 2021-03-26 平安银行股份有限公司 数据库同步方法、装置、计算机设备及可读存储介质

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101807210B (zh) * 2010-04-26 2015-04-01 中兴通讯股份有限公司 一种数据库间数据同步的方法、系统及设备
CN103020071B (zh) * 2011-09-22 2017-11-28 中兴通讯股份有限公司 数据同步方法及装置
CN103262042B (zh) * 2011-12-19 2016-03-30 华为技术有限公司 一种分布式存储数据恢复方法、装置及系统
CN104572638B (zh) * 2013-10-09 2019-03-26 腾讯科技(深圳)有限公司 数据读写方法及装置
CN104657364B (zh) * 2013-11-18 2018-02-23 华为技术有限公司 一种日志结构数据库系统查询请求消息处理方法及装置
CN105447054A (zh) * 2014-09-25 2016-03-30 中兴通讯股份有限公司 一种数据库的数据同步方法、装置及系统
CN106339274B (zh) * 2015-07-14 2019-07-02 阿里巴巴集团控股有限公司 一种数据快照获取的方法及系统
CN105589924A (zh) * 2015-11-23 2016-05-18 江苏瑞中数据股份有限公司 一种数据库事务粒度同步方法
CN109376196B (zh) * 2018-09-25 2021-04-13 浪潮软件科技有限公司 一种redo日志批量同步方法及装置
CN110704532A (zh) * 2019-09-18 2020-01-17 南方电网数字电网研究院有限公司 数据库间的数据同步方法、装置、计算机设备及存储介质
CN115129738B (zh) * 2022-08-30 2022-12-13 太极计算机股份有限公司 一种数据跨库写入方法、装置和设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1407465A (zh) * 2001-08-13 2003-04-02 深圳市丛文软件技术有限公司 异构、异种数据库间适用的数据交换方法及装置
US20050228765A1 (en) * 2004-01-16 2005-10-13 Taiwan Semiconductor Manufacturing Co. Mechanism for synchronizing manafacturing information systems and document content management systems data
CN101184106A (zh) * 2007-11-30 2008-05-21 北京航空航天大学 一种移动数据库的关联事务处理方法
CN101807210A (zh) * 2010-04-26 2010-08-18 中兴通讯股份有限公司 一种数据库间数据同步的方法、系统及设备

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6226650B1 (en) * 1998-09-17 2001-05-01 Synchrologic, Inc. Database synchronization and organization system and method
US6438558B1 (en) * 1999-12-23 2002-08-20 Ncr Corporation Replicating updates in original temporal order in parallel processing database systems
US7904340B2 (en) * 2003-03-24 2011-03-08 Siebel Systems, Inc. Methods and computer-readable medium for defining a product model
US20050278458A1 (en) * 2004-06-09 2005-12-15 Microsoft Corporation Analysis services database synchronization
US7693888B2 (en) * 2005-05-10 2010-04-06 Siemens Communications, Inc. Data synchronizer with failover facility
CN101697169A (zh) * 2009-10-23 2010-04-21 中兴通讯股份有限公司 源数据库和目的数据库之间数据同步的方法、装置及系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1407465A (zh) * 2001-08-13 2003-04-02 深圳市丛文软件技术有限公司 异构、异种数据库间适用的数据交换方法及装置
US20050228765A1 (en) * 2004-01-16 2005-10-13 Taiwan Semiconductor Manufacturing Co. Mechanism for synchronizing manafacturing information systems and document content management systems data
CN101184106A (zh) * 2007-11-30 2008-05-21 北京航空航天大学 一种移动数据库的关联事务处理方法
CN101807210A (zh) * 2010-04-26 2010-08-18 中兴通讯股份有限公司 一种数据库间数据同步的方法、系统及设备

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111046100A (zh) * 2019-11-25 2020-04-21 武汉达梦数据库有限公司 一种关系型数据库到非关系型数据库的同步方法和系统
CN111046100B (zh) * 2019-11-25 2024-03-08 武汉达梦数据库股份有限公司 一种关系型数据库到非关系型数据库的同步方法和系统
CN111090648A (zh) * 2019-12-07 2020-05-01 杭州安恒信息技术股份有限公司 一种关系型数据库数据同步冲突解决方法
CN111090648B (zh) * 2019-12-07 2023-05-16 杭州安恒信息技术股份有限公司 一种关系型数据库数据同步冲突解决方法
CN112559546A (zh) * 2020-12-23 2021-03-26 平安银行股份有限公司 数据库同步方法、装置、计算机设备及可读存储介质
CN112559546B (zh) * 2020-12-23 2024-03-19 平安银行股份有限公司 数据库同步方法、装置、计算机设备及可读存储介质

Also Published As

Publication number Publication date
EP2533160A1 (en) 2012-12-12
BR112012022608A2 (pt) 2020-07-07
CN101807210A (zh) 2010-08-18
MX2012010377A (es) 2012-10-10
CN101807210B (zh) 2015-04-01
BR112012022608B1 (pt) 2020-12-29
EP2533160A4 (en) 2015-01-07

Similar Documents

Publication Publication Date Title
WO2011134231A1 (zh) 一种数据库间数据同步的方法、系统及设备
US10909083B2 (en) System and method for event-based synchronization of remote and local file systems
US11068501B2 (en) Single phase transaction commits for distributed database transactions
WO2016180160A1 (zh) 数据快照的恢复方法和装置
US20140372383A1 (en) Log Access Method Storage Control Apparatus, Archive System, and Method of Operation
WO2016155332A1 (zh) 一种服务器和数据处理方法
JP6196389B2 (ja) 分散型ディザスタリカバリファイル同期サーバシステム
JP6583975B1 (ja) データ処理装置、データ処理方法及びプログラム
CN102760154A (zh) 一种在文本信息检索服务中支持分布式事务管理的方法
CN112800060A (zh) 数据处理方法、装置、计算机可读存储介质及电子设备
US20230409448A1 (en) End-to-end restartability of cross-region replication using a common snapshot
WO2023244446A1 (en) Scalable and secure cross-region and optimized file system replication for cloud scale
WO2023244447A1 (en) Techniques for efficient replication and recovery
WO2023111765A1 (en) System and method for handling data consolidation from an edge device to a target database
TW201629797A (zh) 用來進行檔案同步控制之方法與裝置
WO2014180395A1 (zh) 海量数据融合存储方法及系统
KR101733118B1 (ko) 메타데이터 연산 충돌 회피 방법 및 이를 수행하는 메타 데이터 관리 시스템
WO2023244601A1 (en) End-to-end restartability of cross-region replication using a new replication
WO2023244449A1 (en) Hierarchical key management for cross-region replication

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 10850562

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: MX/A/2012/010377

Country of ref document: MX

Ref document number: 2010850562

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE

REG Reference to national code

Ref country code: BR

Ref legal event code: B01A

Ref document number: 112012022608

Country of ref document: BR

REG Reference to national code

Ref country code: BR

Ref legal event code: B01E

Ref document number: 112012022608

Country of ref document: BR

Free format text: 1) APRESENTE A TRADUCAO SIMPLES DA FOLHA DE ROSTO DA CERTIDAO DE DEPOSITO DA PRIORIDADE CN 201010159165.5; OU DECLARACAO DE QUE OS DADOS DO PEDIDO INTERNACIONAL ESTAO FIELMENTE CONTIDOS NA PRIORIDADE REIVINDICADA, CONTENDO TODOS OS DADOS IDENTIFICADORES DESTA (TITULARES,NUMERO DE REGISTRO, DATA E TITULO), CONFORME O PARAGRAFO UNICO DO ART. 25 DA RESOLUCAO T7/2013 E ART. 2O DA RESOLUCAO 179/2017. CABE SALIENTAR QUE NAO FOI POSSIVEL IDENTIFICAR O TITULAR DO PEDIDO PRIORITARIO NOS DOCUMENTOS JUNTADOS AO PROCESSO, TAMPOUCO NOS APRESENTADOS NA OMPI. TAL INFORMACAO E NECESSARIA PARA O EXAME DA CESSAO DO DOCUMENTO DE PRIORIDADE. 2) IDENTIFIQUE O SIGNATARIO DA PETICAO NO 018120033522 DE 06/09/2012 E

ENP Entry into the national phase

Ref document number: 112012022608

Country of ref document: BR

Kind code of ref document: A2

Effective date: 20120906