A method and system for restarting parsing in ORACLE data synchronization

By transmitting the earliest transaction breakpoint data Lwn-C during the ORACLE database synchronization process, the problem of difficulty in obtaining breakpoints when the parsing process is restarted is solved, the continuity and accuracy of data synchronization is achieved, and it is suitable for ORACLE RAC multi-node environments.

CN114356648BActive Publication Date: 2024-10-29INFORMATION2 SOFTWARE SHANGHAI
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202110465225.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-28
Publication Date
2024-10-29
Estimated Expiration
2041-04-28

AI Technical Summary

Technical Problem

During the data synchronization process of the ORACLE database, after the parsing process or the loading process exits abnormally, it is difficult to accurately obtain the breakpoint location, resulting in repeated parsing or the inability to read the parsing location file, especially in the ORACLE RAC multi-node environment.

Method used

By transmitting the earliest transaction breakpoint data Lwn-C between the parsing process and the loading process, it is ensured that the parsing process can accurately obtain the starting point of the redo file and achieve continuity of data synchronization.

Benefits of technology

It solves the problems of breakpoint information loss and location file transfer, ensuring the correctness and continuity of ORACLE data synchronization, especially in multi-node environments, avoiding repeated parsing and data loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114356648B_ABST
    Figure CN114356648B_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for restarting parsing during Oracle data synchronization. The method includes: Step S1, the parsing process continuously monitors and parses the redo file of the source database, obtains the corresponding transaction data and writes it into a TF file, and generates the earliest transaction breakpoint data based on the parsing results and writes it into the TF file, and transmits the TF file to the backup end; Step S2, when the source parsing process or the backup loading process restarts, the backup loading process obtains the latest TF file currently cached by the backup end, obtains the latest Commit operation in the TF file, reads the earliest transaction breakpoint data from it, and sends the information to the source parsing process; Step S3, after receiving the earliest transaction breakpoint data, the source parsing process starts parsing the redo file based on the earliest transaction breakpoint data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database synchronization, and in particular to a method and system for restarting parsing in ORACLE data synchronization. Background Art

[0002] Data is the most important thing in information systems, so in order to ensure data security, people often save data in real-time disaster recovery to another environment. For ORACLE database, there is an efficient real-time data synchronization method, which is to analyze the change data of the redo file generated by ORACLE in real time during operation, obtain ORACLE's operation transaction data after processing and conversion, pass these operation transaction data to the disaster recovery end for execution, and load these operation transactions into the ORACLE disaster recovery library again, finally realizing quasi-real-time synchronization of ORACLE data.

[0003] In this synchronization scenario, the source side generally has a parsing process that continuously monitors the redo files of the source side ORACLE database, analyzes the newly added change data, obtains the relevant Oracle operation data, and transmits the data to the standby side; the standby side has a loading process that receives the database operation data transmitted by the analysis process and is responsible for loading these transaction data into the standby side Oracle database.

[0004] Figure 1 It is the content organization form of a single redo file of the ORACLE database. The entire redo file will be divided into N blocks of the same length, Block0-BlockN. At the same time, the entire file will record the transaction operation data of the database in the form of Record. Each Record has a different length and is written into the redo file in sequence by Oracle's dbwr (Data Base Writer) process. The starting position of each Record can be uniquely determined by the file's seq sequence number + block number + offset within the block. When analyzing a redo file, the analysis starts from the starting point of a certain Record. Usually, an Lwn data structure is used to record the redo sequence number, block number, and offset within the block where a certain Record starts.

[0005] For example, for Record1, its redo sequence number is 10, and the starting point is at block 0 + offset 0x300 of the redo file, then the starting point Lwn data of Record1 is recorded as Lwn1 (seq=10, block=0, off=0x300).

[0006] The parsing process will parse the entire Redo file and parse out a series of operations. Since Oracle can be used by multiple users, each user can independently open a transaction to perform add, delete, modify, and commit operations after successfully connecting. These operations will be immediately written into the Redo file as the user executes them. Therefore, there will be multiple transactions parsed from the redo file at the same time within a period of time. Each transaction corresponds to a user connection, starts with Begin, and ends with Commit as the user commits.

[0007] During the data synchronization process, once the parsing process or loading process exits abnormally, for example, when the parsing process stops due to an exception or human operation, when the parsing process is restarted to continue parsing, a problem will arise: which redo file and where to start parsing.

[0008] At present, there are two common ways to deal with the above problems:

[0009] 1) From all the redo files retained in the current Oracle environment, parse the redo file with the smallest sequence in ascending order of the sequence attribute of the redo files: However, in this way, since the redo file has been parsed before, this method will cause repeated parsing. If the source system has a large amount of historical redo files, the amount of repeated parsing will be very large, which will take a long time and the results of repeated parsing will be useless.

[0010] 2) In the process of parsing the transactions contained in the redo file in sequence, the parsing process updates and saves the lwn position of the transaction to the file every time a transaction is parsed. When the parsing process is restarted next time, the position of the transaction that was parsed last time can be found from the file, and then the transaction can continue to parse the subsequent transactions. However, this mode still has certain disadvantages: first, it cannot solve the problem of position file transmission caused by switching synchronization nodes in the multi-node environment of ORACLE RAC (ORACLE Real Application Clusters, ORACLE real-time application cluster). In other words, for multi-node Oracle, the parsing process is generally only run on one of the nodes, so that the parsing position file is saved in the local file system. Once the node is down or unavailable, due to the characteristics of Oracle Rac, other Rac nodes will continue to provide database services. At this time, in order to ensure that the synchronization data is uninterrupted, the parsing process can be run again on another node to continue parsing the Redo log. At this time, the problem of being unable to read the parsing position file will be encountered, resulting in the inability to continue parsing from the previous breakpoint. Summary of the invention

[0011] In order to overcome the deficiencies of the above-mentioned prior art, the purpose of the present invention is to provide a method and system for restarting parsing in data synchronization, so as to accurately obtain the breakpoints that should be analyzed and restart the parsing in various abnormal situations, thereby ensuring that the entire ORACLE data synchronization can be carried out correctly and continuously.

[0012] To achieve the above object, the present invention proposes a method for restarting parsing in ORACLE data synchronization, comprising the following steps:

[0013] Step S1, the parsing process continuously monitors and parses the redo file of the source-end ORACLE database, continuously obtains the corresponding transaction data according to the operation of the Oracle application and writes it into the TF file, and generates the earliest transaction breakpoint data Lwn-C according to the parsing result during the parsing process and writes it into the TF file, and finally transmits the TF file to the standby end, and the standby-end loading process loads the transaction data of the database operation into the standby-end Oracle database according to the received TF file;

[0014] Step S2: When the source-side parsing process or the standby-side loading process is restarted, the standby-side loading process obtains the latest TF file currently cached by the standby end, obtains the latest Commit operation in the TF file, reads the earliest transaction breakpoint data Lwn-C therefrom, and sends the information to the source-side parsing process;

[0015] Step S3: After receiving the earliest transaction breakpoint data Lwn-C, the source-end parsing process starts parsing the Redo file according to the earliest transaction breakpoint data Lwn-C.

[0016] Preferably, step S1 further comprises:

[0017] Step S100, the parsing process starts parsing Redo data from the currently generated Record of the currently active Redo file, and continues to parse the newly added Redo data to obtain corresponding transaction data, and writes the obtained transaction data into the TF file;

[0018] Step S101, when a Begin operation of a transaction is parsed, the position of the breakpoint currently analyzed is recorded and stored in association with the transaction ID number;

[0019] Step S102, when a Commit operation of a transaction is parsed, the earliest transaction breakpoint data Lwn-C is generated according to the parsing result, and the earliest transaction breakpoint data Lwn-C is written into the Commit operation data of the transaction in the TF file.

[0020] Preferably, in step S102, if the start time of the currently committed transaction is the earliest start time among all current transactions, all transactions except the currently committed transaction are searched, and a transaction with the earliest start time is found, and the Lwn breakpoint data corresponding to the transaction ID number with the earliest start time is obtained from the data of the Begin operation of the transaction with the earliest start time, and assigned to the earliest transaction breakpoint data Lwn-C.

[0021] Preferably, in step S102, if the start time of the currently committed transaction is not the earliest start time among all current transactions, all current transactions are searched to find a transaction with the earliest start time, and the Lwn breakpoint data corresponding to the transaction ID number with the earliest start time is obtained from the data of the Begin operation of the transaction with the earliest start time, and assigned to the earliest transaction breakpoint data Lwn-C.

[0022] Preferably, step S2 further comprises:

[0023] Step S200: the loading process receives a feedback parsing breakpoint position request from the parsing process.

[0024] Step S201, the loading process scans the latest local TF file, reversely searches the TF file content from the end of the file to obtain the most recent Commit operation, reads the earliest transaction breakpoint data Lwn-C therefrom, and sends the earliest transaction breakpoint data Lwn-C to the parsing process at the source end.

[0025] Preferably, in step S3, the parsing process directly opens the corresponding Redo file according to the Redo sequence number, block number and offset address in the earliest transaction breakpoint data Lwn-C, and reads the Redo data from the block number and offset address for parsing.

[0026] To achieve the above object, the present invention also provides a system for restarting parsing in ORACLE data synchronization, comprising:

[0027] The source end uses the parsing process to continuously monitor and parse the redo file of the source end ORACLE database, obtains the corresponding transaction data based on the operation of the Oracle application and writes it into the TF file, generates the earliest transaction breakpoint data Lwn-C based on the parsing result during the parsing process, writes the generated earliest transaction breakpoint data Lwn-C into the TF file, and finally transmits the TF file to the standby end; when the source end parsing process or the standby end loading process is restarted, a feedback parsing breakpoint position request is sent to the standby end, and after receiving the earliest transaction breakpoint data Lwn-C sent by the standby end, the Redo file is parsed according to the earliest transaction breakpoint data Lwn-C;

[0028] The standby end 21 uses the loading process to receive the TF file transmitted by the source end parsing process, and loads the transaction data of the database operation into the standby Oracle database according to the received TF file; when the source end parsing process or the standby end loading process is restarted, the loading process is used to obtain the latest TF file cached by the current standby end, and obtain the latest Commit operation in the TF file, read the earliest transaction breakpoint data Lwn-C therefrom, and send the earliest transaction breakpoint data Lwn-C to the parsing process of the source end.

[0029] Preferably, the source end comprises:

[0030] The parsing module uses the parsing process to parse the Redo data starting from the currently generated Record of the currently active Redo file, and continuously parses the newly added Redo data. During the parsing process, the corresponding transaction data is continuously obtained according to the operation of the Oracle application, and the obtained transaction data is written into the TF file;

[0031] The breakpoint recording module is used to record the position of the breakpoint currently analyzed when parsing the Begin operation of a transaction, and store it in association with the transaction ID number;

[0032] The earliest transaction breakpoint data generation module is used to generate the earliest transaction breakpoint data Lwn-C according to the parsing result when parsing the Commit operation of a transaction, and write the earliest transaction breakpoint data Lwn-C into the data of the Commit operation of the transaction in the TF file;

[0033] A feedback parsing breakpoint position request module is used to send a feedback parsing breakpoint position request to the standby end when the source end parsing process or the standby end loading process is restarted;

[0034] The parsing restart module is used to start parsing the corresponding Redo file according to the earliest transaction breakpoint data Lwn-C after receiving the earliest transaction breakpoint data Lwn-C sent by the standby end.

[0035] Preferably, the standby end includes:

[0036] The transaction data loading module is used to receive the TF file transmitted by the source-side parsing process and load the transaction data of the database operation into the standby-side Oracle database according to the received TF file;

[0037] A feedback parsing breakpoint position request receiving module is used to receive a feedback parsing breakpoint position request of a parsing process;

[0038] The breakpoint information search module is used to scan the latest local TF file, reversely search the TF file content from the end of the file to obtain the most recent Commit operation, read the earliest transaction breakpoint data Lwn-C from it, and send the information to the parsing process on the source end.

[0039] Preferably, the parsing process directly opens the corresponding Redo file according to the Redo sequence number, block number and offset address in the earliest transaction breakpoint data Lwn-C, and reads the Redo data from the block number and offset address for parsing.

[0040] Compared with the prior art, the present invention has the following beneficial effects:

[0041] 1) The present invention solves the risk of loss caused by storing breakpoint information on a node of the source end. Since the breakpoint information is stored on the backup end, even if the source end replaces the synchronization node, the parsing process on the new synchronization node can still obtain the correct breakpoint information;

[0042] 2) Considering that the backup end may experience downtime or other accidents, which may cause damage to the TF data file data received in the file system, the present invention only needs to find the breakpoint information contained in the most recent Commit in these available TF files, send the breakpoint information to the parsing process, and parse from this point, thereby ensuring the consistency of the parsed data and preventing data loss. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 This is a diagram showing the content organization of a single redo file in an ORACLE database.

[0044] Figure 2 A flowchart of the steps of a method for restarting parsing in ORACLE data synchronization according to the present invention;

[0045] Figure 3 and Figure 4 This is a schematic diagram of generating the earliest transaction breakpoint data Lwn-C in a specific embodiment of the present invention;

[0046] Figure 5 A system architecture diagram of a system for restarting parsing in ORACLE data synchronization according to the present invention;

[0047] Figure 6 A flowchart of processing parsing breakpoints during the parsing process of the parsing process in an embodiment of the present invention;

[0048] Figure 7 This is a processing flow chart of restarting the parsing process to obtain parsing breakpoints in an embodiment of the present invention. Implementation

[0049] The following describes the implementation of the present invention through specific examples and in conjunction with the accompanying drawings. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific examples, and the details in this specification can also be modified and changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention.

[0050] Before introducing the present invention, some roles of information system disaster recovery and related concepts of ORACLE database are introduced:

[0051] Source: refers to the machine that requires disaster recovery data.

[0052] Backup end: refers to the machine that receives and stores disaster recovery data.

[0053] Oracle operations: In addition to data creation, deletion, and modification (DML) operations, Oracle operations also include some transaction operations and other operations. Here we only focus on transaction operations, including transaction Begin and transaction Commit operations.

[0054] Oracle database transaction: An Oracle database transaction may include a batch of DML operations or DDL operations. A transaction generally starts with a Begin operation and ends with a Commit or Rollback operation.

[0055] Oracle Redo File: Oracle's redo log file records all transaction data generated by Oracle and is used to ensure Oracle database failure recovery. Each Oracle instance has a set of online Redo files that are used in a circular manner, and the used Redo files can be archived. Each Redo file has a sequence number that uniquely corresponds to it.

[0056] Record: Record data inside Oracle's redo file. Each redo file consists of records, and each record contains a set of Oracle operation data.

[0057] Parsing process: refers to a process running on the source side. This process continuously monitors the redo files of the source side ORACLE database, analyzes the newly added change data, obtains the relevant Oracle operation data, and transmits the data to the backup side;

[0058] Loading process: refers to a process running on the standby end. This process receives the database operation data transmitted by the analysis process and is responsible for loading these transaction data into the Oracle database on the standby end.

[0059] TF file: specifically refers to a file used to save database transaction data analyzed by the parsing process, that is, a file used to save the parsing results.

[0060] Lwn: A data structure that contains the sequence number of the redo file, the block number within the redo file, and the offset within the block. One Lwn can uniquely determine the precise starting point of Oracle's redo analysis.

[0061] Figure 2 The present invention is a flowchart of a method for restarting parsing in ORACLE data synchronization. Figure 2 As shown, the present invention provides a method for restarting parsing in ORACLE data synchronization, comprising the following steps:

[0062] Step S1, the parsing process continuously monitors and parses the redo file of the source-end ORACLE database, writes the corresponding transaction data obtained by the parsing into the TF file, and generates the earliest transaction breakpoint data Lwn-C according to the parsing result during the parsing process, writes the generated earliest transaction breakpoint data Lwn-C into the TF file, and transmits the TF file to the standby end. The standby-end loading process loads the transaction data of the database operation into the standby-end ORACLE database according to the received TF file. The TF file refers to a file used to save the database transaction data parsed by the parsing process.

[0063] Specifically, step S1 further includes:

[0064] Step S100, the parsing process starts parsing the Redo data from the currently generated Record in the currently active Redo file, and continues to parse the newly added Redo data. During the parsing process, the corresponding transaction data is continuously obtained based on the operation of the Oracle application, and the obtained transaction data is written into a TF file. Specifically, during the parsing process, the corresponding transaction data is continuously obtained based on the operation of the Oracle application. Each time the parsing process parses a transaction, the transaction data will be written into the TF file. A transaction data generally includes a Begin operation and a Commit operation, as well as related DML or DDL operations in between. Generally, the data of multiple transactions will be written into a TF file together. For timeliness, the newly written data is simultaneously transmitted to the standby TF file. When the size of the TF file reaches a certain amount, a new TF file will be added to save the transaction data.

[0065] Step S101, when a Begin operation of a transaction is parsed, the location Lwn of the breakpoint currently analyzed is recorded and stored in association with the transaction ID number.

[0066] That is, when the parsing process parses a Begin operation of a transaction, it is necessary to record the location of the current parsing breakpoint and store it in memory in association with the transaction ID number for subsequent reference to find the earliest value to assign to Lwn-C.

[0067] Step S102, when the Commit operation of the transaction is parsed, the earliest transaction breakpoint data Lwn-C is generated according to the parsing result, and the earliest transaction breakpoint data Lwn-C is written into the data of the Commit operation of the transaction in the TF file, that is, the earliest transaction breakpoint data Lwn-C records the starting point of the re-parsing.

[0068] Specifically, when the parsing process parses the Commit operation of the transaction, it will generate the earliest transaction breakpoint data with the code name Lwn-C, and write the earliest transaction breakpoint data into the data of the Commit operation of the transaction. In the present invention, each transaction has a corresponding Lwn breakpoint data. When the redo analysis reaches a certain position and encounters a new transaction (begin operation of the transaction), this position is the Lwn breakpoint data of the transaction.

[0069] In a specific embodiment of the present invention, the earliest transaction breakpoint data Lwn-C is the aforementioned Lwn data structure. Similarly, as the breakpoint data for recording Oracle parsing redo log files, it includes the following three parts:

[0070] Seq: the sequence number of the redo log file;

[0071] BlockNo: The block number inside the redo log file. This block number corresponds to the internal block number of the redo file described by ORACLE.

[0072] Offset: The offset within the block of the redo log file.

[0073] In a specific embodiment of the present invention, the method for generating the earliest transaction breakpoint data Lwn-C is as follows:

[0074] 1. If the start time of the currently committed transaction is the earliest among all current transactions (i.e., multiple transactions may be executed at the same time, and the Begin start times of these transactions may be different, and the earliest transaction has the earliest start time), then search all other transactions except this transaction, find a transaction with the earliest start time, obtain the Lwn breakpoint data corresponding to the transaction ID from the data of the Begin operation of the transaction (recorded in step S101), and assign it to Lwn-C as the earliest transaction breakpoint data;

[0075] For example, Figure 3As shown, assuming that the current parsing is interrupted, the latest Commit data in the TF file that can be read in the standby machine is the Commit data of transaction 1. It can be seen that the current source end is parsing transactions 2 (and possibly transaction 3). When the Commit transaction of transaction 1 is parsed, it means that the parsing result of transaction 1 is complete. At this time, if the source end re-parses, it should start parsing from transaction 2. Therefore, according to the above method, since the start time of transaction 1 is the earliest, all other transactions are searched to find the transaction with the earliest start time, that is, transaction 2, and the Lwn breakpoint data Lwn2 corresponding to the transaction ID number is assigned to Lwn-C, which means that the source end re-parses to start parsing from transaction 2 and start parsing from the Lwn-C breakpoint in the Commit data.

[0076] 2. If the start time of the currently committed transaction is not the earliest start time among all current transactions, search all current transactions to find a transaction with the earliest start time, obtain the Lwn breakpoint data corresponding to the transaction ID number from the data of the Begin operation of the transaction, and assign it to Lwn-C as the earliest transaction breakpoint data.

[0077] For example, Figure 4 As shown in the figure, when the Commit transaction of transaction 2 is parsed, it means that the parsing result of transaction 2 is complete. At this time, if the source end re-parses, it should start parsing from transaction 1. Since the start time of transaction 2 is not the earliest start time among all current transactions, all current transactions are searched to find a transaction with the earliest start time, that is, transaction 1. From the data of the Begin operation of the transaction, the Lwn breakpoint data Lwn1 corresponding to the transaction ID number is obtained and assigned to Lwn-C.

[0078] Step S2, when the source-side parsing process or the standby-side loading process is restarted, the standby-side loading process obtains the latest TF file currently cached by the standby, and obtains the latest Commit operation in the TF file, reads the earliest transaction breakpoint data Lwn-C from it and sends the information to the source-side parsing process.

[0079] Specifically, step S2 further includes:

[0080] Step S200: The loading process receives a feedback parsing breakpoint location request from the parsing process.

[0081] Specifically, when the parsing process is restarted or the standby loading process is restarted, the parsing process will request the standby loading process to feedback the parsing breakpoint position through the network.

[0082] Step S201, the loading process scans the latest local TF file, reversely searches the TF file content from the end of the file to obtain the most recent Commit operation, reads the earliest transaction breakpoint data Lwn-C therefrom and sends the information to the parsing process at the source end.

[0083] Step S3: After receiving the earliest transaction breakpoint data Lwn-C, the parsing process starts parsing the Redo file according to the earliest transaction breakpoint data Lwn-C.

[0084] Specifically, after the parsing process receives the earliest transaction breakpoint data Lwn-C fed back by the loading process, it directly opens the corresponding Redo file according to the Redo sequence number, block number and offset address in the earliest transaction breakpoint data Lwn-C, and reads the Redo data from the block number and offset address for parsing.

[0085] Figure 5 This is a system architecture diagram of a system for restarting parsing in ORACLE data synchronization according to the present invention. Figure 5 As shown, the present invention provides a system for restarting parsing in ORACLE data synchronization, comprising:

[0086] The source end 50 uses the parsing process to continuously monitor and parse the redo file of the source end ORACLE database, obtains the corresponding transaction data based on the operation of the Oracle application and writes it into the TF file, generates the earliest transaction breakpoint data Lwn-C based on the parsing result during the parsing process, writes the generated earliest transaction breakpoint data Lwn-C into the TF file, and transmits the TF file to the standby end. The TF file refers to a file used to save the database transaction data parsed by the parsing process; when the source end parsing process or the standby end loading process is restarted, a feedback parsing breakpoint position request is sent to the standby end, and after receiving the earliest transaction breakpoint data Lwn-C sent by the standby end, the Redo file is parsed according to the earliest transaction breakpoint data Lwn-C.

[0087] Specifically, the parsing process of the source end 50 further includes:

[0088] The parsing module 501 uses the parsing process to parse the Redo data starting from the currently generated Record of the currently active Redo file, and continues to parse the newly added Redo data. During the parsing process, the corresponding transaction data is continuously obtained according to the operation of the Oracle application, and the obtained transaction data is written into the TF file.

[0089] Specifically, during the parsing process, the corresponding transaction data is continuously obtained based on the operations of the Oracle application. Every time a transaction is parsed, the transaction data will be written into the TF file. A transaction data generally includes the Begin operation and the Commit operation, as well as the related DML or DDL operations in between.

[0090] The breakpoint recording module 502 is used to record the position of the currently analyzed breakpoint when parsing the Begin operation of a transaction, and associate it with the transaction ID number.

[0091] The earliest transaction breakpoint data generating module 503 is used to generate the earliest transaction breakpoint data Lwn-C according to the parsing result when parsing the Commit operation of the transaction, and write the earliest transaction breakpoint data Lwn-C into the data of the Commit operation of the transaction in the TF file.

[0092] Specifically, when the parsing module parses the Begin operation of a transaction, it needs to record the position of the current analysis breakpoint and store it in memory in association with the transaction ID number for subsequent processing; when the parsing process parses the Commit operation of a transaction, it will generate the earliest transaction breakpoint data code-named Lwn-C, and write the earliest transaction breakpoint data Lwn-C into the data of the Commit operation of the transaction.

[0093] In a specific embodiment of the present invention, the method for generating the earliest transaction breakpoint data Lwn-C is as follows:

[0094] 1. If the start time of the currently committed transaction is the earliest among all current transactions, search all transactions except this transaction and find a transaction with the earliest start time. Obtain the Lwn data corresponding to the transaction ID from the data of the Begin operation of the transaction and assign it to Lwn-C;

[0095] 2. If the start time of the currently committed transaction is not the earliest start time among all current transactions, search all current transactions to find a transaction with the earliest start time, obtain the Lwn data corresponding to the transaction ID number from the data of the Begin operation of the transaction, and assign it to Lwn-C.

[0096] The parsing breakpoint position feedback request module 504 is used to send a parsing breakpoint position feedback request to the standby end when the source end parsing process or the standby end loading process is restarted.

[0097] The parsing and restarting module 505 is used to start parsing the Redo file according to the earliest transaction breakpoint data Lwn-C after receiving the earliest transaction breakpoint data Lwn-C sent by the standby end.

[0098] The standby end 51 uses the loading process to receive the TF file transmitted by the source end parsing process, and loads the transaction data of the database operation into the standby Oracle database according to the received TF file; when the source end parsing process or the standby end loading process is restarted, the loading process is used to obtain the latest TF file cached by the current standby end, and obtain the latest Commit operation in the TF file, read the earliest transaction breakpoint data Lwn-C therein and send the information to the parsing process of the source end.

[0099] Specifically, the loading process of the standby end 51 further includes:

[0100] The transaction data loading module 510 is used to receive the TF file transmitted by the source-side parsing process, and load the transaction data of the database operation into the standby-side Oracle database according to the received TF file.

[0101] The feedback parsing breakpoint position request receiving module 511 is used to receive a feedback parsing breakpoint position request of a parsing process.

[0102] Specifically, when the parsing process is restarted or the standby loading process is restarted, the parsing process requests the standby loading process to feedback the parsing breakpoint position through the network.

[0103] The breakpoint information search module 512 is used to scan the latest local TF file, reversely search the TF file content from the end of the file to obtain the most recent Commit operation, read the earliest transaction breakpoint data Lwn-C therefrom and send the information to the parsing process at the source end.

[0104] Example

[0105] Figure 6 This is a flow chart of processing parsing breakpoints during the parsing process in an embodiment of the present invention. Figure 6 As shown, in this embodiment, the parsing process is as follows:

[0106] Initially, the parsing process starts parsing the Redo data from the currently generated Record of the currently active Redo file, and continues to parse the newly added Redo data. During the parsing process, the corresponding transaction data is continuously obtained based on the operation of the Oracle application. These transaction data will be written into TF files. Finally, these TF files will be sent to the standby end.

[0107] When the parsing process parses the Begin operation of the transaction, it is necessary to record the location of the current analysis breakpoint and store it in memory in association with the transaction ID number for subsequent processing.

[0108] When the parsing process parses a transaction's Commit operation, it generates an earliest transaction breakpoint data (codenamed Lwn-C), and writes the earliest transaction breakpoint data Lwn-C into the Commit data. The earliest transaction breakpoint data Lwn-C is generated as follows:

[0109] If the start time of the currently committed transaction is the earliest among all current transactions, search all other transactions except this transaction and find a transaction with the earliest start time. Obtain the Lwn breakpoint data corresponding to the transaction ID from the data of the Begin operation of the transaction and assign it to Lwn-C.

[0110] If the start time of the currently committed transaction is not the earliest start time among all current transactions, search all current transactions and find a transaction with the earliest start time. From the data of the Begin operation of the transaction, obtain the Lwn breakpoint data corresponding to the transaction ID number and assign it to Lwn-C.

[0111] Figure 7 FIG. 1 is a flowchart of restarting the parsing process to obtain the parsing breakpoint Lwn in an embodiment of the present invention. Figure 7 As shown, in this embodiment, when the parsing process is restarted or the standby loading process requires the parsing process to restart parsing at the specified breakpoint, the following processing is performed:

[0112] 1. The parsing process requests the standby loading process to feedback the parsing breakpoint position through the network;

[0113] 2. The standby loading process scans the latest Commit operation in the latest local TF file, obtains the earliest transaction breakpoint data Lwn-C, and feeds the earliest transaction breakpoint data Lwn-C back to the parsing process through the network;

[0114] 3. After receiving the feedback of the earliest transaction breakpoint data Lwn-C, the parsing process directly opens the corresponding Redo file according to the Redo sequence number, block number and offset address in it, and reads the Redo data from the block number and offset address for parsing. The subsequent parsing process is the same as above.

[0115] Through the above steps, the purpose of restarting the parsing according to the breakpoint after restarting the parsing is achieved.

[0116] In summary, the method and system for restarting parsing in ORACLE data synchronization of the present invention continuously monitors and parses the redo file of the source ORACLE database by utilizing the parsing process, obtains the corresponding transaction data and writes it into the TF file according to the operation of the Oracle application, generates the earliest transaction breakpoint data Lwn-C according to the parsing result during the parsing process, writes the generated earliest transaction breakpoint data Lwn-C into the TF file, and finally transmits the TF file to the standby end; when the source end parsing process or the standby end loading process is restarted, the loading process is used to open the latest TF file cached by the current standby end, and the TF file content is reversely searched from the end of the file to obtain the most recent Commit operation, and the earliest transaction breakpoint data Lwn-C is read therefrom and the information is sent to the parsing process of the source end. After the parsing process receives the earliest transaction breakpoint data Lwn-C, it starts to parse the Redo file information from this breakpoint, thereby ensuring the continuity of the parsing process.

[0117] The above embodiments are only illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Any person skilled in the art may modify and change the above embodiments without violating the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be as set forth in the claims.

Claims

1. A method for restarting parsing in ORACLE data synchronization, comprising the following steps: Step S1, the source end parsing process continuously monitors and parses the Redo file of the source end ORACLE database, continuously obtains the corresponding transaction data according to the operation of the ORACLE application and writes it into the TF file, and generates the earliest transaction breakpoint data Lwn-C according to the parsing result during the parsing process and writes it into the TF file, and finally transmits the TF file to the standby end, and the standby end loading process loads the transaction data of the database operation into the standby end ORACLE database according to the received TF file; Step S1 further includes: Step S100, the source-side parsing process starts parsing Redo data from the currently generated Record of the currently active Redo file, and continues to parse the newly added Redo data to obtain corresponding transaction data, and writes the obtained transaction data into the TF file; wherein Record is the record data inside the Redo file, and each Record contains a set of ORACLE operation data; Step S101, when a Begin operation of a transaction is parsed, the position of the breakpoint currently analyzed is recorded and stored in association with the transaction ID number; Step S102, when a Commit operation of a transaction is parsed, the earliest transaction breakpoint data Lwn-C is generated according to the parsing result, and the earliest transaction breakpoint data Lwn-C is written into the data of the Commit operation of the transaction in the TF file; Step S2, when the source-side parsing process or the standby-side loading process is restarted, the standby-side loading process obtains the latest TF file currently cached by the standby, obtains the latest Commit operation in the TF file, reads the earliest transaction breakpoint data Lwn-C therefrom, and sends the earliest transaction breakpoint data Lwn-C to the source-side parsing process; Step S2 further includes: Step S200, the standby-end loading process receives a feedback parsing breakpoint position request from the source-end parsing process; Step S201, the standby end loading process scans the latest local TF file, reversely searches the TF file content from the end of the file to obtain the most recent Commit operation, reads the earliest transaction breakpoint data Lwn-C therefrom, and sends the earliest transaction breakpoint data Lwn-C to the source end parsing process; Step S3, after the source-end parsing process receives the earliest transaction breakpoint data Lwn-C, it starts parsing the Redo file according to the earliest transaction breakpoint data Lwn-C; wherein, the source-end parsing process directly opens the corresponding Redo file according to the Redo sequence number, block number and offset address in the earliest transaction breakpoint data Lwn-C, and reads the Redo data from the block number and offset address for parsing.

2. A method for restarting parsing in ORACLE data synchronization as claimed in claim 1, characterized in that: In step S102, if the start time of the currently committed transaction is the earliest start time among all current transactions, all other transactions except the currently committed transaction are searched, and a transaction with the earliest start time is found. From the data of the Begin operation of the transaction with the earliest start time, the Lwn breakpoint data corresponding to the transaction ID number with the earliest start time is obtained, and assigned to the earliest transaction breakpoint data Lwn-C.

3. A method for restarting parsing in ORACLE data synchronization as claimed in claim 2, characterized in that: In step S102, if the start time of the currently committed transaction is not the earliest start time among all current transactions, all current transactions are searched to find a transaction with the earliest start time, and the Lwn breakpoint data corresponding to the transaction ID number with the earliest start time is obtained from the data of the Begin operation of the transaction with the earliest start time, and the data is assigned to the earliest transaction breakpoint data Lwn-C.

4. A system for restarting parsing in ORACLE data synchronization, comprising: The source end uses the source end parsing process to continuously monitor and parse the Redo file of the source end ORACLE database, obtains the corresponding transaction data according to the operation of the ORACLE application and writes it into the TF file, generates the earliest transaction breakpoint data Lwn-C according to the parsing result during the parsing process, writes the generated earliest transaction breakpoint data Lwn-C into the TF file, and finally transmits the TF file to the standby end; when the source end parsing process or the standby end loading process is restarted, a feedback parsing breakpoint position request is sent to the standby end, and after receiving the earliest transaction breakpoint data Lwn-C sent by the standby end, the Redo file is parsed according to the earliest transaction breakpoint data Lwn-C; wherein, the source end parsing process directly opens the corresponding Redo file according to the Redo sequence number, block number and offset address in the earliest transaction breakpoint data Lwn-C, and reads the Redo data from the block number and offset address for parsing; The source end includes: The parsing module uses the source-side parsing process to parse the Redo data starting from the currently generated Record of the currently active Redo file, and continuously parses the newly added Redo data. During the parsing process, the corresponding transaction data is continuously obtained according to the operation of the ORACLE application, and the obtained transaction data is written into the TF file; wherein, Record is the record data inside the Redo file, and each Record contains a set of ORACLE operation data; The breakpoint recording module is used to record the position of the breakpoint currently analyzed when parsing the Begin operation of a transaction, and store it in association with the transaction ID number; The earliest transaction breakpoint data generation module is used to generate the earliest transaction breakpoint data Lwn-C according to the parsing result when parsing the Commit operation of a transaction, and write the earliest transaction breakpoint data Lwn-C into the data of the Commit operation of the transaction in the TF file; A feedback parsing breakpoint position request module is used to send a feedback parsing breakpoint position request to the standby end when the source end parsing process or the standby end loading process is restarted; A parsing restart module, configured to start parsing a corresponding Redo file according to the earliest transaction breakpoint data Lwn-C after receiving the earliest transaction breakpoint data Lwn-C sent by the standby end; The standby end uses the standby end loading process to receive the TF file transmitted by the source end parsing process, and loads the transaction data of the database operation into the standby end ORACLE database according to the received TF file; when the source end parsing process or the standby end loading process is restarted, the standby end loading process is used to obtain the latest TF file cached by the current standby end, and obtain the latest Commit operation in the TF file, read the earliest transaction breakpoint data Lwn-C from it, and send the earliest transaction breakpoint data Lwn-C to the source end parsing process; The standby end includes: The transaction data loading module is used to receive the TF file transmitted by the source-side parsing process and load the transaction data of the database operation into the standby-side ORACLE database according to the received TF file; A feedback parsing breakpoint position request receiving module is used to receive a feedback parsing breakpoint position request of a source end parsing process; The breakpoint information search module is used to scan the latest local TF file, reversely search the TF file content from the end of the file to obtain the most recent Commit operation, read the earliest transaction breakpoint data Lwn-C from it, and send the earliest transaction breakpoint data Lwn-C to the source-side parsing process.

Citation Information

Patent Citations

  • Analysis model applied to database log analysis

    CN109614378A

  • ORACLE data increment synchronization system and method

    CN110569142A

  • Relational database data replication method based on log logic analysis

    CN111061594A

  • Continuous data protection system and method based on Oracle log analysis

    CN111427898A

  • DDL analysis method and device based on log analysis

    CN112612859A