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 Data Collection accuracy rate, improve system processing speed, system is easily safeguarded, realizes Modular Data synchronous.
The invention provides a kind of method of data synchronization, comprising:
Before submission processing transactions, obtain the unique identification of current processing transactions;
According to the described unique identification obtained, inquire about the revocation information of current processing transactions;
Resolve the described revocation information of inquiry, generate synchrodata information, and described synchrodata information is recorded in synchronous data interface table;
Described synchronous data interface table is sent to and needs by synchronous equipment.
Preferably, the described described unique identification according to obtaining, inquire about the revocation information of current processing transactions, comprising:
According to the unique identification of the current processing transactions obtained, 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 amendment affairs.
Preferably, described described revocation information of resolving inquiry, generates synchrodata information, and described synchrodata information is recorded in synchronous data interface table, comprising:
Identify the process statement type in the described revocation information of inquiry, described process statement type comprises: cancel statement, inserts statement and upgrades statement;
According to different process statement types, generate different synchrodata information, and be recorded in synchronous data interface table.
Preferably, described according to different process statement types, generate different synchrodata information, and be recorded in synchronous data interface table, comprising:
When described process statement type is cancel statement, record identification is obtained from revocation information, obtain the insertion recorded information in data MSDS according to record identification, described record identification is used for the information in data information table in unique identification file, data block and this data block;
By in described insertion recorded information write synchronous data interface table, and mark inserts record identification in synchronous data interface table.
Preferably, described according to different process statement types, generate different synchrodata information, and be recorded in synchronous data interface table, comprising:
When described process statement type, when inserting statement, synchronous data table name is replaced to sync cap table name, and perform the statement after resolving, in synchronous data interface table, generate synchrodata;
Deletion record mark is marked in synchronous data interface table.
Preferably, described according to different process statement types, generate different synchrodata information, and be recorded in synchronous data interface table, comprising:
When described process statement is when upgrading statement, record identification is obtained from revocation information, obtain recorded information in data MSDS according to record identification, described record identification is used for a line information in data information table in unique identification file, data block and this data block;
By in synchronous data interface table corresponding for described recorded information write, and in synchronous data interface table, stamp amendment record mark.
Preferably, described being sent to by described synchronous data interface table needs by synchronous equipment, comprising:
By described synchronous data interface table by sync cap, form sync data file;
In file transfer protocol (FTP) mode, described sync data file is sent to and needs by synchronizer.
Preferably, described being sent to by described synchronous data interface table needs by after synchronous equipment, also comprises:
Need the sync data file received by synchronous device scan, according to synchronous data interface table name and record identification synchrodata, complete synchronous rear feedback synchronization result.
Present invention also offers a kind of data synchronization unit, comprising:
Acquisition module, for before submission processing transactions, obtains the unique identification of current processing transactions;
Search module, for according to the described unique identification obtained, inquire about the revocation information of current processing transactions;
Parsing module, for resolving the described revocation information of inquiry, generating synchrodata information, and being recorded in synchronous data interface table by described synchrodata information;
Delivery module, needs by synchronous equipment for being sent to by described synchronous data interface table.
Preferably, described in search module, comprising:
Search submodule, for the unique identification according to the current processing transactions obtained, in system view, search affairs flash back table;
Obtain submodule, in described affairs flash back table, obtain the revocation information that Current transaction relates to the tables of data of amendment.
Preferably, described parsing module, comprising:
Recognin module, for identifying the process statement type in the described revocation information of inquiry, described process statement type comprises: cancel statement, inserts statement and upgrades statement;
Record sub module, for according to different process statement types, generates different synchrodata information, and is recorded in synchronous data interface table.
Preferably, described record sub module, comprising:
Intron module, for when described process statement type is cancel statement, record identification is obtained from revocation information, obtain the insertion recorded information in data MSDS according to record identification, described record identification is used for the information in data information table in unique identification file, data block and this data block;
Newly-increased record sub module, for described insertion recorded information being write in service synchronization data-interface table, and mark inserts record identification in synchronous data interface table.
Preferably, described record sub module, comprising:
Deleting submodule, during for being insertion statement when described process statement type, synchronous data table name being replaced to service synchronization interface table name, and perform the statement after resolving, in synchronous data interface table, generate synchrodata;
Deletion record submodule, for marking deletion record mark in synchronous data interface table.
Preferably, described record sub module, comprising:
Upgrade submodule, during for being renewal statement when described process statement, from revocation information, obtain record identification, obtain recorded information in data MSDS according to record identification, described record identification is used for a line information in data information table in unique identification file, data block and this data block;
Amendment record submodule, for described recorded information being write in corresponding synchronous data interface table, and stamps amendment record mark in synchronous data interface table.
Preferably, described delivery module, comprising:
Generate submodule, for described synchronous data interface table is passed through sync cap, form sync data file;
Transmit submodule, in file transfer protocol (FTP) mode, described sync data file is sent to and needs by synchronous equipment.
Present invention also offers a kind of data synchronous system, comprising:
Device described in above-mentioned any one, synchronization module and by synchronization module,
Described synchronization module, for carrying out transaction;
Described by synchronization module, for scanning the sync data file received, according to synchronous data interface table name and record identification synchrodata, complete feedback synchronization result after data syn-chronization.
A kind of method of data synchronization provided by the present invention, Apparatus and system, by affairs follow-up mechanism, obtain the unique ID of Current transaction before the transaction commits, adopt transaction-level Flashback Technology simultaneously, revocation information is inquired about according to affairs ID, process, obtain and need synchronous data, realize synchronous, avoid and generate synchrodata table by way of contrast, take a large amount of internal memory, affect synchronous processing speed, also can affect the problem of the performance of whole system simultaneously.
And, can collect fast and accurately and need synchronous data, improve data syn-chronization speed, minimizing system pressure store, reduce system performance loss, and data syn-chronization 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 enabling above-mentioned purpose of the present invention, feature and advantage become apparent more, are described in detail the embodiment of the present invention below in conjunction with accompanying drawing.
Embodiment one
Refer to Fig. 1, it is the method flow diagram of a kind of method of data synchronization that the embodiment of the present invention one discloses, and comprises the following steps:
Step 101: before submission processing transactions, obtain the unique identification of current processing transactions;
Step 102: according to the described unique identification obtained, inquire about the revocation information of current processing transactions;
Step 103: the described revocation information of resolving inquiry, generates synchrodata information, and is recorded in synchronous data interface table by described synchrodata information;
Step 104: described synchronous data interface table is sent to and needs by synchronous equipment.
Preferably, described step 102 comprises:
According to the unique identification of the current processing transactions obtained, 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 amendment affairs.
Preferably, described step 103 comprises:
Step 103A: identify the process statement type in the described revocation information of inquiry, described process statement type comprises: cancel statement, inserts statement and upgrades statement;
Step 103B: according to different process statement types, generates different synchrodata information, and is recorded in synchronous data interface table.
When described process statement type is cancel statement, preferably, described step 103B is:
From revocation information, obtain record identification, obtain the insertion recorded information in data MSDS according to record identification, described record identification is used for the information in data information table in unique identification file, data block and this data block;
By in described insertion recorded information write service synchronization data-interface table, and mark inserts record identification in synchronous data interface table.When described process statement type is that when inserting statement, preferably, described step 103B is:
Synchronous data table name is replaced to service synchronization interface table name;
Deletion record mark is marked in synchronous data interface table.
When described process statement is that when upgrading statement, preferably, described step 103B is:
Obtain record identification, obtain recorded information in MSDS according to record identification, described record identification is used for a line information in unique identification file, data block and this data block in a database;
By in synchronous data interface table corresponding for described recorded information write, and in synchronous data interface table, stamp amendment record mark.
Preferably, step 104 comprises:
Step 104A: by described synchronous data interface table by sync cap, forms sync data file;
Step 104B: in file transfer protocol (FTP) mode, sends to described sync data file and needs by synchronizer.
Preferably, described method also comprises: need the sync data file received by synchronous device scan, according to synchronous data interface table name and record identification, by the insertion record identification in said method, represents and does insertion process to the data received.Deletion record mark represents does delete processing to data, and amendment record mark represents makes an amendment process to data.By judging that mark synchronously processes the data received, complete synchronous rear feedback synchronization result.
By above-described embodiment one, the method of a kind of data syn-chronization provided by the invention can be found out, adopt Flashback Technology, obtain the revocation information of all changes during transaction, thus the change of data in concrete tables of data is determined by revocation information, realize data syn-chronization, avoid storage mass data table and take ample resources, avoid correction data table information and bring error problem, also improve the performance of data synchronization processing speed and whole system simultaneously.
Embodiment two
In order to better describe the present invention more specifically, below with concrete affairs 1, relating to 3 tables of data synchronizing information scenes is that example is described, and concrete grammar refers to the method for the another kind of data syn-chronization that Fig. 2 discloses, and specifically comprises the following steps:
Step 201: before submission processing transactions 1, obtain the unique ID 1 of current processing transactions;
Step 202: according to the described unique ID 1 obtained, inquire about the revocation information UNDO information of current processing transactions;
Step 203: the described UNDO information of resolving inquiry, generates synchrodata information, and is recorded in synchronous data interface table by described synchrodata information;
Step 204: described synchronous data interface table is sent to and needs by synchronous equipment.
Preferably, described step 202 comprises:
According to the unique identification of the current processing transactions obtained, 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 amendment affairs.
Preferably, described step 203 comprises:
Step 203A: identify the process statement type in the described revocation information of inquiry, described process statement type comprises: cancel statement, inserts statement and upgrades statement;
Step 203B: according to different process statement types, generates different synchrodata information, and is recorded in synchronous data interface table.
When described process statement type is cancel statement, preferably, described step 203B is:
From revocation information, obtain record identification, obtain the insertion recorded information in data MSDS according to record identification, described record identification is used for the information in data information table in unique identification file, data block and this data block;
By in described insertion recorded information write service synchronization data-interface table, and mark inserts record identification in synchronous data interface table.
When described process statement type is that when inserting statement, preferably, described step 203B is:
Synchronous data table name is replaced to service synchronization interface table name, and performs the statement after resolving, in synchronous data interface table, generate synchrodata;
Deletion record mark is marked in synchronous data interface table.
When described process statement is that when upgrading statement, preferably, described step 203B is:
Obtain record identification, obtain recorded information in data MSDS according to record identification, described record identification is used for a line information in data information table in unique identification file, data block and this data block;
By in synchronous data interface table corresponding for described recorded information write, and in synchronous data interface table, stamp amendment record mark.
Preferably, step 204 comprises:
Step 204A: by described synchronous data interface table by sync cap, forms sync data file;
Step 204B: in file transfer protocol (FTP) mode, sends to described sync data file and needs by synchronizer.
Preferably, described method also comprises: need the sync data file received by synchronous device scan, according to synchronous data interface table name and record identification synchrodata, completes synchronous rear feedback synchronization result.
If when the affairs 1 of process relate to three data MSDSs, data information table 1, data information table 2 and data information table 3.
Such as synchronization scenarios A: before submission processing transactions 1, all delete processing is carried out to three data MSDSs that affairs 1 relate to, the unique identification obtaining current processing transactions is ID1, then pass through Flashback Technology, according to ID1 in system view, what obtain transaction-level cancels UNDO information, and affairs relate to three data table information complete documentation in affairs flash back table of amendment.Because all carry out delete processing to three data MSDSs, three the UNDO information then generated, all insert statement, when resolving statement type for inserting statement, then according to preferably, process described in described step 203B, be specially: data information table name is replaced to sync cap table name, and perform the statement after resolving, in synchronous data interface table, generate synchrodata; Deletion record mark is marked in synchronous data interface table.Then realized the transmission of synchrodata by step 204, be specially: by described synchronous data interface table by sync cap, form sync data file; In file transfer protocol (FTP) mode, described sync data file is sent to and needs by synchronous equipment.The then sync data file that received by synchronous device scan of described needs, according to synchronous data interface table name and record identification, carry out synchrodata, be specially and identify delete flag mark, indicating the data in the data syn-chronization data file received is do delete processing, completes synchronous rear feedback synchronization result.
Such as synchronization scenarios B: before submission processing transactions 1, the insertion of all carrying out of three data MSDSs that affairs 1 relate to is processed, the unique identification obtaining current processing transactions is ID1, according to ID1, inquire about the revocation information of current processing transactions, then by Flashback Technology, according to ID1 in system view, what obtain transaction-level cancels UNDO information, and affairs relate to three data table information complete documentation in affairs flash back table of amendment.Because be all carried out inserting process to three data MSDSs, then three the UNDO information generated are all cancel statements;
When to resolve statement type be cancel statement, then according to preferably, process described in described step 203B, be specially:
From revocation information, obtain record identification ROWID, obtain in data information table according to record identification ROWID indicating positions and insert recorded information, described record identification is used for the information in data information table in unique identification file, data block and this data block; By in described insertion recorded information write synchronous data interface table, and mark inserts record identification in synchronous data interface table.
Then realized the transmission of synchrodata by step 204, be specially: by described synchronous data interface table by sync cap, form sync data file; In file transfer protocol (FTP) mode, described sync data file is sent to and needs by synchronous equipment.The then sync data file that received by synchronous device scan of described needs, according to synchronous data interface table name and record identification, carry out synchrodata, be specially: identify and insert mark mark, indicating the data in the data syn-chronization data file received is do to insert process, completes synchronous rear feedback synchronization result.
Such as synchronization scenarios C: before submission processing transactions 1, to the process of all modifying of three data MSDSs that affairs 1 relate to, the unique identification obtaining current processing transactions is ID1, then pass through Flashback Technology, according to ID1 in system view, what obtain transaction-level cancels UNDO information, and affairs relate to three data table information complete documentation in affairs flash back table of amendment.Because be all carried out revising process, then three the UNDO information generated to three data MSDSs, be all upgrade statement;
When resolving statement type for upgrading statement, then according to preferably, process described in described step 203B, be specially:
Obtain record identification ROWID, the described position according to record identification ROWID instruction obtains recorded information in data information table, and described record identification is used for a line information in data information table in unique identification file, data block and this data block;
By in synchronous data interface table corresponding for described recorded information write, and in synchronous data interface table, stamp amendment record mark.
Then realized the transmission of synchrodata by step 204, be specially: by described synchronous data interface table by sync cap, form sync data file; In file transfer protocol (FTP) mode, described sync data file is sent to and needs by synchronous equipment.The then sync data file that received by synchronous device scan of described needs, according to synchronous data interface table name and record identification, carry out synchrodata, be specially: identify amendment mark mark, indicating the data in the data syn-chronization data file received is make an amendment process, completes synchronous rear feedback synchronization result.
Such as, above-mentioned before submission processing transactions 1, to the inserting respectively of three data MSDSs that affairs 1 relate to, delete, revise process, then synchronously can process according to above-mentioned three kinds of corresponding processing modes, certainly, any one or any two kinds or three kinds of data processing methods all can adopt said method to realize synchronous process.
Same for different affairs, no matter be what affairs, no matter affairs relate to how many data MSDSs, no matter affairs have carried out several data processing method, the method that all can provide according to above-described embodiment, has realized synchronously processing.
In said method, data for any affairs carry out inserting process or delete processing or revising the process that the stationary problem processed all can realize data syn-chronization, also for above-mentioned any one or any two kinds or three kinds of data processing forms, data synchronization processing can be carried out simultaneously.
By above-described embodiment two, can find out, a kind of method of data synchronization provided by the invention, by affairs follow-up mechanism, obtain the ID of Current transaction before the transaction commits, adopt transaction-level Flashback Technology simultaneously, revocation information is inquired about according to affairs ID, process, obtain and need synchronous data, realize synchronous, avoid and generate synchrodata table by way of contrast, take a large amount of internal memory, affect synchronous processing speed, also can affect the problem of the performance of whole system simultaneously.
Embodiment three
Present invention also offers a kind of data synchronization unit, specifically refer to the structural representation of a kind of data synchronization unit that Fig. 3 discloses, specifically comprise: acquisition module 301, search module 302, parsing module 303, delivery module 304,
Acquisition module 301, for before submission processing transactions, obtains the unique identification of current processing transactions;
Search module 302, for according to the described unique identification obtained, inquire about the revocation information of current processing transactions;
Parsing module 303, for resolving the described revocation information of inquiry, generating synchrodata information, and being recorded in synchronous data interface table by described synchrodata information;
Delivery module 304, needs by synchronous equipment for being sent to by described synchronous data interface table.
Preferably, described in search module 302, comprising:
Search submodule 302A, for the unique identification according to the current processing transactions obtained, in system view, search affairs flash back table;
Obtain submodule 302B, in described affairs flash back table, obtain the revocation information that Current transaction relates to the tables of data of amendment.
Preferably, described parsing module 303, comprising:
Recognin module 303A, for identifying the process statement type in the described revocation information of inquiry, described process statement type comprises: cancel statement, inserts statement and upgrades statement;
Record sub module 303B, for according to different process statement types, generates different synchrodata information, and is recorded in 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, for when described process statement type is cancel statement, record identification is obtained from revocation information, obtain the insertion recorded information in data MSDS according to record identification, described record identification is used for the information in data information table in unique identification file, data block and this data block;
Newly-increased record sub module A2, for described insertion recorded information being write in service synchronization data-interface table, and mark inserts record identification in synchronous data interface table.
Preferably, described record sub module can be record sub module 503B, specifically as shown in Figure 5, comprising:
Deleting submodule B1, during for being insertion statement when described process statement type, synchronous data table name being replaced to service synchronization interface table name, and perform the statement after resolving, in synchronous data interface table, generate synchrodata;
Deletion record submodule B2, for marking deletion record mark in synchronous data interface table.
Preferably, described record sub module can be record sub module 603B, specifically comprises as shown in Figure 6:
Upgrade submodule C1, during for being renewal statement when described process statement, record identification is obtained from revocation information, obtain recorded information in data MSDS according to record identification, described record identification is used for a line information in data information table in unique identification file, data block and this data block;
Amendment record submodule C2, for described recorded information being write in corresponding synchronous data interface table, and stamps amendment record mark in synchronous data interface table.
Preferably, described delivery module 604, comprising:
Generate submodule 604A, for described synchronous data interface table is passed through sync cap, form sync data file;
Transmit submodule 604B, in file transfer protocol (FTP) mode, described sync data file is sent to and needs by synchronous equipment.
Record sub module in the device disclosed in above-described embodiment, any one in record sub module 403B, record sub module 503B and record sub module 603B tri-submodules or any two or three can be comprised, to meet the demand realizing different transaction data process types.
Same for different affairs, no matter be what affairs, no matter affairs relate to how many data MSDSs, no matter affairs have carried out several data processing method, the device that all can provide according to above-described embodiment three, has realized synchronously processing.
Known by above-described embodiment, the device of a kind of data syn-chronization provided by the invention, can collect fast and accurately and need synchronous data, improve data syn-chronization speed, reduce system pressure store, reduce system performance loss, and data syn-chronization function can be separated with data service function by this device, and when system maintenance or new demand support, automatically newly-increased data variation information can automatic synchronization, accurately keeps data consistency.
Embodiment four
Present invention also offers a kind of data synchronous system, specifically refer to a kind of data synchronous system frame diagram that Fig. 7 discloses, specifically comprise
Any one data synchronization unit 702 described in synchronization module 701, above-described embodiment three and by synchronization module 703,
Described synchronization module 701, for carrying out transaction;
Described data synchronization unit 702, for realizing synchrodata generating process;
Described by synchronization module 703, for scanning the sync data file received, according to synchrodata by interface table name and record identification synchrodata, complete synchronous rear feedback synchronization result.
The above is only the preferred embodiment of the present invention; it should be pointed out that for those skilled in the art, under the premise without departing from the principles 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.