A method, device and storage medium for automatic active-active disaster recovery of ORACLE database

By building a dynamic log buffer pool and analyzing REDO logs and ARCH logs in real time, the complexity and high cost of active-active technology in the ORACLE database are solved, second-level data synchronization and consistency verification of the ORACLE database is achieved, and the disaster recovery database is ensured. High real-time performance and reliability.

CN118410115BActive Publication Date: 2024-09-06SHANGHAI LANDER SOFTWARE CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202410883301.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-09-06
Estimated Expiration
2044-07-03

AI Technical Summary

Technical Problem

The existing ORACLE database active-active technology is complex to implement and costly, and log file parsing tools cannot effectively parse log information before ORACLE 8, making it difficult to achieve efficient data synchronization and disaster recovery management.

Method used

By building a dynamic log buffer pool, parsing REDO logs and ARCH logs in real time, obtaining DML and DDL operations, and synchronizing them to the disaster recovery database, using transaction-level data push and cross-platform logical synchronization technology to achieve second-level data synchronization and consistency check.

Benefits of technology

Ensure that the disaster recovery database is always active, achieve second-level data synchronization of the primary and secondary databases, improve the real-time and consistency of data, and reduce implementation complexity and cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118410115B
    Figure CN118410115B
Patent Text Reader

Abstract

The present invention discloses an automatic active-active disaster recovery method, device and storage medium of an ORACL database, comprising the following steps: S1, constructing a log buffer pool, applying for a memory space of the same size as the target database buffer as the log buffer pool; S2, obtaining the target database log file; S3, loading a log parsing module; S4, transmitting data files, a data sensing control triggering a transmission module, pushing log buffer data to a disaster recovery server from the last breakpoint, the disaster recovery server receiving the data and writing it into a local log buffer pool, and updating the local transmission breakpoint; S5, reading the standby machine data submission breakpoint through the data synchronization strategy of the local server, writing the transaction into the standby machine database and cleaning up the outdated log data; S6, result consistency check, the verification module completes the result consistency check after the disaster recovery ends. The active-active disaster recovery technology provided by the present invention can ensure that the database of the disaster recovery center is always in an active state and verify the validity of the data at any time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of ORACLE databases, and in particular to an automatic active-active disaster recovery method, device and storage medium for ORACLE databases. Background Art

[0002] Active-active database technology can achieve continuous access to data and uninterrupted business operations, while also effectively preventing the risk of business interruption and data loss. However, there are also many challenges in the implementation of active-active databases, such as high difficulty in implementation, complex configuration, and high cost. It requires a deep understanding of its applicable scenarios and scope of application, as well as reasonable selection, planning, and management. While ensuring high availability, achieving data reliability and security that cannot be matched by a single data center is one of the difficult problems that enterprises must face and solve in data center design.

[0003] The database log file stores all the data for database recovery and records every change to the database structure, that is, all the data manipulation statements (DML, Data Manipulation Language) for database operations. The ORACLE log file contains detailed information on system operations, including server startup and shutdown, table creation, index creation, SQL statement execution information, and asynchronous program information and transaction execution process in the system. Based on the information provided in the ORACLE log, the database can be analyzed and necessary adjustments and optimizations can be made to related issues. However, the original log information is difficult to understand. Although ORACLE provides the LogMiner tool for analyzing redo log information, the data dictionary part (such as table name, column name, etc.) and values ​​in the statements interpreted by LogMiner will be in hexadecimal form and cannot be directly understood. The LogMiner log analysis tool can only analyze products after ORACLE 8. For products before ORACLE 8, the tool is also powerless. Summary of the invention

[0004] An object of the present invention is to propose an automatic active-active disaster recovery method, device and storage medium for an ORACLE database, which automatically and in real time parses the REDO log and ARCH log in the target database (ORACLE), obtains the DML and DDL operations in the production database, and then synchronizes these operations to the disaster recovery database to achieve disaster recovery.

[0005] According to an embodiment of the present invention, an automatic active-active disaster recovery method, device and storage medium for an ORACLE database include the following steps:

[0006] S1. Build a log buffer pool. Apply for a memory space of the same size as the target database buffer as the log buffer pool. Divide the buffer pool into subpage spaces of a predetermined size. Create a one-way pointer linked list for each subpage. When managing the buffer, dynamically increase or decrease the number of nodes in each pointer linked list as needed to achieve the construction of a dynamic log buffer pool.

[0007] S2. Obtain the target database log file. The capture module reads the Redolog of the target database in the production system, finds the SCN breakpoint of the last analysis, and loads the captured log file into the log buffer pool constructed in step 1.

[0008] S3, load the log parsing module, use the log file parser in the log buffer pool to parse the data definition language and data operation language according to the transaction main line, and write the parsed data definition language and data operation language into the data file in the transaction unit;

[0009] S4: Transmit data files. The data-aware control triggers the transmission module to push log buffer data to the disaster recovery server starting from the last breakpoint. The disaster recovery server receives the data and writes it into the local log buffer pool, and updates the local transmission breakpoint.

[0010] S5. The local log buffer pool sorts the received log data in order according to the transaction sequence to generate a transaction queue, reads the standby data commit breakpoint through the data synchronization strategy of the local server, writes the transaction to the standby database and cleans up the outdated log data;

[0011] S6: Result consistency check: The verification module completes the result consistency check after the disaster recovery is completed.

[0012] Optionally, the S1 specifically includes:

[0013] S11. Apply for a memory space of the same size as the target database buffer as the log buffer pool. :

[0014] ;

[0015] in, is the number of pages of the target database buffer. is the size of each page;

[0016] S12, divide the log buffer pool into sub-page spaces of a predetermined size, the size of the sub-page space is , , and establish a one-way pointer linked list for each sub-page space, where S represents the actual sub-page space size;

[0017] S13, when managing the log buffer pool, dynamically increase or decrease the number of nodes in each pointer linked list as needed to adapt to different memory requirements and log data volumes;

[0018] S14. A control node is set up in each subpage space of the log buffer pool to record the usage status of the current subpage, including the used space and the remaining space;

[0019] S15. Each subpage space is connected through a one-way pointer linked list. The nodes of the pointer linked list include the start address and the end address of the subpage, so as to quickly locate and access the log data.

[0020] S16, the construction process of the dynamic log buffer pool includes the allocation and release of subpage space. The allocation of subpage space is performed according to the principle of free first and then use. The release of subpage space is recycled according to the processing status of log data.

[0021] S17, when the log data is written into the log buffer pool, the write position of the log data and the remaining space of the current subpage are recorded in real time by updating the control node of the subpage space;

[0022] S18: When log data needs to be read from the log buffer pool, the log data in each sub-page space is read in sequence by traversing the one-way pointer linked list.

[0023] Optionally, the S2 specifically includes:

[0024] S21. The capture module reads the Redo log file of the target database in the production system. The Redo log file contains multiple log groups. ,in, , is the number of log groups;

[0025] S22. Find the last parsed system change number breakpoint in the Redo log file and record it as ,in, For the last analysis Breakpoints;

[0026] S23, when not found in the Redo log file group When a breakpoint occurs, the archive log is traced back and the archive log file is recorded as ,in, , Is the number of archived log files;

[0027] S24, load the captured redo log and archive log files into the log buffer pool constructed in S1, and write the log files into the subpage space in sequence;

[0028] S25, the capture module is based on Sort the Redo log and archive log files in order and record the start and end points of each log file. Number and termination Number, respectively and ;

[0029] S26, when the capture module reads the log file, it determines the type, size, and start point of the current log file by parsing the log file header information. Number and termination Number;

[0030] S27, the capture module loads the read log file data into the subpage space of the log buffer pool in blocks, and the size of each log block is ,in, ;

[0031] S28. After the log data is loaded into the log buffer pool, the capture module updates the control node of the log buffer pool in real time and records the current write position and remaining space.

[0032] Optionally, the S3 specifically includes:

[0033] S31, using a log file parser in the log buffer pool, the log file parser is responsible for reading the log data in the log buffer pool, and parsing the data definition language and data operation language operations according to the transaction main line;

[0034] S32. The log file parser parses the log file according to the transaction main line, determines the starting point and end point of the transaction, and records the unique identifier of each transaction. ,in, , is the number of transactions;

[0035] S33, constructing log multidimensional time series data, splitting the log file into multidimensional time series data according to the log file timestamp, and vectorizing the data file using its own hexadecimal data;

[0036] S34, online principal component analysis, converting newly acquired data into principal components after each update, using the mean obtained from the most recent calculation point and the variance-covariance matrix , the principal components are calculated by the following formula:

[0037] ;

[0038] in, The main component, is the number of principal components, represents the mean vector of the data set, Each element of is the mean of the corresponding variable over all observations, represents the square root matrix of the inverse of the covariance matrix, represents the observation vector of the jth data point, This term centers the data by subtracting the mean vector from each observation, essentially shifting the data so that the mean of the data is zero;

[0039] S35, using the minimum description length principle to determine the subject length, applying the minimum description length principle to the obtained subject data string, and calculating the description length :

[0040] ;

[0041] in, is the data point in the subject data string, is the probability of the data point. This formula is used to intercept the operation information of the data definition language and the data operation language, remove the noise information, and record it as ;

[0042] S36, locate the key position of the data definition language and the data operation language operation, locate the key position of the data definition language and the data operation language operation according to the operation information of the intercepted data definition language and the data operation language, and the key position is recorded as and ;

[0043] S37, when the log file parser parses the data definition language operation, it identifies the CREATE, ALTER, and DROP data definition language statements and records the relevant metadata changes. The parsed data definition language operation is stored in the data definition language buffer, which is recorded as ;

[0044] S38. When the log file parser parses the data operation language operation, it identifies the INSERT, UPDATE, and DELETE data operation language statements and records the relevant data changes. The parsed data operation language operation is stored in the data operation language buffer, which is recorded as .

[0045] Optionally, the S4 specifically includes:

[0046] S41, the data sensing control monitors the data changes in the log buffer pool, and when new log data is detected to be written, triggers the transmission module to start the data transmission process;

[0047] S42, the transmission module starts reading the log data in the log buffer pool from the last breakpoint, and the starting position of the reading is the end position of the last transmission, which is recorded as , the current reading position is recorded as ;

[0048] S43, the transmission module packages the read log data blocks according to the transaction unit, and the size of each data packet is recorded as ,in, Not exceeding the size of the subpage space;

[0049] S44, transmitting the packaged log data to the disaster recovery server through the network, and using the TLS protocol to encrypt the data during the transmission process;

[0050] S45, the disaster recovery server receives the transmitted log data packet and records the current receiving position as , and write the log data packets into the local log buffer pool in sequence, and update the local transmission breakpoint;

[0051] S46. After receiving the data, the disaster recovery server unpacks the received log data and sorts them according to the transaction sequence.

[0052] S47, the disaster recovery server performs consistency verification on the received log data through the verification module, generates a data digest using the SHA-256 algorithm, and compares it with the data digest before transmission;

[0053] S48. After the transmission module completes the data transmission, the control node of the source end log buffer pool updates the current transmission position and the remaining log data to prepare for the next data transmission.

[0054] Optionally, the S5 specifically includes:

[0055] S51, generating a transaction queue, the local log buffer pool sorts the received log data in order according to the transaction sequence, and generates a transaction queue;

[0056] S52, start the synchronization strategy mechanism, read the commit breakpoint of the standby database through the data synchronization strategy of the local server, and record the commit breakpoint as ;

[0057] S53, write log data, and read transaction data from the transaction queue in order;

[0058] S54, the disaster recovery server submits the transaction in sequence according to the SCN number of the transaction data, and the submission point is recorded as ;

[0059] S55. During the transaction writing process, the transaction data is checked for integrity, and the check result is recorded as , Express agreement, Indicates inconsistency;

[0060] S56. After the transaction is written, the disaster recovery server updates the control node of the local log buffer pool, records the current write position and the remaining log data, and prepares for the writing of the next transaction.

[0061] S57, clearing outdated log data. After each transaction is written, the disaster recovery server clears outdated log data to release storage space in the log buffer pool.

[0062] S58, update the commit breakpoint, update the commit breakpoint of the standby database through the data synchronization strategy, and record the commit breakpoint as , and record the end position of the current transaction.

[0063] Optionally, the S52 specifically includes:

[0064] S521, the local server starts the data synchronization strategy mechanism, first obtains the current system timestamp, recorded as , marking the start time of data synchronization;

[0065] S522, read the commit breakpoint of the standby database through the synchronization strategy module, and the commit breakpoint is recorded as , determine the end position of the last transaction synchronization;

[0066] S523, the synchronization strategy module submits the breakpoint And the starting SCN number of the current transaction Calculate the number of transactions that need to be synchronized, denoted as , and its calculation formula is:

[0067] ;

[0068] in, The synchronization strategy module is based on the commit breakpoint, The starting SCN number of the current transaction, k represents the total number of transactions;

[0069] S524, the synchronization strategy module adopts a dynamic adjustment mechanism based on a time window to determine the batch size of synchronization according to the number of transactions and the system load, denoted as , and its calculation formula is:

[0070] ;

[0071] in, is the size of the time window, is the maximum batch size allowed by the system, is the time interval for synchronization operations, Calculate the number of transactions that need to be synchronized. W represents the weight factor, which is used to adjust the batch size of the calculation.

[0072] S525. In order to optimize the synchronization strategy, the synchronization strategy module is dynamically adjusted according to the current system load and transaction processing time. The specific adjustment formula is:

[0073] ;

[0074] in, is the adjusted batch size, is the adjustment factor, is the current batch processing time, is the average processing time;

[0075] S526, the synchronization strategy module calculates the batch size , synchronize the transaction queue in batches, and the number of transactions in each batch is ;

[0076] S527, after each batch synchronization is completed, the synchronization strategy module records the end position of the current batch and updates the submission breakpoint .

[0077] Optionally, the S6 specifically includes:

[0078] S61. After the disaster recovery operation is completed, the disaster recovery server starts a consistency check module to perform a consistency check on the data in the standby database.

[0079] S62: The consistency check module first obtains all the submitted transactions in the standby database. The number range is denoted as ,in, , is the minimum commit Number, Maximum submission Number;

[0080] S63, the consistency check module reads the corresponding data from the log buffer pool and the standby database Log data of the number range is recorded as ,in, for A collection of log data within a certain range;

[0081] S64, the consistency check module compares the data in the standby database with the log data. The main content of the comparison includes the execution results of the data definition language and data operation language operations, and generates a comparison report, which is recorded as ;

[0082] The S65 consistency check module compares the data definition language operation results in the standby machine database with the data definition language operation records in the log data;

[0083] S66. The consistency check module compares the data operation language operation results in the standby database with the data operation language operation records in the log data, and checks the matching degree of the data consistency:

[0084] ;

[0085] in, is the data matching degree, is the number of transactions, Transaction in the source database data, Transactions in the standby database data;

[0086] S67. During the verification process, when the consistency verification module finds that the data in the standby database is inconsistent with the data in the source database, the consistency repair module repairs the data. The repair method includes re-executing the inconsistent transaction and adjusting the transaction order.

[0087] S68. After the verification is completed, the consistency verification module generates a verification report, recording the start time, end time, result of the consistency verification, existing inconsistencies and repair status.

[0088] Optionally, an automatic active-active disaster recovery device for an ORACLE database includes the following modules:

[0089] Log buffer pool construction module: Apply for a memory space of the same size as the target database buffer as the log buffer pool, divide the buffer pool into sub-page spaces of a predetermined size, and establish a one-way pointer linked list for each sub-page, dynamically increase or decrease the number of nodes in each pointer linked list, and realize the construction of a dynamic log buffer pool;

[0090] Log capture module: reads the Redo log files of the target database in the production system, finds the SCN breakpoint of the last analysis, loads the captured log files into the log buffer pool, and sorts the Redo log and archive log files according to the SCN number sequence;

[0091] Log parsing module: In the log buffer pool, a log file parser is used to parse the data definition language and data operation language according to the transaction main line, and the parsed data definition language and data operation language are written into the data file in the form of transactions;

[0092] Data transmission module: monitors data changes in the log buffer pool, triggers the transmission process, pushes log buffer data to the disaster recovery server from the last breakpoint, and the disaster recovery server receives the data and writes it to the local log buffer pool, updating the local transmission breakpoint;

[0093] Transaction sorting and synchronization module: sorts the log data received by the local log buffer pool in order according to the transaction sequence to generate a transaction queue, reads the standby data commit breakpoint through the data synchronization strategy of the local server, writes the transaction to the standby database and cleans up outdated log data;

[0094] Consistency check module: After the disaster recovery operation is completed, the data in the standby database is checked for consistency and a check report is generated, recording the start time, end time, consistency check results, existing inconsistencies and repair status of the check.

[0095] Optionally, an automatic active-active disaster recovery storage medium for an ORACLE database includes the following steps:

[0096] Build a log buffer pool: Apply for a memory space of the same size as the target database buffer as the log buffer pool, divide the buffer pool into sub-page spaces of a predetermined size, and establish a one-way pointer linked list for each sub-page, dynamically increasing or decreasing the number of nodes in each pointer linked list;

[0097] Get the target database log file: read the target database's Redo log file, find the last parsed SCN breakpoint, load the captured log file into the log buffer pool, and sort the Redo log and archive log files in SCN order;

[0098] Loading the log parsing module: using the log file parser in the log buffer pool to parse the data definition language and the data operation language, and writing the parsed data definition language and data operation language into the data file in the form of transactions;

[0099] Transmitting data files: Monitor data changes in the log buffer pool, push log buffer data to the disaster recovery server starting from the last breakpoint, and the disaster recovery server receives the data and writes it to the local log buffer pool, updating the local transmission breakpoint;

[0100] Sorting and synchronizing transaction data: Sort the log data according to the transaction sequence to generate a transaction queue, read the commit breakpoint of the standby database through the data synchronization strategy, write the transaction to the standby database and clean up the outdated log data;

[0101] Consistency check: After the disaster recovery operation is completed, the data in the standby database is checked for consistency, and a verification report is generated to record the consistency check results and repair status.

[0102] The beneficial effects of the present invention are:

[0103] The active-active disaster recovery technology provided by the present invention can ensure that the database of the disaster recovery center is always active and verify the validity of the data at any time. Due to the adoption of "transaction-level" data push technology, the data synchronization of the primary and standby databases is achieved in seconds; the cross-platform logical synchronization technology is adopted, which is independent of the storage architecture and operating system, and realizes high real-time cross-platform database synchronization.

[0104] Based on the above, the present invention has good application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0105] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0106] Figure 1 This is a system architecture diagram of an automatic active-active disaster recovery method for ORACLE database proposed in the present invention, showing the overall process of log buffer pool construction, log file acquisition, log parsing module loading, data transmission and result consistency verification.

[0107] Figure 2 This is a detailed flow chart of the log parsing module in the automatic active-active disaster recovery method for ORACLE database proposed by the present invention, which shows the splitting of log files, online principal component analysis, application of the minimum description length principle, and the rapid positioning process of key positions of DDL and DML operations.

[0108] Figure 3 This is a flowchart of data transmission and consistency verification in an automatic active-active disaster recovery method for ORACLE database proposed by the present invention, showing the detailed process of data-aware control triggering transmission module, data file transmission, disaster recovery server reception, data decryption and consistency verification, and verification result report generation. DETAILED DESCRIPTION

[0109] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.

[0110] refer to Figure 1 , an automatic active-active disaster recovery method, device and storage medium for an ORACLE database, comprising the following steps:

[0111] S1. Build a log buffer pool. Apply for a memory space of the same size as the target database buffer as the log buffer pool. Divide the buffer pool into subpage spaces of a predetermined size. Create a one-way pointer linked list for each subpage. When managing the buffer, dynamically increase or decrease the number of nodes in each pointer linked list as needed to achieve the construction of a dynamic log buffer pool.

[0112] In this implementation, S1 specifically includes:

[0113] S11. Apply for a memory space of the same size as the target database buffer as the log buffer pool. :

[0114] ;

[0115] in, is the number of pages of the target database buffer. is the size of each page;

[0116] S12, divide the log buffer pool into sub-page spaces of a predetermined size, the size of the sub-page space is , , and establish a one-way pointer linked list for each sub-page space, where S represents the actual sub-page space size;

[0117] S13, when managing the log buffer pool, dynamically increase or decrease the number of nodes in each pointer linked list as needed to adapt to different memory requirements and log data volumes;

[0118] S14. A control node is set up in each subpage space of the log buffer pool to record the usage status of the current subpage, including the used space and the remaining space;

[0119] S15. Each subpage space is connected through a one-way pointer linked list. The nodes of the pointer linked list include the start address and the end address of the subpage, so as to quickly locate and access the log data.

[0120] S16, the construction process of the dynamic log buffer pool includes the allocation and release of subpage space. The allocation of subpage space is performed according to the principle of free first and then use. The release of subpage space is recycled according to the processing status of log data.

[0121] S17, when the log data is written into the log buffer pool, the write position of the log data and the remaining space of the current subpage are recorded in real time by updating the control node of the subpage space;

[0122] S18: When log data needs to be read from the log buffer pool, the log data in each sub-page space is read in sequence by traversing the one-way pointer linked list.

[0123] S2. Obtain the target database log file. The capture module reads the Redolog of the target database in the production system, finds the SCN breakpoint of the last analysis, and loads the captured log file into the log buffer pool constructed in step 1.

[0124] In this implementation, S2 specifically includes:

[0125] S21. The capture module reads the Redo log file of the target database in the production system. The Redo log file contains multiple log groups. ,in, , is the number of log groups;

[0126] S22. Find the last parsed system change number breakpoint in the Redo log file and record it as ,in, For the last analysis Breakpoints;

[0127] S23, when not found in the Redo log file group When a breakpoint occurs, the archive log is traced back and the archive log file is recorded as ,in, , Is the number of archived log files;

[0128] S24, load the captured redo log and archive log files into the log buffer pool constructed in S1, and write the log files into the subpage space in sequence;

[0129] S25, the capture module is based on Sort the Redo log and archive log files in order and record the start and end points of each log file. Number and termination Number, respectively and ;

[0130] S26, when the capture module reads the log file, it determines the type, size, and start point of the current log file by parsing the log file header information. Number and termination Number;

[0131] S27, the capture module loads the read log file data into the subpage space of the log buffer pool in blocks, and the size of each log block is ,in, ;

[0132] S28. After the log data is loaded into the log buffer pool, the capture module updates the control node of the log buffer pool in real time and records the current write position and remaining space.

[0133] S3, load the log parsing module, use the log file parser in the log buffer pool to parse the data definition language and data operation language according to the transaction main line, and write the parsed data definition language and data operation language into the data file in the transaction unit;

[0134] In this implementation, S3 specifically includes:

[0135] S31, using a log file parser in the log buffer pool, the log file parser is responsible for reading the log data in the log buffer pool, and parsing the data definition language and data operation language operations according to the transaction main line;

[0136] S32. The log file parser parses the log file according to the transaction main line, determines the starting point and end point of the transaction, and records the unique identifier of each transaction. ,in, , is the number of transactions;

[0137] S33, constructing log multidimensional time series data, splitting the log file into multidimensional time series data according to the log file timestamp, and vectorizing the data file using its own hexadecimal data;

[0138] S34, online principal component analysis, converting newly acquired data into principal components after each update, using the mean obtained from the most recent calculation point and the variance-covariance matrix , the principal components are calculated by the following formula:

[0139] ;

[0140] in, The main component, is the number of principal components, represents the mean vector of the data set, Each element of is the mean of the corresponding variable over all observations, represents the square root matrix of the inverse of the covariance matrix, represents the observation vector of the jth data point, This term centers the data by subtracting the mean vector from each observation, essentially shifting the data so that the mean of the data is zero;

[0141] S35, using the minimum description length principle to determine the subject length, applying the minimum description length principle to the obtained subject data string, and calculating the description length :

[0142] ;

[0143] in, is the data point in the subject data string, is the probability of the data point. This formula is used to intercept the operation information of the data definition language and the data operation language, remove the noise information, and record it as ;

[0144] S36, locate the key position of the data definition language and the data operation language operation, locate the key position of the data definition language and the data operation language operation according to the operation information of the intercepted data definition language and the data operation language, and the key position is recorded as and ;

[0145] S37, when the log file parser parses the data definition language operation, it identifies the CREATE, ALTER, and DROP data definition language statements and records the relevant metadata changes. The parsed data definition language operation is stored in the data definition language buffer, which is recorded as ;

[0146] S38. When the log file parser parses the data operation language operation, it identifies the INSERT, UPDATE, and DELETE data operation language statements and records the relevant data changes. The parsed data operation language operation is stored in the data operation language buffer, which is recorded as .

[0147] S4: Transmit data files. The data-aware control triggers the transmission module to push log buffer data to the disaster recovery server starting from the last breakpoint. The disaster recovery server receives the data and writes it into the local log buffer pool, and updates the local transmission breakpoint.

[0148] In this implementation, S4 specifically includes:

[0149] S41, the data sensing control monitors the data changes in the log buffer pool, and when new log data is detected to be written, triggers the transmission module to start the data transmission process;

[0150] S42, the transmission module starts reading the log data in the log buffer pool from the last breakpoint, and the starting position of the reading is the end position of the last transmission, which is recorded as , the current reading position is recorded as ;

[0151] S43, the transmission module packages the read log data blocks according to the transaction unit, and the size of each data packet is recorded as ,in, Not exceeding the size of the subpage space;

[0152] S44, transmitting the packaged log data to the disaster recovery server through the network, and using the TLS protocol to encrypt the data during the transmission process;

[0153] S45, the disaster recovery server receives the transmitted log data packet and records the current receiving position as , and write the log data packets into the local log buffer pool in sequence, and update the local transmission breakpoint;

[0154] S46. After receiving the data, the disaster recovery server unpacks the received log data and sorts them according to the transaction sequence.

[0155] S47, the disaster recovery server performs consistency verification on the received log data through the verification module, generates a data digest using the SHA-256 algorithm, and compares it with the data digest before transmission;

[0156] S48. After the transmission module completes the data transmission, the control node of the source end log buffer pool updates the current transmission position and the remaining log data to prepare for the next data transmission.

[0157] S5. The local log buffer pool sorts the received log data in order according to the transaction sequence to generate a transaction queue, reads the standby data commit breakpoint through the data synchronization strategy of the local server, writes the transaction to the standby database and cleans up the outdated log data;

[0158] In this implementation, S5 specifically includes:

[0159] S51, generating a transaction queue, the local log buffer pool sorts the received log data in order according to the transaction sequence, and generates a transaction queue;

[0160] S52, start the synchronization strategy mechanism, read the commit breakpoint of the standby database through the data synchronization strategy of the local server, and record the commit breakpoint as ;

[0161] S53, write log data, and read transaction data from the transaction queue in order;

[0162] S54, the disaster recovery server submits the transaction in sequence according to the SCN number of the transaction data, and the submission point is recorded as ;

[0163] S55. During the transaction writing process, the transaction data is checked for integrity, and the check result is recorded as , Express agreement, Indicates inconsistency;

[0164] S56. After the transaction is written, the disaster recovery server updates the control node of the local log buffer pool, records the current write position and the remaining log data, and prepares for the writing of the next transaction.

[0165] S57, clearing outdated log data. After each transaction is written, the disaster recovery server clears outdated log data to release storage space in the log buffer pool.

[0166] S58, update the commit breakpoint, update the commit breakpoint of the standby database through the data synchronization strategy, and record the commit breakpoint as , and record the end position of the current transaction.

[0167] S52, start the synchronization strategy mechanism, read the commit breakpoint of the standby database through the data synchronization strategy of the local server, and record the commit breakpoint as ;

[0168] In this implementation, S52 specifically includes:

[0169] S521, the local server starts the data synchronization strategy mechanism, first obtains the current system timestamp, recorded as , marking the start time of data synchronization;

[0170] S522, read the commit breakpoint of the standby database through the synchronization strategy module, and the commit breakpoint is recorded as , determine the end position of the last transaction synchronization;

[0171] S523, the synchronization strategy module submits the breakpoint And the starting SCN number of the current transaction Calculate the number of transactions that need to be synchronized, denoted as , and its calculation formula is:

[0172] ;

[0173] in, The synchronization strategy module is based on the commit breakpoint, The starting SCN number of the current transaction, k represents the total number of transactions;

[0174] S524, the synchronization strategy module adopts a dynamic adjustment mechanism based on a time window to determine the batch size of synchronization according to the number of transactions and the system load, denoted as , and its calculation formula is:

[0175] ;

[0176] in, is the size of the time window, is the maximum batch size allowed by the system, is the time interval for synchronization operations, Calculate the number of transactions that need to be synchronized. W represents the weight factor, which is used to adjust the batch size of the calculation.

[0177] S525. In order to optimize the synchronization strategy, the synchronization strategy module is dynamically adjusted according to the current system load and transaction processing time. The specific adjustment formula is:

[0178] ;

[0179] in, is the adjusted batch size, is the adjustment factor, is the current batch processing time, is the average processing time;

[0180] S526, the synchronization strategy module calculates the batch size , synchronize the transaction queue in batches, and the number of transactions in each batch is ;

[0181] S527, after each batch synchronization is completed, the synchronization strategy module records the end position of the current batch and updates the submission breakpoint .

[0182] S6: Result consistency check: The verification module completes the result consistency check after the disaster recovery is completed.

[0183] In this implementation, S6 specifically includes:

[0184] S61. After the disaster recovery operation is completed, the disaster recovery server starts a consistency check module to perform a consistency check on the data in the standby database.

[0185] S62: The consistency check module first obtains all the submitted transactions in the standby database. The number range is denoted as ,in, , is the minimum commit Number, Maximum submission Number;

[0186] S63, the consistency check module reads the corresponding data from the log buffer pool and the standby database Log data of the number range is recorded as ,in, for A collection of log data within a certain range;

[0187] S64, the consistency check module compares the data in the standby database with the log data. The main content of the comparison includes the execution results of the data definition language and data operation language operations, and generates a comparison report, which is recorded as ;

[0188] The S65 consistency check module compares the data definition language operation results in the standby machine database with the data definition language operation records in the log data;

[0189] S66. The consistency check module compares the data operation language operation results in the standby database with the data operation language operation records in the log data, and checks the matching degree of the data consistency:

[0190] ;

[0191] in, is the data matching degree, is the number of transactions, Transaction in the source database data, Transactions in the standby database data;

[0192] S67. During the verification process, when the consistency verification module finds that the data in the standby database is inconsistent with the data in the source database, the consistency repair module repairs the data. The repair method includes re-executing the inconsistent transaction and adjusting the transaction order.

[0193] S68. After the verification is completed, the consistency verification module generates a verification report, recording the start time, end time, result of the consistency verification, existing inconsistencies and repair status.

[0194] In this embodiment, an automatic active-active disaster recovery device for an ORACLE database includes the following modules:

[0195] Log buffer pool construction module: Apply for a memory space of the same size as the target database buffer as the log buffer pool, divide the buffer pool into sub-page spaces of a predetermined size, and establish a one-way pointer linked list for each sub-page, dynamically increase or decrease the number of nodes in each pointer linked list, and realize the construction of a dynamic log buffer pool;

[0196] Log capture module: reads the Redo log files of the target database in the production system, finds the SCN breakpoint of the last analysis, loads the captured log files into the log buffer pool, and sorts the Redo log and archive log files according to the SCN number sequence;

[0197] Log parsing module: In the log buffer pool, a log file parser is used to parse the data definition language and data operation language according to the transaction main line, and the parsed data definition language and data operation language are written into the data file in the form of transactions;

[0198] Data transmission module: monitors data changes in the log buffer pool, triggers the transmission process, pushes log buffer data to the disaster recovery server from the last breakpoint, and the disaster recovery server receives the data and writes it to the local log buffer pool, updating the local transmission breakpoint;

[0199] Transaction sorting and synchronization module: sorts the log data received by the local log buffer pool in order according to the transaction sequence to generate a transaction queue, reads the standby data commit breakpoint through the data synchronization strategy of the local server, writes the transaction to the standby database and cleans up outdated log data;

[0200] Consistency check module: After the disaster recovery operation is completed, the data in the standby database is checked for consistency and a check report is generated, recording the start time, end time, consistency check results, existing inconsistencies and repair status of the check.

[0201] In this embodiment, an automatic active-active disaster recovery storage medium for an ORACLE database includes the following steps:

[0202] Build a log buffer pool: Apply for a memory space of the same size as the target database buffer as the log buffer pool, divide the buffer pool into sub-page spaces of a predetermined size, and establish a one-way pointer linked list for each sub-page, dynamically increasing or decreasing the number of nodes in each pointer linked list;

[0203] Get the target database log file: read the target database's Redo log file, find the last parsed SCN breakpoint, load the captured log file into the log buffer pool, and sort the Redo log and archive log files in SCN order;

[0204] Loading the log parsing module: using the log file parser in the log buffer pool to parse the data definition language and the data operation language, and writing the parsed data definition language and data operation language into the data file in the form of transactions;

[0205] Transmitting data files: Monitor data changes in the log buffer pool, push log buffer data to the disaster recovery server starting from the last breakpoint, and the disaster recovery server receives the data and writes it to the local log buffer pool, updating the local transmission breakpoint;

[0206] Sorting and synchronizing transaction data: Sort the log data according to the transaction sequence to generate a transaction queue, read the commit breakpoint of the standby database through the data synchronization strategy, write the transaction to the standby database and clean up the outdated log data;

[0207] Consistency check: After the disaster recovery operation is completed, the data in the standby database is checked for consistency, and a verification report is generated to record the consistency check results and repair status.

[0208] Embodiment 1:

[0209] The embodiment of the present invention provides an automatic active-active disaster recovery method, device and storage medium for an ORACLE database, which automatically and in real time parses the REDO log and ARCH log in the target database (ORACLE), obtains the DML and DDL operations in the production database, and then synchronizes these operations to the disaster recovery database to achieve disaster recovery. The embodiment of the present invention adopts "transaction-level" data push technology to achieve second-level data synchronization of the primary and standby databases, and achieves highly real-time and efficient cross-platform database synchronization.

[0210] The embodiment of the present invention mainly includes four parts: a capture module, a log parsing module, a transmission module, a submission module and a verification module.

[0211] Combine the following Figure 1 The automatic active-active disaster recovery method of the ORACLE database provided by the present invention is described. The method can be used in scenarios such as real-time automatic active-active disaster recovery of the ORACLE database, and this embodiment does not specifically limit this.

[0212] like Figure 1 As shown, the automatic active-active disaster recovery method, device and storage medium of the ORACLE database provided in this embodiment include the following steps:

[0213] Step S101, constructing a dynamic log buffer pool.

[0214] The embodiment of the present invention first applies for a memory space of the same size as the target database buffer pool as a log buffer pool, and divides the buffer pool into sub-page spaces of a predetermined size, each sub-page space representing a data buffer zone; further, a one-way pointer linked list is established for each sub-page, and when managing the buffer zone, the number of nodes in each pointer linked list can be dynamically increased or decreased as needed, thereby realizing the construction of a dynamic log buffer pool.

[0215] Step S102, obtaining the target database log file.

[0216] Step S103, loading the log parsing module.

[0217] In the log buffer pool, a log file parser is used to parse DDL and DML operations according to the main line of the transaction; further, the parsed DDL and DML are written and output to the data file in the form of transactions.

[0218] The embodiment of the present invention also discloses an online high-speed log analysis method, such as Figure 2As shown, it mainly includes the following steps:

[0219] S201: Constructing log multi-dimensional time series data. The embodiment of the present invention splits the log file into multi-dimensional time series data according to the log file timestamp, and uses its own hexadecimal data to vectorize the data file.

[0220] S202: Online principal component analysis. The embodiment of the present invention needs to convert the newly acquired data into principal components after each update. Therefore, in order to consider the efficiency of online processing, the embodiment of the present invention uses the mean and variance-covariance matrix data obtained from the most recent calculation point to calculate the principal components of the crime.

[0221] S203: Determine the topic length using the minimum description length principle. Further, apply the minimum description length principle to the obtained topic data string, intercept the DDL and DML operation information, and remove the noise information.

[0222] S204: Quickly locate the key positions of DDL and DML operations. Further, based on the intercepted DDL and DML operation information, quickly locate the key positions of DDL and DML operations.

[0223] Step S104, transmitting data files.

[0224] The embodiment of the present invention triggers the transmission module through the data-aware control, and "pushes" the log buffer data to the disaster recovery server from the last breakpoint; further, the disaster recovery server receives the data and writes it into the local log buffer pool, and updates the local transmission breakpoint. Furthermore, it verifies whether the transmitted data files are consistent.

[0225] Step S105, writing updated data.

[0226] The embodiment of the present invention also discloses an online high-speed log analysis method, such as Figure 3 As shown, it mainly includes the following steps:

[0227] S501: Generate a transaction queue. The local log buffer pool sorts the received log data in order according to the transaction sequence to generate a transaction queue.

[0228] S502: Start the synchronization strategy mechanism. Further, read the standby machine data submission breakpoint through the data synchronization strategy of the local server.

[0229] S503: Write log data. Further write the transaction into the standby database.

[0230] S504: Clear outdated log data.

[0231] Step S106, result consistency check.

[0232] The verification module completes the result consistency data after the disaster recovery is completed to ensure that the backup machine data is correct.

[0233] The steps of the method or algorithm described in conjunction with the embodiments disclosed in the present invention can be implemented directly by hardware, software modules executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0234] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined in the present invention may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0235] Embodiment 2:

[0236] In the key business systems of modern enterprises, the real-time and reliability of data are of vital importance. However, the traditional single database architecture cannot meet the requirements of high availability and high reliability, especially when a disaster occurs, data loss or service interruption will have a serious impact on the business of the enterprise. In order to solve this problem, the present invention provides an automatic active-active disaster recovery method for ORACLE database, which ensures the second-level data synchronization and consistency of the primary and standby databases by constructing a dynamic log buffer pool, acquiring and parsing REDO logs and ARCH logs in real time, extracting DDL and DML operations, and transmitting and synchronizing to the disaster recovery database in units of transactions.

[0237] Scenario description:

[0238] In March 2024, the core transaction system of a large bank uses ORACLE database for data management. The bank is headquartered in A, with branches all over the country. High availability and data consistency are one of the key requirements of the bank. In order to ensure business continuity when a disaster occurs, the bank decides to use the automatic active-active disaster recovery method of the present invention to build a high-real-time and high-reliability active-active disaster recovery system.

[0239] Application scenarios:

[0240] In actual applications, the core transaction system of a bank processes a large amount of transaction data every day, involving a large number of DDL and DML operations. The main database server of the bank headquarters is located in the data center of A, and the disaster recovery database server is located in the data center of B. Using the automatic active-active disaster recovery method of the present invention, a dynamic log buffer pool is first constructed between the main database and the backup database. The size of the log buffer pool is consistent with the buffer size of the target database, and through the dynamic management of the subpage space, the memory usage efficiency and system performance are improved.

[0241] Whenever the master database generates new REDO logs and ARCH logs, the capture module reads these log files in real time and loads them into the log buffer pool. Through the log file parser, the system can parse all DDL and DML operations according to the transaction main line and output these operations into data files in units of transactions.

[0242] During the data transmission process, the data-aware control triggers the transmission module to push the data in the log buffer pool to the disaster recovery server in units of transactions starting from the last breakpoint. After receiving the data, the disaster recovery server will update the local log buffer pool in real time and perform data consistency verification. After the disaster recovery is completed, the verification module completes the data consistency verification between the primary and backup databases to ensure the accuracy and integrity of the data.

[0243]

[0244]

[0245] Referring to the above table, in a performance test in March 2024, the main database of the bank's core transaction system generated about 500MB of log data per minute. After adopting the automatic active-active disaster recovery method of the present invention, the system can synchronize these log data to the standby database within seconds. The specific test results are as follows:

[0246] Test location: Bank A’s headquarters data center

[0247] Testing time: March 15, 2024 to March 20, 2024

[0248] Average data transmission delay: 1.5 seconds

[0249] Data consistency verification success rate: 100%

[0250] System CPU usage: 70%

[0251] Memory usage: 80%

[0252] In a disaster recovery drill conducted on March 21, 2024, the system simulated a primary database failure, and the standby database was able to take over the business within 3 seconds, ensuring business continuity. The specific test results are as follows:

[0253] Drill location: B disaster recovery data center

[0254] Exercise time: March 21, 2024

[0255] Data transfer time: 2 seconds

[0256] Standby database takeover time: 3 seconds

[0257] Data consistency verification success rate: 100%

[0258] Through the construction of multi-dimensional time series data of log files and online principal component analysis, the system can quickly locate the key positions of DDL and DML operations, improving the efficiency of log parsing and data synchronization.

[0259] Beneficial effects:

[0260] 1. Dynamic log buffer pool management implements flexible memory management, improves system performance and resource utilization efficiency, and adapts to database environments of different sizes and loads.

[0261] 2. Transaction-level log parsing and synchronization ensure the accuracy and integrity of log data, achieve second-level synchronization of primary and standby databases, and ensure the real-time and consistency of data.

[0262] 3. Online high-speed log analysis uses principal component analysis and the minimum description length principle to quickly locate the key positions of DDL and DML operations, improving the efficiency and accuracy of log analysis.

[0263] 4. Efficient transmission and consistency check of data files The transmission module is triggered by the data-aware control to achieve efficient transmission of log buffer data, and a data consistency check is performed after the disaster recovery server receives the data to ensure data synchronization and consistency between the primary and standby databases.

[0264] Summarize:

[0265] By applying the automatic active-active disaster recovery method of the present invention, the core transaction system of the bank realizes an active-active disaster recovery architecture with high real-time performance and high reliability, ensuring the continuity of key services and the security of data. In practical applications, the system has demonstrated excellent performance and stability, significantly improving the business continuity and disaster recovery capabilities of the enterprise. This method is not only applicable to banking systems, but can also be widely used in other enterprise-level database systems that have high requirements for data real-time performance and reliability.

[0266] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. An automatic active-active disaster recovery method for an ORACLE database, characterized in that: The steps include: S1. Build a log buffer pool. Apply for a memory space of the same size as the target database buffer as the log buffer pool. Divide the buffer pool into subpage spaces of a predetermined size. Create a one-way pointer linked list for each subpage. When managing the buffer, dynamically increase or decrease the number of nodes in each pointer linked list as needed to achieve the construction of a dynamic log buffer pool. S2. Obtain the target database log file. The capture module reads the Redo log of the target database in the production system, finds the SCN breakpoint of the last analysis, and loads the captured log file into the log buffer pool constructed in step 1. S3, load the log parsing module, use the log file parser in the log buffer pool to parse the data definition language and data operation language according to the transaction main line, and write the parsed data definition language and data operation language into the data file in the transaction unit; S4: Transmit data files. The data-aware control triggers the transmission module to push log buffer data to the disaster recovery server starting from the last breakpoint. The disaster recovery server receives the data and writes it into the local log buffer pool, and updates the local transmission breakpoint. S5. The local log buffer pool sorts the received log data in order according to the transaction sequence to generate a transaction queue, reads the standby data commit breakpoint through the data synchronization strategy of the local server, writes the transaction to the standby database and cleans up the outdated log data; S6: Result consistency check: The verification module completes the result consistency check after the disaster recovery is completed.

2. The automatic active-active disaster recovery method of an ORACLE database according to claim 1, characterized in that: The S1 specifically includes: S11. Apply for a memory space of the same size as the target database buffer as the log buffer pool. : ; in, is the number of pages of the target database buffer. is the size of each page; S12, divide the log buffer pool into sub-page spaces of a predetermined size, the size of the sub-page space is , , and establish a one-way pointer linked list for each sub-page space, where S represents the actual sub-page space size; S13, when managing the log buffer pool, dynamically increase or decrease the number of nodes in each pointer linked list as needed to adapt to different memory requirements and log data volumes; S14. A control node is set up in each subpage space of the log buffer pool to record the usage status of the current subpage, including the used space and the remaining space; S15. Each subpage space is connected through a one-way pointer linked list. The nodes of the pointer linked list include the start address and the end address of the subpage, so as to quickly locate and access the log data. S16, the construction process of the dynamic log buffer pool includes the allocation and release of subpage space. The allocation of subpage space is performed according to the principle of free first and then use. The release of subpage space is recycled according to the processing status of log data. S17, when the log data is written into the log buffer pool, the write position of the log data and the remaining space of the current subpage are recorded in real time by updating the control node of the subpage space; S18: When log data needs to be read from the log buffer pool, the log data in each sub-page space is read in sequence by traversing the one-way pointer linked list.

3. The automatic active-active disaster recovery method of an ORACLE database according to claim 1, characterized in that: The S2 specifically includes: S21. The capture module reads the Redo log file of the target database in the production system. The Redo log file contains multiple log groups. ,in, , is the number of log groups; S22. Find the last parsed system change number breakpoint in the Redo log file and record it as ,in, For the last analysis Breakpoints; S23, when not found in the Redo log file group When a breakpoint occurs, the archive log is traced back and the archive log file is recorded as ,in, , Is the number of archived log files; S24, load the captured redo log and archive log files into the log buffer pool constructed in S1, and write the log files into the subpage space in sequence; S25, the capture module is based on Sort the Redo log and archive log files in order and record the start and end points of each log file. Number and termination Numbers, respectively and ; S26, when the capture module reads the log file, it determines the type, size, and start point of the current log file by parsing the log file header information. Number and termination Number; S27, the capture module loads the read log file data into the subpage space of the log buffer pool in blocks, and the size of each log block is ,in, ; S28. After the log data is loaded into the log buffer pool, the capture module updates the control node of the log buffer pool in real time and records the current write position and remaining space.

4. The automatic active-active disaster recovery method of an ORACLE database according to claim 1, characterized in that: The S3 specifically includes: S31, using a log file parser in the log buffer pool, the log file parser is responsible for reading the log data in the log buffer pool, and parsing the data definition language and data operation language operations according to the transaction main line; S32. The log file parser parses the log file according to the transaction main line, determines the starting point and end point of the transaction, and records the unique identifier of each transaction. ,in, , is the number of transactions; S33, constructing log multidimensional time series data, splitting the log file into multidimensional time series data according to the log file timestamp, and vectorizing the data file using its own hexadecimal data; S34, online principal component analysis, converting newly acquired data into principal components after each update, using the mean obtained from the most recent calculation point and the variance-covariance matrix , the principal components are calculated by the following formula: ; in, The main component, is the number of principal components, represents the mean vector of the data set, Each element of is the mean of the corresponding variable over all observations, represents the square root matrix of the inverse of the covariance matrix, represents the observation vector of the jth data point, This term centers the data by subtracting the mean vector from each observation, essentially shifting the data so that the mean of the data is zero; S35, using the minimum description length principle to determine the subject length, applying the minimum description length principle to the obtained subject data string, and calculating the description length : ; in, is the data point in the subject data string, is the probability of the data point. This formula is used to intercept the operation information of the data definition language and the data operation language, remove the noise information, and record it as ; S36, locate the key position of the data definition language and the data operation language operation, locate the key position of the data definition language and the data operation language operation according to the operation information of the intercepted data definition language and the data operation language, and record the key position as and ; S37, when the log file parser parses the data definition language operation, it identifies the CREATE, ALTER, and DROP data definition language statements and records the relevant metadata changes. The parsed data definition language operation is stored in the data definition language buffer, which is recorded as ; S38. When the log file parser parses the data operation language operation, it identifies the INSERT, UPDATE, and DELETE data operation language statements and records the relevant data changes. The parsed data operation language operation is stored in the data operation language buffer, which is recorded as .

5. The automatic active-active disaster recovery method of an ORACLE database according to claim 1, characterized in that: The S4 specifically includes: S41, the data sensing control monitors the data changes in the log buffer pool, and when new log data is detected to be written, triggers the transmission module to start the data transmission process; S42, the transmission module starts reading the log data in the log buffer pool from the last breakpoint, and the starting position of the reading is the end position of the last transmission, which is recorded as , the current reading position is recorded as ; S43, the transmission module packages the read log data blocks according to the transaction unit, and the size of each data packet is recorded as ,in, Not exceeding the size of the subpage space; S44, transmitting the packaged log data to the disaster recovery server through the network, and using the TLS protocol to encrypt the data during the transmission process; S45, the disaster recovery server receives the transmitted log data packet and records the current receiving position as , and write the log data packets into the local log buffer pool in sequence, and update the local transmission breakpoint; S46. After receiving the data, the disaster recovery server unpacks the received log data and sorts them according to the transaction sequence. S47, the disaster recovery server performs consistency verification on the received log data through the verification module, generates a data digest using the SHA-256 algorithm, and compares it with the data digest before transmission; S48. After the transmission module completes the data transmission, the control node of the source end log buffer pool updates the current transmission position and the remaining log data to prepare for the next data transmission.

6. The automatic active-active disaster recovery method of an ORACLE database according to claim 1, characterized in that: The S5 specifically includes: S51, generating a transaction queue, the local log buffer pool sorts the received log data in order according to the transaction sequence, and generates a transaction queue; S52, start the synchronization strategy mechanism, read the commit breakpoint of the standby database through the data synchronization strategy of the local server, and record the commit breakpoint as ; S53, write log data, and read transaction data from the transaction queue in order; S54, the disaster recovery server submits the transaction in sequence according to the SCN number of the transaction data, and the submission point is recorded as ; S55. During the transaction writing process, the transaction data is checked for integrity, and the check result is recorded as , Express agreement, Indicates inconsistency; S56. After the transaction is written, the disaster recovery server updates the control node of the local log buffer pool, records the current write position and the remaining log data, and prepares for the writing of the next transaction. S57, clearing outdated log data. After each transaction is written, the disaster recovery server clears outdated log data to release storage space in the log buffer pool. S58, update the commit breakpoint, update the commit breakpoint of the standby database through the data synchronization strategy, and record the commit breakpoint as , and record the end position of the current transaction.

7. The automatic active-active disaster recovery method of an ORACLE database according to claim 6, characterized in that: The S52 specifically includes: S521, the local server starts the data synchronization strategy mechanism, first obtains the current system timestamp, recorded as , marking the start time of data synchronization; S522, read the commit breakpoint of the standby database through the synchronization strategy module, and the commit breakpoint is recorded as , determine the end position of the last transaction synchronization; S523, the synchronization strategy module submits the breakpoint And the starting SCN number of the current transaction Calculate the number of transactions that need to be synchronized, denoted as , and its calculation formula is: ; in, The synchronization strategy module is based on the commit breakpoint, The starting SCN number of the current transaction, k represents the total number of transactions; S524, the synchronization strategy module adopts a dynamic adjustment mechanism based on a time window to determine the batch size of synchronization according to the number of transactions and the system load, denoted as , and its calculation formula is: ; in, is the size of the time window, is the maximum batch size allowed by the system, is the time interval for synchronization operations, Calculate the number of transactions that need to be synchronized. W represents the weight factor, which is used to adjust the batch size of the calculation. S525. In order to optimize the synchronization strategy, the synchronization strategy module is dynamically adjusted according to the current system load and transaction processing time. The specific adjustment formula is: ; in, is the adjusted batch size, is the adjustment factor, is the current batch processing time, is the average processing time; S526, the synchronization strategy module calculates the batch size , synchronize the transaction queue in batches, and the number of transactions in each batch is ; S527, after each batch synchronization is completed, the synchronization strategy module records the end position of the current batch and updates the submission breakpoint .

8. The automatic active-active disaster recovery method of an ORACLE database according to claim 1, characterized in that: The S6 specifically includes: S61. After the disaster recovery operation is completed, the disaster recovery server starts a consistency check module to perform a consistency check on the data in the standby database. S62: The consistency check module first obtains all the submitted transactions in the standby database. The number range is denoted as ,in, , is the minimum commit Number, Maximum submission Number; S63, the consistency check module reads the corresponding data from the log buffer pool and the standby database Log data of the number range is recorded as ,in, for A collection of log data within a certain range; S64, the consistency check module compares the data in the standby database with the log data. The main content of the comparison includes the execution results of the data definition language and data operation language operations, and generates a comparison report, which is recorded as ; The S65 consistency check module compares the data definition language operation results in the standby machine database with the data definition language operation records in the log data; S66. The consistency check module compares the data operation language operation results in the standby database with the data operation language operation records in the log data, and checks the matching degree of the data consistency: ; in, is the data matching degree, is the number of transactions, Transaction in the source database data, Transactions in the standby database data; S67. During the verification process, when the consistency verification module finds that the data in the standby database is inconsistent with the data in the source database, the consistency repair module repairs the data. The repair method includes re-executing the inconsistent transaction and adjusting the transaction order. S68. After the verification is completed, the consistency verification module generates a verification report, recording the start time, end time, result of the consistency verification, existing inconsistencies and repair status.

9. An automatic active-active disaster recovery device for an ORACLE database, characterized in that: Includes the following modules: Log buffer pool construction module: Apply for a memory space of the same size as the target database buffer as the log buffer pool, divide the buffer pool into sub-page spaces of a predetermined size, and establish a one-way pointer linked list for each sub-page, dynamically increase or decrease the number of nodes in each pointer linked list, and realize the construction of a dynamic log buffer pool; Log capture module: reads the Redo log files of the target database in the production system, finds the SCN breakpoint of the last analysis, loads the captured log files into the log buffer pool, and sorts the Redo log and archive log files according to the SCN number sequence; Log parsing module: In the log buffer pool, a log file parser is used to parse the data definition language and data operation language according to the transaction main line, and the parsed data definition language and data operation language are written into the data file in the form of transactions; Data transmission module: monitors data changes in the log buffer pool, triggers the transmission process, pushes log buffer data to the disaster recovery server from the last breakpoint, and the disaster recovery server receives the data and writes it to the local log buffer pool, updating the local transmission breakpoint; Transaction sorting and synchronization module: sorts the log data received by the local log buffer pool in order according to the transaction sequence to generate a transaction queue, reads the standby data commit breakpoint through the data synchronization strategy of the local server, writes the transaction to the standby database and cleans up outdated log data; Consistency check module: After the disaster recovery operation is completed, the data in the standby database is checked for consistency and a check report is generated, recording the start time, end time, consistency check results, existing inconsistencies and repair status of the check.

10. An automatic active-active disaster recovery storage medium for an ORACLE database, characterized in that: The following steps are involved: Build a log buffer pool: Apply for a memory space of the same size as the target database buffer as the log buffer pool, divide the buffer pool into sub-page spaces of a predetermined size, and establish a one-way pointer linked list for each sub-page, dynamically increasing or decreasing the number of nodes in each pointer linked list; Get the target database log file: read the target database's Redo log file, find the last parsed SCN breakpoint, load the captured log file into the log buffer pool, and sort the Redo log and archive log files in SCN order; Loading the log parsing module: using the log file parser in the log buffer pool to parse the data definition language and the data operation language, and writing the parsed data definition language and data operation language into the data file in the form of transactions; Transmitting data files: Monitor data changes in the log buffer pool, push log buffer data to the disaster recovery server starting from the last breakpoint, and the disaster recovery server receives the data and writes it to the local log buffer pool, updating the local transmission breakpoint; Sorting and synchronizing transaction data: Sort the log data according to the transaction sequence to generate a transaction queue, read the commit breakpoint of the standby database through the data synchronization strategy, write the transaction to the standby database and clean up the outdated log data; Consistency check: After the disaster recovery operation is completed, the data in the standby database is checked for consistency, and a verification report is generated to record the consistency check results and repair status.

Citation Information

Patent Citations

  • Disaster tolerance switching method, system and device

    CN101316184A

  • Method, device and system for data disaster tolerance

    CN101667181A

  • A cross-database data integration system and method based on a 95598 dual-live disaster preparedness model

    CN109446267A

  • Active-active implementation method and device for database

    CN111352766A

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

    CN111427898A