Summary of the invention
In order to solve the problems of the technologies described above, the present invention proposes a kind of method of data synchronization, Apparatus and system, in order to realize the automatic collection of synchrodata, reduce system complexity, improve the Data Collection accuracy rate, improve system's processing speed, system is safeguarded easily, realize that Modular Data is synchronous.
The invention provides a kind of method of data synchronization, comprising:
Before submitting processing transactions to, obtain the unique identification of current processing transactions;
According to the described unique identification that obtains, inquire about the revocation information of current processing transactions;
Resolve the described revocation information of inquiry, generate synchrodata information, and with described synchrodata information recording/in the synchronous data interface table;
Described synchronous data interface table is sent to need to be by synchronous equipment.
Preferably, described described unique identification according to obtaining is inquired about the revocation information of current processing transactions, comprising:
According to the unique identification of the current processing transactions of obtaining, in system view, search affairs flash back table;
In described affairs flash back table, obtain the revocation information of the tables of data of current modification affairs.
Preferably, the described revocation information of described parsing inquiry generates synchrodata information, and with described synchrodata information recording/in the synchronous data interface table, comprising:
Processing statement type in the described revocation information of identification inquiry, described processing statement type comprises: cancel statement, insert statement and upgrade statement;
According to different processing statement types, generate different synchrodata information, and be recorded in the synchronous data interface table.
Preferably, described according to different processing statement types, generate different synchrodata information, and be recorded in the synchronous data interface table, comprising:
When described processing statement type is cancel statement, from revocation information, obtain record identification, obtain insertion recorded information in the data information table according to record identification, described record identification is used for the information in data information table unique identification file, data block and this data block;
Described insertion recorded information is write in the synchronous data interface table, and mark inserts record identification in the synchronous data interface table.
Preferably, described according to different processing statement types, generate different synchrodata information, and be recorded in the synchronous data interface table, comprising:
When described processing statement type is the insertion statement, synchronous data table name is replaced to the sync cap table name, and carry out the statement after resolving, in the synchronous data interface table, generate synchrodata;
Mark deletion record sign in the synchronous data interface table.
Preferably, described according to different processing statement types, generate different synchrodata information, and be recorded in the synchronous data interface table, comprising:
When described processing statement is when upgrading statement, from revocation information, obtain record identification, obtain recorded information in the data information table according to record identification, described record identification is used for the delegation's information in data information table unique identification file, data block and this data block;
Described recorded information is write in the corresponding synchronous data interface table, and in the synchronous data interface table, stamp the amendment record sign.
Preferably, described described synchronous data interface table sent to and need to by synchronous equipment, comprise:
Described synchronous data interface table by sync cap, is formed sync data file;
In the file transfer protocol (FTP) mode, described sync data file is sent to need to be by synchronizer.
Preferably, described described synchronous data interface table sent to and need to by after the synchronous equipment, also comprise:
The sync data file that need to be received by synchronous device scan according to synchronous data interface table name and record identification synchrodata, is finished synchronously rear feedback synchronized result.
The present invention also provides a kind of data synchronization unit, comprising:
Acquisition module is used for obtaining the unique identification of current processing transactions before submitting processing transactions to;
Search module, be used for according to the described unique identification that obtains, inquire about the revocation information of current processing transactions;
Parsing module be used for to be resolved the described revocation information of inquiry, generates synchrodata information, and with described synchrodata information recording/in the synchronous data interface table;
Delivery module, being used for described synchronous data interface table is sent to need to be by synchronous equipment.
Preferably, the described module of searching comprises:
Search submodule, be used for the unique identification according to the current processing transactions of obtaining, in system view, search affairs flash back table;
Obtain submodule, be used for obtaining the revocation information that current affairs relate to the tables of data of modification at described affairs flash back table.
Preferably, described parsing module comprises:
The recognin module, for the processing statement type of the described revocation information of identifying inquiry, described processing statement type comprises: cancel statement, insert statement and renewal statement;
Record sub module is used for according to different processing statement types, generates different synchrodata information, and is recorded in the synchronous data interface table.
Preferably, described record sub module comprises:
The intron module, be used for when described processing statement type is cancel statement, from revocation information, obtain record identification, obtain insertion recorded information in the data information table according to record identification, described record identification is used for the information in data information table unique identification file, data block and this data block;
Newly-increased record sub module be used for described insertion recorded information is write service synchronization data-interface table, and mark is inserted record identification in the synchronous data interface table.
Preferably, described record sub module comprises:
The deletion submodule is used for synchronous data table name being replaced to service synchronization interface table name, and carrying out the statement after resolving when described processing statement type is the insertion statement, generates synchrodata in the synchronous data interface table;
The deletion record submodule is used for identifying in the deletion record of synchronous data interface table mark.
Preferably, described record sub module comprises:
Updating submodule, be used for when described processing statement is the renewal statement, obtain record identification from revocation information, obtain recorded information in the data information table according to record identification, described record identification is used for the delegation's information in data information table unique identification file, data block and this data block;
The amendment record submodule is used for described recorded information is write corresponding synchronous data interface table, and stamps the amendment record sign in the synchronous data interface table.
Preferably, described delivery module comprises:
Generate submodule, be used for described synchronous data interface table is passed through sync cap, form sync data file;
Transmit submodule, be used in the file transfer protocol (FTP) mode, described sync data file is sent to need to be by synchronous equipment.
The present invention also provides a kind of data synchronous system, comprising:
The described device of above-mentioned any one, synchronization module and by synchronization module,
Described synchronization module is used for carrying out transaction;
Described by synchronization module, be used for the sync data file that scanning receives, according to synchronous data interface table name and record identification synchrodata, finish data and feed back synchronized result synchronously.
A kind of method of data synchronization provided by the present invention, Apparatus and system, by the affairs follow-up mechanism, before submitting to, affairs obtain the unique ID of current affairs, adopt simultaneously the transaction-level Flashback Technology, according to affairs ID inquiry revocation information, process, need to obtain synchronous data, realize synchronously, avoided generating the synchrodata table by the mode of contrast, take a large amount of internal memories, affect synchronous processing speed, also can affect the problem of the performance of whole system simultaneously.
And, can collect fast and accurately needs synchronous data, improve the data no-load speed, reduce system stores pressure, reduce system performance loss, and the data synchronizing function can be separated with data service function, and when system maintenance or new demand support, automatically newly-increased data variation information can automatic synchronization, accurately keeps data consistency.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, below in conjunction with accompanying drawing the embodiment of the invention is described in detail.
Embodiment one
See also Fig. 1, it is the method flow diagram of a kind of method of data synchronization of the embodiment of the invention one announcement, may further comprise the steps:
Step 101: before submitting processing transactions to, obtain the unique identification of current processing transactions;
Step 102: according to the described unique identification that obtains, inquire about the revocation information of current processing transactions;
Step 103: resolve the described revocation information of inquiry, generate synchrodata information, and with described synchrodata information recording/in the synchronous data interface table;
Step 104: described synchronous data interface table is sent to need to be by synchronous equipment.
Preferably, described step 102 comprises:
According to the unique identification of the current processing transactions of obtaining, in system view, search affairs flash back table;
In described affairs flash back table, obtain the revocation information of the tables of data of current modification affairs.
Preferably, described step 103 comprises:
Step 103A: the processing statement type in the described revocation information of identification inquiry, described processing statement type comprises: cancel statement, insert statement and upgrade statement;
Step 103B: according to different processing statement types, generate different synchrodata information, and be recorded in the synchronous data interface table.
When described processing statement type was cancel statement, preferred, described step 103B was:
Obtain record identification from revocation information, obtain insertion recorded information in the data information table according to record identification, described record identification is used for the information in data information table unique identification file, data block and this data block;
Described insertion recorded information is write in the service synchronization data-interface table, and mark inserts record identification in the synchronous data interface table.When described processing statement type is that preferred, described step 103B is when inserting statement:
Synchronous data table name is replaced to service synchronization interface table name;
Mark deletion record sign in the synchronous data interface table.
When described processing statement is that preferred, described step 103B is when upgrading statement:
Obtain record identification, obtain recorded information in the MSDS according to record identification, described record identification is used for the delegation's information in database unique identification file, data block and this data block;
Described recorded information is write in the corresponding synchronous data interface table, and in the synchronous data interface table, stamp the amendment record sign.
Preferably, step 104 comprises:
Step 104A: described synchronous data interface table by sync cap, is formed sync data file;
Step 104B: in the file transfer protocol (FTP) mode, described sync data file is sent to need to be by synchronizer.
Preferably, described method also comprises: the sync data file that need to be received by synchronous device scan, according to synchronous data interface table name and record identification, by the insertion record identification in the said method, expression is done insert handling to the data that receive.The expression of deletion record sign is done deletion to data and is processed, and the expression of amendment record sign is made an amendment processing to data.By judging to identify the data that receive are processed synchronously, finished synchronously rear feedback synchronized result.
By above-described embodiment one, can find out the synchronous method of a kind of data provided by the invention, adopt Flashback Technology, the revocation information of all changes when obtaining transaction, thereby determine the variation of data in the concrete tables of data by revocation information, realize that data are synchronous, avoided storage mass data table to take ample resources, avoid correction data table information to bring error problem, also improved the performance of data synchronization processing speed and whole system simultaneously.
Embodiment two
In order to describe better more specifically the present invention, the below is with concrete affairs 1, and relating to 3 tables of data information synchronization scenes is that example is described, and concrete grammar sees also the synchronous method of another kind of data that Fig. 2 discloses, and specifically may further comprise the steps:
Step 201: before submitting processing transactions 1 to, obtain the unique ID 1 of current processing transactions;
Step 202: according to the described unique ID 1 of obtaining, inquire about the revocation information UNDO information of current processing transactions;
Step 203: resolve the described UNDO information of inquiry, generate synchrodata information, and with described synchrodata information recording/in the synchronous data interface table;
Step 204: described synchronous data interface table is sent to need to be by synchronous equipment.
Preferably, described step 202 comprises:
According to the unique identification of the current processing transactions of obtaining, in system view, search affairs flash back table;
In described affairs flash back table, obtain the revocation information of the tables of data of current modification affairs.
Preferably, described step 203 comprises:
Step 203A: the processing statement type in the described revocation information of identification inquiry, described processing statement type comprises: cancel statement, insert statement and upgrade statement;
Step 203B: according to different processing statement types, generate different synchrodata information, and be recorded in the synchronous data interface table.
When described processing statement type was cancel statement, preferred, described step 203B was:
Obtain record identification from revocation information, obtain insertion recorded information in the data information table according to record identification, described record identification is used for the information in data information table unique identification file, data block and this data block;
Described insertion recorded information is write in the service synchronization data-interface table, and mark inserts record identification in the synchronous data interface table.
When described processing statement type is that preferred, described step 203B is when inserting statement:
Synchronous data table name is replaced to service synchronization interface table name, and carry out the statement after resolving, in the synchronous data interface table, generate synchrodata;
Mark deletion record sign in the synchronous data interface table.
When described processing statement is that preferred, described step 203B is when upgrading statement:
Obtain record identification, obtain recorded information in the data information table according to record identification, described record identification is used for the delegation's information in data information table unique identification file, data block and this data block;
Described recorded information is write in the corresponding synchronous data interface table, and in the synchronous data interface table, stamp the amendment record sign.
Preferably, step 204 comprises:
Step 204A: described synchronous data interface table by sync cap, is formed sync data file;
Step 204B: in the file transfer protocol (FTP) mode, described sync data file is sent to need to be by synchronizer.
Preferably, described method also comprises: the sync data file that need to be received by synchronous device scan, according to synchronous data interface table name and record identification synchrodata, finish synchronously rear feedback synchronized result.
If when the affairs 1 of processing relate to three data MSDSs, data information table 1, data information table 2 and data information table 3.
Synchronization scenarios A for example: before submitting processing transactions 1 to, three data MSDSs that affairs 1 are related to all delete processing, the unique identification that obtains current processing transactions is ID1, then pass through Flashback Technology, in system view according to ID1, obtain the UNDO information of cancelling of transaction-level, affairs relate to three tables of data information complete documentation in affairs flash back table of modification.Because three data MSDSs are all deleted processing, three UNDO information that then generate, all be to insert statement, when resolving statement type for the insertion statement, then according to preferably, described step 203B is described to be processed, and is specially: the data information table name is replaced to the sync cap table name, and the statement after the execution parsing, in the synchronous data interface table, generate synchrodata; Mark deletion record sign in the synchronous data interface table.Then realize the transmission of synchrodata by step 204, be specially: described synchronous data interface table by sync cap, is formed sync data file; In the file transfer protocol (FTP) mode, described sync data file is sent to need to be by synchronous equipment.The described sync data file that need to be received by synchronous device scan then, according to synchronous data interface table name and record identification, carry out synchrodata, be specially identification delete flag sign, sign is to do deletion to process to the data in the data sync data file that receives, and finishes synchronously rear feedback synchronized result.
Synchronization scenarios B for example: before submitting processing transactions 1 to, three data MSDSs that affairs 1 are related to all carry out insert handling, the unique identification that obtains current processing transactions is ID1, according to ID1, inquire about the revocation information of current processing transactions, then by Flashback Technology, in system view according to ID1, obtain the UNDO information of cancelling of transaction-level, affairs relate to three tables of data information complete documentation in affairs flash back table of modification.Because be that three data MSDSs have all been carried out insert handling, three UNDO information that then generate all are cancel statements;
When resolving statement type when being cancel statement, then according to preferably, described step 203B is described to be processed, and is specially:
Obtain record identification ROWID from revocation information, obtain the insertion recorded information according to record identification ROWID indicating positions in the data information table, described record identification is used for the information in data information table unique identification file, data block and this data block; Described insertion recorded information is write in the synchronous data interface table, and mark inserts record identification in the synchronous data interface table.
Then realize the transmission of synchrodata by step 204, be specially: described synchronous data interface table by sync cap, is formed sync data file; In the file transfer protocol (FTP) mode, described sync data file is sent to need to be by synchronous equipment.The described sync data file that need to be received by synchronous device scan then, according to synchronous data interface table name and record identification, carry out synchrodata, be specially: the mark sign is inserted in identification, sign is to do insert handling to the data in the data sync data file that receives, and finishes synchronously rear feedback synchronized result.
Synchronization scenarios C for example: before submitting processing transactions 1 to, the processing of all making amendment of three data MSDSs that affairs 1 are related to, the unique identification that obtains current processing transactions is ID1, then pass through Flashback Technology, in system view according to ID1, obtain the UNDO information of cancelling of transaction-level, affairs relate to three tables of data information complete documentation in affairs flash back table of modification.Because be three data MSDSs all to have been carried out revising process, three UNDO information that then generate all are to upgrade statement;
When resolving statement type when upgrading statement, then according to preferably, described step 203B is described to be processed, and is specially:
Obtain record identification ROWID, described position according to record identification ROWID indication obtains recorded information in the data information table, and described record identification is used for the delegation's information in data information table unique identification file, data block and this data block;
Described recorded information is write in the corresponding synchronous data interface table, and in the synchronous data interface table, stamp the amendment record sign.
Then realize the transmission of synchrodata by step 204, be specially: described synchronous data interface table by sync cap, is formed sync data file; In the file transfer protocol (FTP) mode, described sync data file is sent to need to be by synchronous equipment.The described sync data file that need to be received by synchronous device scan then, according to synchronous data interface table name and record identification, carry out synchrodata, be specially: the mark sign is revised in identification, sign is to make an amendment processing to the data in the data sync data file that receives, and finishes synchronously rear feedback synchronized result.
For example, above-mentioned before submitting processing transactions 1 to, three data MSDSs that affairs 1 are related to insert respectively, delete, revise processing, then can process synchronously according to the processing mode of above-mentioned three kinds of correspondences, certainly, any one or any two kinds or three kinds of data processing methods all can adopt said method to realize processing synchronously.
Same for different affairs, no matter be what affairs, no matter what data MSDSs are affairs relate to, no matter affairs have been carried out several data processing methods, the method that all can provide according to above-described embodiment realizes synchronously processing.
In the said method, carry out the stationary problem of insert handling or deletion processing or modification processing for the data of any affairs and all can realize the processing that data are synchronous, also can for above-mentioned any one or any two kinds or three kinds of data processing form, carry out simultaneously data synchronization processing.
By above-described embodiment two, can find out a kind of method of data synchronization provided by the invention, by the affairs follow-up mechanism, before submitting to, affairs obtain the ID of current affairs, adopt simultaneously the transaction-level Flashback Technology, according to affairs ID inquiry revocation information, process, need to obtain synchronous data, realize synchronously, avoided generating the synchrodata table by the mode of contrast, take a large amount of internal memories, affect synchronous processing speed, also can affect the problem of the performance of whole system simultaneously.
Embodiment three
The present invention also provides a kind of data synchronization unit, specifically sees also the structural representation of a kind of data synchronization unit that Fig. 3 discloses, and specifically comprises: acquisition module 301, search module 302, parsing module 303, delivery module 304,
Acquisition module 301 is used for obtaining the unique identification of current processing transactions before submitting processing transactions to;
Search module 302, be used for according to the described unique identification that obtains, inquire about the revocation information of current processing transactions;
Parsing module 303 be used for to be resolved the described revocation information of inquiry, generates synchrodata information, and with described synchrodata information recording/in the synchronous data interface table;
Delivery module 304, being used for described synchronous data interface table is sent to need to be by synchronous equipment.
Preferably, the described module 302 of searching comprises:
Search submodule 302A, be used for the unique identification according to the current processing transactions of obtaining, in system view, search affairs flash back table;
Obtain submodule 302B, be used for obtaining the revocation information that current affairs relate to the tables of data of modification at described affairs flash back table.
Preferably, described parsing module 303 comprises:
Recognin module 303A, for the processing statement type of the described revocation information of identifying inquiry, described processing statement type comprises: cancel statement, insert statement and renewal statement;
Record sub module 303B is used for according to different processing statement types, generates different synchrodata information, and is recorded in the synchronous data interface table.
Preferably, described record sub module can be record sub module 403B, specifically as shown in Figure 4, comprising:
Intron modules A 1, be used for when described processing statement type is cancel statement, from revocation information, obtain record identification, obtain insertion recorded information in the data information table according to record identification, described record identification is used for the information in data information table unique identification file, data block and this data block;
Newly-increased record sub module A2 be used for described insertion recorded information is write service synchronization data-interface table, and mark inserts record identification in the synchronous data interface table.
Preferably, described record sub module can be record sub module 503B, specifically as shown in Figure 5, comprising:
Deletion submodule B1 is used for synchronous data table name being replaced to service synchronization interface table name, and carrying out the statement after resolving when described processing statement type is the insertion statement, generates synchrodata in the synchronous data interface table;
Deletion record submodule B2 is used for identifying in the deletion record of synchronous data interface table mark.
Preferably, described record sub module can be record sub module 603B, specifically comprises as shown in Figure 6:
Updating submodule C1, be used for when described processing statement is the renewal statement, from revocation information, obtain record identification, obtain recorded information in the data information table according to record identification, described record identification is used for the delegation's information in data information table unique identification file, data block and this data block;
Amendment record submodule C2 is used for described recorded information is write corresponding synchronous data interface table, and stamps the amendment record sign in the synchronous data interface table.
Preferably, described delivery module 604 comprises:
Generate submodule 604A, be used for described synchronous data interface table is passed through sync cap, form sync data file;
Transmit submodule 604B, be used in the file transfer protocol (FTP) mode, described sync data file is sent to need to be by synchronous equipment.
Record sub module in the device that discloses in above-described embodiment, can comprise any one or any two or three in three submodules of record sub module 403B, record sub module 503B and record sub module 603B, to satisfy the demand that realizes different transaction data process types.
Same for different affairs, no matter be what affairs, no matter what data MSDSs are affairs relate to, no matter affairs have been carried out several data processing methods, the device that all can provide according to above-described embodiment three is realized synchronously processing.
By above-described embodiment as can be known, the synchronous device of a kind of data provided by the invention, can collect fast and accurately needs synchronous data, improve the data no-load speed, reduce system stores pressure, reduce system performance loss, and this device can separate the data synchronizing function with data service function, and when system maintenance or new demand supported, newly-increased data variation information can automatic synchronization automatically, accurately keeps data consistency.
Embodiment four
The present invention also provides a kind of data synchronous system, specifically sees also a kind of data synchronous system frame diagram that Fig. 7 discloses, and specifically comprises
Synchronization module 701, above-described embodiment three described any one data synchronization units 702 and by synchronization module 703,
Described synchronization module 701 is used for carrying out transaction;
Described data synchronization unit 702 is used for realizing that synchrodata generates processing;
Described by synchronization module 703, be used for the sync data file that scanning receives, with interface table name and record identification synchrodata, finish synchronously rear feedback synchronized result according to synchrodata.
The above only is preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.