SQL Server database real-time data replication method, device, equipment and medium

By analyzing and executing the transaction log content of the source database in the target database, the problems of data loss and inconsistency in the existing technology are solved, and fast and reliable data synchronization and consistency are achieved, and maintenance costs are reduced.

CN118484499BActive Publication Date: 2024-11-26DISJIE (BEIJING) DATA MANAGEMENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410939962.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-15
Publication Date
2024-11-26
Estimated Expiration
2044-07-15

AI Technical Summary

Technical Problem

The prior art has problems of data loss or inconsistency in real-time data replication, especially after abnormal power outage and restart, and the deployment of synchronous analysis transaction log software on the source host increases the source system burden and maintenance costs.

Method used

By extracting the transaction log content of the source database, generating transaction log data files, and parsing and executing instructions in the target database, ensuring the accuracy and consistency of data replication and synchronization, and using log sequence numbers to determine the transaction status and processing failure. Submit transactions and support automatic merge after power outage and restart.

Benefits of technology

It realizes faster data synchronization speed, improves real-time and consistency of data, ensures data consistency between the target database and the source database, reduces the risk of data loss and reduces maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118484499B_ABST
    Figure CN118484499B_ABST
Patent Text Reader

Abstract

The disclosed embodiment provides a SQL Server database real-time data replication method, device, equipment and medium. The method generates a transaction log data file by reposting the stock data in the source database to the target database, and extracting the transaction log content involving the uncommitted transaction log content and incremental data in the stock data based on the transaction log of the source database; the target database receives the transaction log data file reposted by the source database and parses it to obtain the database execution instruction corresponding to the target database; the target database executes the database execution instruction on the stock data reposted by the source database, so as to execute the uncommitted transaction and incremental data transaction in the stock data on the stock data stored in the target database, so as to realize data replication and synchronization. Through the present invention, real-time synchronization and replication of data can be effectively realized, and the reliability and consistency of data can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a method, device, equipment and medium for real-time data replication of a SQL Server database. Background Art

[0002] In database systems, real-time data replication is an important technology that can replicate data from a source database to a target database in real time to ensure data consistency and availability. In real-time data replication, SQL Server database is a commonly used database system that has the characteristics of high performance, reliability, and flexibility.

[0003] Real-time database data synchronization is a technical solution to improve information system availability and ensure business continuity. Through real-time data synchronization, the business data of the target database and the source database remain consistent in real time. When the source database fails and service is interrupted, the application system can quickly switch to the target database to ensure business continuity requirements.

[0004] The database data real-time replication technology based on transaction log analysis has the characteristics of little impact on the performance and data model of the source database, support for heterogeneous operating systems and database platforms, and high data replication performance. It is widely used in emergency disaster recovery, multi-business centers, heterogeneous resource integration, data migration and other fields. This technology captures the online log or archive log of the source database through the log capture process on the source side, and then analyzes the database's INSERT, UPDATE, and DELETE operations and converts them into message packets in an internal specific format, and then sends the message packets to the target side of the replication system through the TCP / IP (Transmission Control Protocol / Internet Protocol, abbreviated as TCP / IP) network. After receiving the message packets, the target side unpacks them and restores the transaction information of the source side into the corresponding SQL (Structured Query Language, abbreviated as SQL) statements, and performs real-time replication on the target database through the local database interface to achieve database data synchronization.

[0005] In order to ensure data consistency between the source database and the target database, the database data replication technology based on log analysis usually takes the transactions of the source database as the minimum replication unit, and performs real-time data replication in strict accordance with the transaction sequence of the source database, to ensure the integrity and consistency of the transactions of the target database and the source database, and to ensure that the target database complies with the transaction logic of the source database. Therefore, in the database data replication technology based on log analysis, the technical key lies in how to ensure the transaction consistency of the source database and the target database, especially after the replication system fails, the target database can be correctly restored according to the requirements of transaction integrity and consistency.

[0006] At present, in order to ensure the integrity and consistency of the replication transactions between the target database and the source database, the following method is generally used: create a commit transaction table in the target database to record the completed commit transaction information, and use the checkpoint mechanism to maintain the commit transaction table and record the recovery starting point information. The main technical features of the checkpoint mechanism are: first, take out the minimum log sequence number of the active transaction in the source database; then delete all the commit transaction information less than or equal to the minimum log sequence number in the commit transaction table of the target database; finally, insert the minimum log sequence number into the commit transaction table as a checkpoint record. When the replication system fails and needs to be recovered, it starts from the minimum log sequence number recorded in the checkpoint, so as to ensure the consistency of transactions after the failure recovery. However, the above-mentioned method of ensuring the consistency of transactions after the failure recovery of the replication system based on the checkpoint mechanism has certain shortcomings: the software operation is completely dependent on the database, and the program needs to be deployed on the database service host node.

[0007] In addition, in the prior art, there are already some solutions to achieve real-time data replication. One of the common methods is to deploy analysis software on the source host and then use the database's transaction log to replicate data. The transaction log records all transaction operations that occur in the database, including transaction start, commit, rollback and other information. By parsing the transaction log, the database change operations can be obtained and copied to the target database. However, the prior art has some problems or shortcomings in the field of real-time data replication. First, the prior art often requires the deployment of software for synchronous analysis of transaction logs on the source host, which increases the source system burden and maintenance costs. Secondly, since the parsing and conversion process of the transaction log is relatively complicated, the prior art may have data loss or data inconsistency problems after abnormal power failure and restart, and additional processing is required. Summary of the invention

[0008] The present invention provides a SQL Server database real-time data replication method, device, equipment and medium, aiming to effectively realize real-time synchronization and replication of data and improve the reliability and consistency of data.

[0009] The technical solution of the present disclosure is as follows:

[0010] In a first aspect, an embodiment of the present disclosure provides a method for real-time data replication of a SQL Server database, comprising:

[0011] The stock data in the source database is transferred to the target database, and based on the transaction log of the source database, the transaction log content involving the uncommitted transaction log content and incremental data in the stock data is extracted to generate a transaction log data file;

[0012] The target database receives and parses the transaction log data file transferred from the source database to obtain the database execution instruction corresponding to the target database;

[0013] The target database executes database execution instructions on the stock data transferred from the source database to execute uncommitted transactions and incremental data transactions in the stock data stored in the target database to achieve data replication and synchronization.

[0014] In a possible implementation, in the method provided by the embodiment of the present invention, based on the transaction log of the source database, extracting the transaction log content involving the uncommitted transaction log content and the incremental data in the stock data includes:

[0015] Based on the transaction log of the source database, the log sequence number of the starting point of the stock data is used as the starting log sequence number of the data replication, and the log sequence number of the ending point of the historical stock data is used as the ending log sequence number of the data replication;

[0016] Analyze the transaction log content between the start log sequence number and the end log sequence number in the transaction log, and determine the log sequence number of the committed transaction log content and the log sequence number of the uncommitted transaction log content;

[0017] Based on the transaction log of the source database, extract the uncommitted transaction log content and the transaction log content generated when incremental data is generated after the existing data.

[0018] In a possible implementation, in the method provided by an embodiment of the present invention, if the transaction log contents between the start log sequence number and the end log sequence number are all committed transaction log contents, only the transaction log contents of the incremental data are extracted.

[0019] In a possible implementation manner, in the method provided in the embodiment of the present invention, generating a transaction log data file includes:

[0020] Special processing is performed on insert transactions in the transaction log of existing data, converting them into delete+insert operations to ensure data consistency;

[0021] The analyzed transaction log content is converted into a file in a preset format for storage, thereby obtaining a transaction log data file.

[0022] In a possible implementation, in the method provided by the embodiment of the present invention, the target database receives and parses the transaction log data file reprinted by the source database to obtain a database execution instruction corresponding to the target database, including:

[0023] Parse the transaction log in the transaction log data file and extract the transaction information of each transaction therein;

[0024] The target database parses the received transaction information and extracts the database execution instruction information;

[0025] The extracted database execution instructions are parsed and processed to make them conform to the grammatical rules of the target database.

[0026] In a possible implementation, in the method provided by the embodiment of the present invention, the target database executes a database execution instruction on the stock data transferred by the source database, including:

[0027] Execute the parsed database execution instruction information in sequence according to the preset order;

[0028] The executed database execution instruction information is loaded into the target database to achieve data replication and synchronization.

[0029] In a possible implementation, in the method provided by an embodiment of the present invention, if the source database experiences a power outage and restart, the transaction log data file stored locally in the source database before the power outage and restart is obtained and transferred to the target database.

[0030] In a second aspect, the embodiment of the present disclosure further provides a SQL Server database real-time data replication device, including:

[0031] A transaction log data file generation module is used to transfer the stock data in the source database to the target database, and based on the transaction log of the source database, extract the transaction log content involving the uncommitted transaction log content and incremental data in the stock data to generate a transaction log data file;

[0032] The parsing module is used for the target database to receive and parse the transaction log data file reprinted by the source database to obtain the database execution instruction corresponding to the target database;

[0033] The execution module is used to execute database execution instructions on the stock data transferred from the source database through the target database, so as to execute the uncommitted transactions and incremental data transactions in the stock data stored in the target database to realize data replication and synchronization.

[0034] In a third aspect, an embodiment of the present disclosure further provides an electronic device, including:

[0035] processor;

[0036] memory for storing processor executable instructions;

[0037] The processor is configured to execute instructions to implement the method of the first aspect.

[0038] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the method of the first aspect when executed by a processor.

[0039] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, comprising a computer program / instructions, wherein the computer program / instructions implement the method of the first aspect when executed by a processor.

[0040] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0041] In the embodiments of the present disclosure, by obtaining the transaction log function of the database, the log sequence number of the real-time synchronization starting point can be accurately obtained, thereby realizing the replication of real-time data. Compared with the traditional batch data replication, this method can achieve faster data synchronization speed and improve the real-time performance of data; by accurately analyzing the transaction log, it is converted into a data file and the relevant log sequence number is saved; after the program is abnormally powered off and restarted, the corresponding uncommitted log is extracted according to the saved log sequence number range, and the subsequent logs are automatically merged to ensure the integrity and consistency of the data; the target end program parses the received data file, parses it into a SQL statement that can be recognized by the database, and loads it into the target end database. In this way, the data consistency between the target end database and the source database can be ensured.

[0042] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0044] Figure 1 A flowchart of a SQL Server database real-time data replication method provided by an embodiment of the present disclosure;

[0045] Figure 2 A schematic diagram of the process of LSN recording during real-time data replication in a SQL Server database real-time data replication extraction method provided by an embodiment of the present disclosure;

[0046] Figure 3 A structural diagram of a SQL server database real-time data replication device provided in an embodiment of the present disclosure;

[0047] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0048] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0049] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0050] Figure 1 A flowchart of a SQL Server database real-time data replication method provided by the first embodiment of the present disclosure, such as Figure 1 As shown, the method may include the following steps:

[0051] S101, reposting the stock data in the source database to the target database, and extracting the transaction log content involving the uncommitted transaction log content and incremental data in the stock data based on the transaction log of the source database, and generating a transaction log data file.

[0052] The source database involved in the present invention is a SQL Server database, and the target database can be any type of database.

[0053] In a specific embodiment of the present invention, by calling the transaction log function of the source database, the log sequence number Current LSN field value of the synchronization start point and end point of the data to be synchronized is obtained based on the transaction log function of the source database, and the First LSN and Last LSN are recorded respectively and saved in the local lsn file. Specifically, the Current LSN is used as the initial value of the First LSN and the Last LSN, and is saved in the local lsn file. Figure 2 The figure shows a flowchart of LSN recording during real-time data replication.

[0054] Step S101 is implemented as follows:

[0055] S1011: Based on the transaction log of the source database, the log sequence number of the starting point of the stock data is used as the starting log sequence number of the data replication, and the log sequence number of the ending point of the historical stock data is used as the ending log sequence number of the data replication.

[0056] Specifically, the log sequence number CurrentLSN field value of the real-time synchronization starting point is obtained through the transaction log function of the database and recorded as First LSN; start to extract historical stock data, and after the stock data extraction is completed, obtain the transaction log sequence number (Current LSN) of the stock end point and record it as Last LSN; save the First LSN and Last LSN in the local lsn file.

[0057] S1012: Analyze the transaction log content between the start log sequence number and the end log sequence number in the transaction log, and determine the log sequence numbers of the committed transaction log content and the log sequence numbers of the uncommitted transaction log content.

[0058] Obtain all transaction logs between the First LSN and the Last LSN in the source SQL Server database, perform special processing on the insert transactions in all transaction logs between the First LSN and the Last LSN recorded when the stock data is extracted, and convert them into delete + insert operations to ensure data consistency.

[0059] S1013: Based on the transaction log of the source database, extract the uncommitted transaction log content and the transaction log content generated when the incremental data is generated after the stock data.

[0060] If there is an uncommitted transaction between the First LSN and the Last LSN, the First LSN is updated to the Begin transaction LSN of the uncommitted transaction, and the Last LSN is updated to the commit LSN of the committed transaction and saved in the local LSN file. If there is no uncommitted transaction between the First LSN and the Last LSN, the First LSN and the Last LSN are updated to the commit LSN of the committed transaction and saved in the local LSN file.

[0061] If the First LSN in the lsn file is not equal to the Last LSN, the source program will extract the uncommitted transaction logs within the closed interval [First LSN, Last LSN] and the transaction logs after (Last LSN, +∞), and automatically merge the uncommitted logs and subsequent logs.

[0062] If the First LSN in the lsn file is equal to the Last LSN, the source program will extract the transaction log after (Last LSN, +∞).

[0063] S102, the target database receives and parses the transaction log data file reprinted by the source database to obtain a database execution instruction corresponding to the target database.

[0064] Specifically, the transaction log in the transaction log data file is parsed to extract the transaction information of each transaction; the target database parses the received transaction information to extract the database execution instruction information; the extracted database execution instruction is parsed and processed to make it conform to the grammatical rules of the target database. The database execution instruction involved in the present invention is an SQL statement.

[0065] S103, the target database executes database execution instructions on the stock data transferred from the source database, so as to execute uncommitted transactions and incremental data transactions in the stock data stored in the target database, thereby realizing data replication and synchronization.

[0066] The parsed database execution instruction information is executed in sequence according to the preset order. The executed database execution instruction information is loaded into the target database to achieve data replication and synchronization.

[0067] In a specific embodiment of the present invention, after the program is restarted due to abnormal power failure, breakpoint resuming is supported. The source program automatically extracts the uncommitted logs in the closed interval [First LSN, Last LSN] based on the locally saved lsn file, and automatically merges them with the logs after (LastLSN, +∞). The specific steps are as follows:

[0068] 1) After the program is abnormally powered off and restarted, read the First LSN and Last LSN values ​​in the local LSN file.

[0069] 2) Extract the uncommitted logs within the closed interval [First LSN, Last LSN] and the logs after (Last LSN, +∞).

[0070] 3) Automatically merge uncommitted logs and subsequent logs.

[0071] Through the above technical means, the present invention realizes a real-time data replication method and device based on SQL Server database, which can effectively realize the seamless replication of stock data and real-time incremental data, and improve the reliability and consistency of data.

[0072] Since the real-time data replication method and device based on the SQL Server database of the technical solution have the following advantages, it can be widely used in many fields.

[0073] First of all, this technical solution can achieve real-time data replication, that is, synchronize the data of the source database to the target database in real time. This is very useful for scenarios that require real-time data disaster recovery, data sharing, data distribution, and data aggregation. For example, in the financial field, banks need to synchronize the data of core business systems to disaster recovery backup systems in real time to ensure data security and consistency. In the field of e-commerce, online transaction data needs to be synchronized to the data analysis system in real time to enable real-time business analysis and decision-making. In the field of medical systems, multi-system businesses need to be aggregated into the Health Commission system to achieve data detection.

[0074] In addition, this technical solution also has good reliability and scalability. By recording the log sequence number and transaction status, data can be automatically merged after power failure and restart to ensure data integrity. At the same time, this solution also supports data replication between multiple source databases and target databases, and can be horizontally expanded according to needs to meet the needs of large-scale data processing.

[0075] In summary, the real-time data replication method and device based on SQL Server database has broad application prospects. Whether in the financial field, e-commerce field, medical field or telecommunications operators and other industries, they can benefit from the efficient and real-time data replication capabilities of this technical solution to improve the efficiency of data processing and business decision-making. Therefore, this technical solution has good market demand and application prospects.

[0076] Based on the same inventive concept, the embodiment of the present disclosure also provides a SQL Server database real-time data replication device. Figure 3As shown, the device 300 includes:

[0077] The transaction log data file generation module 310 is used to transfer the stock data in the source database to the target database, and based on the transaction log of the source database, extract the transaction log content involving the uncommitted transaction log content and incremental data in the stock data to generate a transaction log data file;

[0078] The parsing module 320 is used for the target database to receive and parse the transaction log data file reprinted by the source database to obtain the database execution instruction corresponding to the target database;

[0079] The execution module 330 is used to execute database execution instructions on the stock data transferred from the source database through the target database, so as to execute uncommitted transactions and incremental data transactions in the stock data stored in the target database to achieve data replication and synchronization.

[0080] The specific implementation method and technical effect of the device provided in the embodiment of the present disclosure are similar to those of the above-mentioned method embodiment, and will not be repeated here.

[0081] In addition, combined Figure 1-Figure 3 The SQL Server database real-time data replication method and device described in the embodiments of the present application can be implemented by an electronic device. Figure 4 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.

[0082] like Figure 4 As shown, the electronic device 1000 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 to a random access memory (RAM) 1003 to implement the battery capacity prediction method of the embodiment described in the present disclosure. In the RAM 1003, various programs and data required for the operation of the electronic device 1000 are also stored. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0083] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The electronic device 1000 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0084] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart, thereby implementing the voice control method as described above. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1009, or installed from the storage device 1008, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0085] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings.

[0086] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0087] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0088] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A real-time data replication method for SQL Server database, It is characterized in that include: The stock data in the source database is transferred to the target database, and based on the transaction log function of the source database, the log sequence number Current LSN field value of the starting point of the data to be synchronized is obtained, recorded as First LSN, and the historical stock data is extracted to obtain the transaction log. After the stock data extraction is completed, the log sequence number Current LSN field value of the end point of the data to be synchronized is obtained through the transaction log function, recorded as Last LSN, and the First LSN and the Last LSN are saved in a local lsn file, and the transaction log content between [FirstLSN, Last LSN] in the transaction log is analyzed to determine the log sequence number of the uncommitted transaction log content therein, and the uncommitted transaction log content in the stock data is extracted according to the log sequence number of the uncommitted transaction log content, and the transaction log data file is generated according to the extracted uncommitted transaction log content and the transaction log content of the incremental data; The target database receives and parses the transaction log data file reprinted by the source database to obtain a database execution instruction corresponding to the target database; The target-side database executes the database execution instruction on the stock data reposted by the source-side database, so as to execute the uncommitted transactions and incremental data transactions in the stock data stored in the target-side database, thereby realizing data replication and synchronization.

2. The SQL Server database real-time data replication method according to claim 1, It is characterized in that If the transaction log contents between the log sequence number of the starting point and the log sequence number of the ending point are all submitted transaction log contents, only the transaction log contents of the incremental data are extracted.

3. The SQL Server database real-time data replication method according to claim 1, It is characterized in that Generate transaction log data files, including: Perform special processing on the insert transaction in the transaction log of the stock data and convert it into a delete+insert operation to ensure data consistency; The transaction log content obtained by analysis is converted into a file in a preset format for storage, thereby obtaining the transaction log data file.

4. The SQL Server database real-time data replication method according to claim 1, It is characterized in that The target database receives and parses the transaction log data file reprinted by the source database to obtain a database execution instruction corresponding to the target database, including: Parsing the transaction log in the transaction log data file to extract transaction information of each transaction therein; The target database parses the received transaction information and extracts the database execution instruction information therein; The extracted database execution instructions are parsed and processed to make them conform to the grammatical rules of the target database.

5. The SQL Server database real-time data replication method according to claim 4, It is characterized in that The target-side database executes the database execution instruction on the stock data transferred by the source-side database, including: Execute the parsed database execution instruction information in sequence according to the preset order; The executed database execution instruction information is loaded into the target end database to realize data replication and synchronization.

6. The SQL Server database real-time data replication method according to claim 1, It is characterized in that If the source database is powered off and restarted, the transaction log data file stored locally in the source database before the power off and restart is obtained and transferred to the target database.

7. A real-time data replication device for SQL Server database, It is characterized in that include: A transaction log data file generation module is used to transfer the stock data in the source database to the target database, and based on the transaction log function of the source database, obtain the log sequence number CurrentLSN field value of the starting point of the data to be synchronized, record it as First LSN, start extracting historical stock data to obtain transaction logs, and after the stock data extraction is completed, obtain the log sequence number Current LSN field value of the end point of the data to be synchronized through the transaction log function, record it as Last LSN, save the First LSN and the Last LSN in a local lsn file, analyze the transaction log content between [First LSN, Last LSN] in the transaction log to determine the log sequence number of the uncommitted transaction log content, extract the uncommitted transaction log content in the stock data according to the log sequence number of the uncommitted transaction log content, and extract the uncommitted transaction log content according to the extracted uncommitted transaction log content and the transaction log content of the incremental data; A parsing module, used for the target database to receive and parse the transaction log data file reprinted by the source database to obtain a database execution instruction corresponding to the target database; The execution module is used to execute the database execution instruction on the stock data transferred from the source database through the target database, so as to execute the uncommitted transactions and incremental data transactions in the stock data stored in the target database to realize data replication and synchronization.

8. An electronic device, It is characterized in that include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.